[Question] Create new attribute automatic get zize of 3D object.

Tags:

Hello everyone.
How to create new attribute in Allplan. The attribute working same with Volume Attribute by using Python?

Attachments (1)

Type: image/png
Downloaded 28 times
Size: 3,10 KiB

Show most helpful answer Hide most helpful answer

Quote by ThanVanHieuEm
Hello everyone.

How to create new attribute in Allplan. The attribute working same with Volume Attribute by using Python?

Hi!
I am not sure, what do you want to achieve. If you want to define a new attribute, then the AttributeService is what you need. But you will never create an attribute, that works exactly the same, as the internal attribute Volume. This is because this attribute has some internal logic, built in Allplan.

I don't know, if I understood your Problem correctly. It would be better, if you could describe your use-case a bit more so we could find a solution?

Best!
Bart

Quote by ThanVanHieuEm
Hello everyone.

How to create new attribute in Allplan. The attribute working same with Volume Attribute by using Python?

Hi!
I am not sure, what do you want to achieve. If you want to define a new attribute, then the AttributeService is what you need. But you will never create an attribute, that works exactly the same, as the internal attribute Volume. This is because this attribute has some internal logic, built in Allplan.

I don't know, if I understood your Problem correctly. It would be better, if you could describe your use-case a bit more so we could find a solution?

Best!
Bart

Thank you for your support.

In my case, I wanted to create an attribute in Allplan to assign to a 3D Object and the attribute value could automatically get the size of the 3D Object when I change the geometry of the 3D Object.

Hi,

You can create your new attribute directly in Allplan and assign a value to this with :

attr_list = BuildingElementAttributeList()

attr_list.add_attribute(<ID>, <value>)

pyp_util.add_attribute_list(attr_list)

Be careful with the type of variable

Here an example as standard PythonPart

Best
Christophe

Quote by ThanVanHieuEm
Thank you for your support.
In my case, I wanted to create an attribute in Allplan to assign to a 3D Object and the attribute value could automatically get the size of the 3D Object when I change the geometry of the 3D Object.

If you create a 3D object, then this object becomes the attribute volume automatically, like every 3D object in Allplan. Therefore I assume, you create a PythonPart with the 3D object inside it. In this case you have to implement the logic of volume calculation into your script.

As Christophe mentioned above, the BuildingElementAttributeList will be the object, where the volume attribute with its value must be stored. Its ID is 220. We (Allplan) will publish an article about that next week. For now, you can use the example from Christophe. Line 226 is where it all happens.

Regarding calculating the volume, if your geometry is complicated you might want to create calculation formulas to do it. Consider using the CalcMass function.

Best,
Bart

I got it. Thank you all


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

Accept