Support Forum

[Frage] [PythonParts] GetParentElement

Schlagworte:
  • Pythonpart
  • PARENT

Hi,

I place a PythonPart in a room.

I'd like to retrieve the room's name with GetParentElement (I already created the link between the 2).

I tried :

pythonpart = ElementAdapter.BaseElementAdapter.FromNOIGUID(self.modify_uuid_list[0], self.coord_input.GetInputViewDocument())
local = ElementAdapter.BaseElementAdapterParentElementService.GetParentElement(pythonpart)

but it doesn't work

What is the correct syntax ?

PS I want to get the @507@ attribute of the room as in the annotation

Best Regards

Anhänge (3)

Typ: image/jpeg
58-mal heruntergeladen
Größe: 131,77 KiB
Typ: image/jpeg
56-mal heruntergeladen
Größe: 157,53 KiB
Typ: image/jpeg
44-mal heruntergeladen
Größe: 23,76 KiB

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Well, Colliding is as far as I know not capable of checking the intersection between two polyhedrons. For two polyhedrons use Intersect.

You can also use Intersecting for checking Polyhedrons with BRep. I never tested it, but I guess it might be more performant, as it only checks if the two are intersecting, without actually performing the boolean operation of intersection.

1 - 10 (14)

Hello Christophe,

can you please post the drawing file here? Please, export it with Export loaded drawing files with resources (hopefully there will be not too much resources in the .zip file ). I want to investigate the connection between the door and the room.

Hi,

Here the zip file

Best regards

Anhänge (1)

Typ: application/zip
539-mal heruntergeladen
Größe: 63,56 KiB

After some tests I came up to a conclusion, that a PythonPart cannot be a child object of a room (or any other object) at the moment, because it loses the ability to be modified. Meaning: as soon as there is a Parent-Child link added between a PythonPart and another object (room, a smart symbol), then when trying to modify the PythonPart with double click, an error appears (PythonPartProcessor.cpp). This error is definitely not a result of your wrong syntax. It is an Allplan internal error.

What is your goal in this case? Maybe we can solve it on some other way?

In this specific case, the idea is to establish a list of the doors and/or windows to an Excel spreadsheet (id, localization, dimensions, options, etc.).

I have in mind other examples to come where knowing the localization of the pythonpart from a room will be necessary

With an annotation we can find this information => PARENT(@507@) as above, I would have to transfer this data to the pythonpart...

You don't have to transfer the information about a parent object into the object, you want to evaluate, by any kind of script. If you want to generate a list of the doors/windows/etc. and include the information of the rooms (or other parent objects) they belong to, you can always call the PARENT(...) function of the Allplan formula interpreter, when evaluating the content of a drawing file. For example,
the following query in a report (in the section <CommandText>):

SELECT
@10@[Name=AllrightBauteilID],
Name=ParentLength|f=PARENT(@220@)]
FROM [Filter=@OBJ@.eq.1760,Type=0]

...will select all PythonParts in the drawing file and create a list with the first column containing the AllplanID and the second column containing the length of the parent object. The evaluated PythonParts don't have to contain this information, they only need to habe a PARENT-CHILD connection to another object.

If you want to keep an information about the parent object in the PythonPart, consider the formula Attributes, that can also refer to parent objects.

The problem you will encounter here is, that your PythonParts cannot be a CHILD object of anything, as long as you wand to keep the modification feature.

Hi,

Thanks for your feedback.

Even if using a report could help us in this specific case for create a door's list (so we must see the bi-directional exchanges between Allplan and Excel for options updates), we must keep in mind that dynamically associating an object (pythonpart in occurrence) to its space / room has multiple possible uses.

If I do a script selecting first a room (to retrieve its UUID) then other objects, I could store and inject this data.

Then, I would only have to look for the attribute that interests me with this UUID...

For bi-directional exchanges, can we use bimplus to update options (checkbox attributes) and synchronize into allplan ?

Maybe this way is worth digging...

As far as I know, there is the possibility of changing the attributes in bimplus and import them back to Allplan. Both, export/import of attributes into an excel sheet as well as exchange with bimplus, are worth considering. I guess, only you can evaluate, what is better to accomplish your goal.

Anyway, I will have to retrieve the UUID of the room and put it into the pythonpart

1 - 10 (14)