Support Forum

[Frage] Getting bar label information [Gelöst]


Is there a way to get the bar mark of a reinforcement bar created using python script to be used later in the script?
Also I've noticed that using .SetLabel method seems to label a random bar and not the same one every time the script is executed (even though the method is used on the same BarPlacement object each time).

Lösung anzeigen Lösung verbergen

Hi Karol,

so for the first problem:
You can obtain the rebar mark number of an already placed rebar (where you only have the BaseElementsAdapterList)
using ReinforcementService.GetBarPositionData(). This will give you a list of BarPositionData objects and by reading the attribute Position you will be able to access the mark number.

In Allplan 2025, you will be able to construct the BarPositionData object directly from a BaseElementsAdapter (pointing to a rebar placement) or from BendingShape.

To the second problem: We would appreciate, if you could send us the script on pythonparts (please no spam) @ (please no spam) allplan.com, so we can reproduce the problem and fix it. Just by looking on the code snippet I cannot tell what is wrong.

Best,
Bart.

Hi Karol,

what do you mean by get the bar mark of a reinforcement bar created using python script? Do you mean to read a bar mark already placed in the drawing file in order to create another, similar bar mark on another rebar?

Regarding the randomly placed rebar mark - can you post here some simple example so we could reproduce the problem?

Best,
Bart

The thing I'm trying to accomplish is to make my own custom bar labeling and to do so I'd like to read the mark number of a reinforcement bar that my script created to later label it accordingly (so my custom labeling would match the mark numbers in the bar legend that can be generated by Allplan).

To visualize the random bar labeling problem I generated the reinforcement 4 times using the same script and the same input parameters. The results are in the "random mark numbers" file attached to this reply. I've also attached the code snippet (the "code snippet" file) that shows the part of my code that, at least from my understanding, generates the labeling. The bar I'm trying to label using my code is one of the visible vertical bars but clearly Allplan choses a different one every time, and not even a different bar of the same mark number, as there are couple of them nearby, but totally different bar of a different shape.

Also I'd like to clarify that those two problems aren't connected. I started experimenting with the built-it bar labeling method to perhaps be able to read the mark number from the built-in labeling to use it afterwards when creating my own labeling system.

Anhänge (2)

Typ: image/jpeg
58-mal heruntergeladen
Größe: 74,62 KiB
Typ: image/jpeg
52-mal heruntergeladen
Größe: 82,00 KiB

Hi Karol,

so for the first problem:
You can obtain the rebar mark number of an already placed rebar (where you only have the BaseElementsAdapterList)
using ReinforcementService.GetBarPositionData(). This will give you a list of BarPositionData objects and by reading the attribute Position you will be able to access the mark number.

In Allplan 2025, you will be able to construct the BarPositionData object directly from a BaseElementsAdapter (pointing to a rebar placement) or from BendingShape.

To the second problem: We would appreciate, if you could send us the script on pythonparts (please no spam) @ (please no spam) allplan.com, so we can reproduce the problem and fix it. Just by looking on the code snippet I cannot tell what is wrong.

Best,
Bart.