GDL
About building parametric objects with GDL.
SOLVED!

number of beamsegments in value array

DNU
Booster

Hi all 

For a label linked to a segmented beam I want to chose a segment in the label settings so the label can give the settings from that segment.
Works perfect except for one part; i can't define the value range for how many segments there are in the beam.

Parameters:

 

    I_segment (integer)

 

 

In the Master script;

    I_maxSegments = 0
    For i = 1 to 7 ! 7 is just a random number to prevent crashes
        IF HASKEY(BEAM_SEGMENT_INFO.segments[i].crossSection.startWidth) then
            I_maxSegments = I_maxSegments+1
        ENDIF
    next i
   PRINT I_maxSegments ! this works perfect
 
In the Parameter script;
    VALUES "I_segment" RANGE[1, I_maxSegments]

Values given in the label settings "1 < = value < = 0"

Any Ideas?

AC 14 - 28
WIN 11
GDL
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

BEAM_SEGMENT_INFO is not available in parameter script context, but is in UI context.

parameter script:


for i = 1 to 100 ! a reasonably large number of segments
    put i
next i
values "n" get(nsp) ! range [1, ) doesn't work with ui_infield
 

UI script:

dim pic[], val[], choice[]
for i = 1 to  vardim1(BEAM_SEGMENT_INFO.segments)
    pic[i] = 0
    choice[i] = str(i, 1, 0)
    val[i] = i
next i

ui_infield{4} "n", 0, 0, 100, 20,
    8, "", 0, 0,
    0, 0, 0, 0,
    pic, choice, val

 

The 2d script has to handle that the number of segments can decrease below the selected value.

 

Btw. if you need to label only one of the segments, before label placement you can switch between labeling the whole beam or the segment only by pressing tab when the mouse is on the beam but not on the axis.

Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest

View solution in original post

2 REPLIES 2
Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

BEAM_SEGMENT_INFO is not available in parameter script context, but is in UI context.

parameter script:


for i = 1 to 100 ! a reasonably large number of segments
    put i
next i
values "n" get(nsp) ! range [1, ) doesn't work with ui_infield
 

UI script:

dim pic[], val[], choice[]
for i = 1 to  vardim1(BEAM_SEGMENT_INFO.segments)
    pic[i] = 0
    choice[i] = str(i, 1, 0)
    val[i] = i
next i

ui_infield{4} "n", 0, 0, 100, 20,
    8, "", 0, 0,
    0, 0, 0, 0,
    pic, choice, val

 

The 2d script has to handle that the number of segments can decrease below the selected value.

 

Btw. if you need to label only one of the segments, before label placement you can switch between labeling the whole beam or the segment only by pressing tab when the mouse is on the beam but not on the axis.

Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest

Thanks, Péter!

This works perfect.

The reason I can't link the label to the segment is that the label provides other information, such as properties that are either unavailable or not filled in for the segment.

AC 14 - 28
WIN 11
GDL