How to get the number of bars if only a shape of type NemAll_Python_IFW_ElementAdapter.BaseElementAdapter is provided? Is there an API for this?
Or the question is: Given a shape of type NemAll_Python_IFW_ElementAdapter.BaseElementAdapter, how can I differentiate between a shape with an amount of 0 and a shape with an amount greater than 0?
- Forum
- CAD Parametric Modelling
- PythonParts
How to get the number of bars? [Solved]
Show solution Hide solution
Hi,
when you want to read the data about the reinforcement position, such as number of bars, mark number or the shape and you have only the ElementAdapter of the shape on hand, use the BarPositionData for it.
In 2025, you can construct this object from adapter (see documentation here)
Example:
>>> bar_data = NemAll_Python_Reinforcement.BarPositionData(ele_adapter) >>> bar_data.Count 15
In Versions prior to 2025, you must use the method ReinforcementService.GetBarPositionData(). It works only with BaseElementAdapterList and gives you list of BarPositionData objects:
>>> bar_data_list = NemAll_Python_Reinforcement.BarPositionData(ele_adapter_list) >>> [bar_data.Count for bar_data in bar_data_list] [15, 12, 9]
The outputs above are of course just examples for you to understand, what can come out.
Exactly through BarPositionData. The one, that has not yet been placed, will have Count equal to 0
Best,
Bart
Hi,
when you want to read the data about the reinforcement position, such as number of bars, mark number or the shape and you have only the ElementAdapter of the shape on hand, use the BarPositionData for it.
In 2025, you can construct this object from adapter (see documentation here)
Example:
>>> bar_data = NemAll_Python_Reinforcement.BarPositionData(ele_adapter) >>> bar_data.Count 15
In Versions prior to 2025, you must use the method ReinforcementService.GetBarPositionData(). It works only with BaseElementAdapterList and gives you list of BarPositionData objects:
>>> bar_data_list = NemAll_Python_Reinforcement.BarPositionData(ele_adapter_list) >>> [bar_data.Count for bar_data in bar_data_list] [15, 12, 9]
The outputs above are of course just examples for you to understand, what can come out.
Exactly through BarPositionData. The one, that has not yet been placed, will have Count equal to 0
Best,
Bart