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

How to get the number of bars? [Gelöst]


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?

Lösung anzeigen Lösung verbergen

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

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.

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

Exactly through BarPositionData. The one, that has not yet been placed, will have Count equal to 0

Best,
Bart

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

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.

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

Exactly through BarPositionData. The one, that has not yet been placed, will have Count equal to 0

Best,
Bart