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

Label that can read objects

phubbell
Newcomer
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
iMac, 2.8 ghz Intel Core i7
AC 9 through 17
8 REPLIES 8

F_ Beister
Newcomer

phubbell
Newcomer
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.
iMac, 2.8 ghz Intel Core i7
AC 9 through 17

F_ Beister
Newcomer
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

phubbell
Newcomer
Thanks so much. Can't wait to try this. I would have never figured this out.

Patrick
iMac, 2.8 ghz Intel Core i7
AC 9 through 17

Ben Cohen
Participant
Frank, you are VERY good. Nice work
Ben Cohen

Mac and PC

Archicad (Latest Version) aus

www.4DLibrary.com.au

phubbell
Newcomer
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.
iMac, 2.8 ghz Intel Core i7
AC 9 through 17

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

phubbell
Newcomer
selfGDL.com just made it onto my bookmarks bar. I love the way your site is organized. Now I just have to learn German.
iMac, 2.8 ghz Intel Core i7
AC 9 through 17

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!