cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Design forum

Label that can read objects

Anonymous
Not applicable
I'm working on a label that will note the selected parameters of an object. I have figured out how to get the value of a parameter if I know the parameter in advance.

Is there a way to read the parameters in any object? ...perhaps a request function I'm missing.

The goal is to select an object, label it and choose the parameter to label from a menu (driven by the parameter script).

Best, Patrick
8 REPLIES 8

F_ Beister
Enthusiast

Anonymous
Not applicable
Yes. I have used ASSOCLP_NAME to get the name of an object and ASSOCLP_PARVALUE to get the value of a particular parameter.

The problem is that I need to know the parameter I'm looking for in advance. In other words if I want to label a seat with the material it's made out of, I would need to know that the material parameter is SEAT_MAT. I would love to be able to attach the label to any object and see what parameters are in the object.

F_ Beister
Enthusiast
Have a look at this code:


!################################################################################
!
! Etikett-Parameter-Routine von Frank-Beister+ Jochen Sühlo


DIM NP[],valS[],valN[],valA[],valAt[],askP[13],valP[],sts[],stsT[]


!### request all parameters from main object and
!### store name and value into the arrays

i=1

do
  NameP=""
  rrr=REQUEST ("ASSOCLP_PARVALUE", i, NameP, Art, Zustand, Dimension_1, Dimension_2, Wert)
  if rrr then
    NP=NameP : valS="" : valN=0 : valA=Art
    maxP=i
    if Art=4 then valS=Wert else valN=Wert
	endif
  sts=Zustand
  i=i+1
  while i<501 and rrr



!### print list

DEFINE STYLE "Links" LABEL_FONT_NAME, LABEL_TEXT_SIZE,3,1
DEFINE STYLE "Rechts" LABEL_FONT_NAME, LABEL_TEXT_SIZE,1,0
s=-LABEL_TEXT_SIZE/1000*GLOB_SCALE*1.5

  for i=1 to maxP

    STYLE "Links"
    f=f+1 : text2 0,0,NP

    STYLE "Rechts"
    IF valS="" THEN txt=str("%.4",valN) ELSE txt="»"+valS+"«"
    text2 t,0, txt + " (type=" + str(valA,1,0) + " · " + str(sts,1,0)+"?"
 
    ADD2 0,s

    NEXT i

Anonymous
Not applicable
Thanks so much. Can't wait to try this. I would have never figured this out.

Patrick

Ben Cohen
Contributor
Frank, you are VERY good. Nice work
Ben Cohen
Mac and PC
Archicad (Latest Version) aus
www.4DLibrary.com.au

Anonymous
Not applicable
Many thanks to Frank-Beister+ Jochen Sühlo for their code,

I had a chance to play with this today. I must say this bit of code is great! I learned a lot of things I would have never discovered from the GDL manual. Now I'm working on sorting out the unnecessary parameters to create a useful label object.

F_ Beister
Enthusiast
What could you learn, if you could read selfGDL.com. 😉

Anonymous
Not applicable
selfGDL.com just made it onto my bookmarks bar. I love the way your site is organized. Now I just have to learn German.

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!