-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the center point of the bounding box of all elements? #441
Comments
Yes, this is possible. You need to use our geometry engine (Xbim.Geometry nuget package) to process all the geometry. Then you will be able to get all the bounding boxes of all elements. |
@martin1cerny Thanks! I have isntalled the package but I can't find a document to Introduce how to use,could you show me a example code? |
You can start with this code: Xbim3DModelContext context = new Xbim3DModelContext(model);
context.CreateContext();
var elements = model.Instances.OfType<IIfcElement>();
foreach (var element in elements)
{
var productShapes = context.ShapeInstancesOf(element);
var bBox = productShapes
.Select(s => XbimRect3D.TransformBy(s.BoundingBox, s.Transformation))
.Aggregate(XbimRect3D.Empty, (last, current) => {
last.Union(current);
return last;
});
} |
@martin1cerny Wow, it works! Thanks very much! |
Hello,xBIM team!
Is there a way to calculate the bounding box of all elements and get the center point of them?
The text was updated successfully, but these errors were encountered: