Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

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

Schlagworte:
  • Python

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

Anhänge (1)

Typ: image/png
32-mal heruntergeladen
Größe: 3,10 KiB

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Zitiert von: 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

Zitiert von: 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

Zitiert von: 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