Get the total mass of reinforcement from inside your PythonPart [Risolto]

Tags:

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.

Show solution Hide solution

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


https://campus.allplan.com/ utilizza cookies  -  Maggiori informazioni

Accetta