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

Get the total mass of reinforcement from inside your PythonPart [Gelöst]

Schlagworte:
  • Allplan API

Hi,

Is there a way to get the total mass of reinforcement directly from inside your PythonPart.

Ultimately what i want to achieve is to assign a attribute to the PythonPart with the Kg/m3 of reinforcement.

Best regards.

Lösung anzeigen Lösung verbergen

Hi!

Depending on, whether you want to determine the weight of already created rebars (existing in the drawing file) or rebars, that are about to be created, the procedure will be slightly different. I assume, that your PythonPart is creating the rebars, meaning that the second case applies here.

In this case you can use the GetBarWeight method to get the weight per 1 m of your bar. Please look on the example GetBarShapeCode, because apparently there is a mistake in the documentation of the function signature. Actually, it requires two argument: steel grade and diameter, which you can get from your BendingShape object. Then you can calculate the mass of one rebar, by multiplying the weight per meter with the length of your bar. To get the length of your bar, get the shape polyline from you BendingShape object with GetShapePolyline method and calculate it's length with CalcLength. Then you multiply this weight by the number of rebars.

When you want to retrieve the data from existing rebars, you have to use the GetBarPositionData for that, as you have to extract these information from a BaseElementAdapter.

Hope that helps!

Best regards,
Bart

Hi!

Depending on, whether you want to determine the weight of already created rebars (existing in the drawing file) or rebars, that are about to be created, the procedure will be slightly different. I assume, that your PythonPart is creating the rebars, meaning that the second case applies here.

In this case you can use the GetBarWeight method to get the weight per 1 m of your bar. Please look on the example GetBarShapeCode, because apparently there is a mistake in the documentation of the function signature. Actually, it requires two argument: steel grade and diameter, which you can get from your BendingShape object. Then you can calculate the mass of one rebar, by multiplying the weight per meter with the length of your bar. To get the length of your bar, get the shape polyline from you BendingShape object with GetShapePolyline method and calculate it's length with CalcLength. Then you multiply this weight by the number of rebars.

When you want to retrieve the data from existing rebars, you have to use the GetBarPositionData for that, as you have to extract these information from a BaseElementAdapter.

Hope that helps!

Best regards,
Bart

Hi,

Thank you, this helped a lot.

best regards,
Frenk