[Question] Best way to control presence of an element inside another element

Tags:

Hello,

I am in charge of developping a PythonPart whose goal is to verify if the elements designed in a drawing file belongs to the right sub-part of the building (aka Batch) they pretend to be in.
For this, an attribute (Batch attribute) on each element is containing the Batch name, while Batches are designed in another drawing file as 3D objects.

The idea is to join each controlled element to its respective Batch using the Batch attribute value and to verify if the volume of the element is contained in the volume of the Batch.

At now, for doing this, I am using the following code (summarily...) based on using GetMinMaxBox function:

# Getting MinMaxBox of Batch to control towards elements
min_max_batch = AllplanBaseElements.GetMinMaxBox(self.batch_volumes, 0.0, True)

for element_to_control in elements:
...ele_list = AllplanElementAdapter.BaseElementAdapterList()
...ele_list.append(element_to_control)
...# Getting MinMaxBox of each individual element
...min_max_element = AllplanBaseElements.GetMinMaxBox(ele_list, 0.0, True)
...if not min_max_batch.IsContaining(min_max_element):
......logger.error(f"Element {comp_id} / {name} : Not contained inside {self.batch} 3D Volume")

This is operating but my concern is that while this is working on PythonParts (anchor plates, ...) this is not working on elements such as walls, slabs, beams.

You can see in attached files an exerpt of the model (in blue the Batch 3D volume in Animation and Wireframe mode) where the two walls are said 'not contained' while the two anchor plates are 'contained'.

Is there a particular restriction in using the GetMinMaxBox function, or is it simply not applicable to walls, slabs, etc.

In such a case, what would be the best way to make this control to any kind of element ?

Best regards.

Attachments (2)

Type: image/png
Downloaded 27 times
Size: 34,81 KiB
Type: image/png
Downloaded 22 times
Size: 109,41 KiB

Show most helpful answer Hide most helpful answer

Hi!

Architectural objects in Allplan are a bit special. They are in fact 2D objects, just being represented as 3D solids in the model. E.g. a wall is just an axis (defined as 2D line) and have the bottom and top elevation. The 3D representation is just a result of extrusion along this axis. It is done by Allplan on the spot, while viewing the content of a drawing file. This result is referred to as ModelElement and this is why you have two methods in BaseElementAdapter: GetElementUUID and GetModelElementUUID. I assume, that the MinMaxBox method extracts the box from the first one, which is not what you want. Therefore, I would treat architecture elements a bit differently.

Firstly, check whether an ElementAdapter is an architectural element with GetArchElementType (non-architectural elements will return tInvalid). Then get their geometry using GetModelGeometry method of the ElementAdapter. This will give you a Polyhedron3D (learn more here), which you can perform your geometrical checks on.

Regarding determining the position: the DeterminePosition might also be interesting for you. Using this function you can check, whether a point is inside or outside a Polyhedron. Maybe you can check, whether all the vertices of the polyhedron representing walls/columns/etc... are inside the batch. Of course, working with MinMax is also fine, maybe even more performant than checking many points.

I hope, this helps you.

Best regards,
Bart

Hi!

Architectural objects in Allplan are a bit special. They are in fact 2D objects, just being represented as 3D solids in the model. E.g. a wall is just an axis (defined as 2D line) and have the bottom and top elevation. The 3D representation is just a result of extrusion along this axis. It is done by Allplan on the spot, while viewing the content of a drawing file. This result is referred to as ModelElement and this is why you have two methods in BaseElementAdapter: GetElementUUID and GetModelElementUUID. I assume, that the MinMaxBox method extracts the box from the first one, which is not what you want. Therefore, I would treat architecture elements a bit differently.

Firstly, check whether an ElementAdapter is an architectural element with GetArchElementType (non-architectural elements will return tInvalid). Then get their geometry using GetModelGeometry method of the ElementAdapter. This will give you a Polyhedron3D (learn more here), which you can perform your geometrical checks on.

Regarding determining the position: the DeterminePosition might also be interesting for you. Using this function you can check, whether a point is inside or outside a Polyhedron. Maybe you can check, whether all the vertices of the polyhedron representing walls/columns/etc... are inside the batch. Of course, working with MinMax is also fine, maybe even more performant than checking many points.

I hope, this helps you.

Best regards,
Bart

Hi,
Thank you for your help.

Best regards.
Marc

Hi Marc,

another issue, that came to my mind regarding specifically walls is that a wall in Allplan does not have a geometry. The wall tier has. Even if a wall has just one tier. So you have to iterate over the tiers (which are child elements of the wall), to get the min-max-box. Maybe that's what helps you better in this case.

Best regards,
Bart


https://campus.allplan.com/ uses cookies  -  More information

Accept