GDL
About building parametric objects with GDL.
SOLVED!

Use some values from other value list

jc4d
Expert

Hello,

I have one values{2} list containing some model types and a second values{2} containing all the possible dimensions among all the models.

 

Now, the thing is that depending on the selected model type it could use some of the values sets on the second list.

 

For example, I have 3 model type and the dimensions that all of them altogether could use are 6 different sizes. Now when I choose the first model type, only the first 3 sizes should be displayed in the parameters, if I choose a second model type, then that one will use only the last two sizes from the second list... I really hope all this makes sense.

 

I have setup a starting script, but not sure how to tell to each IF condition to display some values from the main size list.

 

VALUES{2} "model_type" 1,"ORIVENT 51",	2,"ORIVENT 21",	3,"ORIVENT 23"


VALUES{2} "all_base_hgt" 1,"200", 2,"350", 3,"400", 4,"750", 5,"900", 6,"1100"

!!! Problem, how to "call" some of the values from "all_base_hgt" to each IF condition
IF model_type = 1 THEN
	VALUES{2} "base_hgt" 1,"400", 2,"750"
ENDIF

IF model_type = 2 THEN
	VALUES{2} "base_hgt" 1,"400", 2,"750", 3,"900"
ENDIF

IF model_type = 3 THEN
	VALUES{2} "base_hgt" 1,"400", 3,"900"
ENDIF

 

 

Juan

16 REPLIES 16
jc4d
Expert

@runxelwow, great solution, thank you for your time and knowledge 👍.

 

I'm having a braint fart here (I'm jumping between Python(some blender stuff) and GDL). sorry for that.

Now that we have the values displayed in the parameters, how to tell to e.g. a brick object to change their ZZYZX accordingly?

 

Juan

Thank you for the tips, will check it out.

jc4d
Expert

Ok, brain fart time is over, on the Master Script:

ZZYZX = base_hgt*0.001

 Thanks to @A_ Smith  for the 0.001 tip.

jc4d
Expert

I hope this question is relevant to the same topic, otherwise mods can move it.

 

Let's say that the designers don't want to see any numeric value in the parameter list, instead they want to see a text (string) and that string is associated to a dimension in the dictionary.

Is there a way to do it?

 

This is a mockup idea (I know it doesn't run)

dict cs
cs.sizes[1].s[1] = "low model"
cs.sizes[1].s[2] = "High model"
cs.sizes[2].s[1] = "Mid size model"
cs.sizes[2].s[2] = "Other custom strgin"

 

The "Low model" has a associated dimension of 100, "High model" a dimension of 200, "Mid size model" 150 and "Other custom string" 450.

 

Juan

Lingwisyer
Guru

It is in this type of situation in which you would use VALUES{2} as you are displaying descriptors rather than actual values. Using a similar method to Lucas you could use the result from this to pull the relevant values from an array if your options are based on the same basic shapes. Am unsure what will happen if your VALUES{2} does not step by 1, but if that is not a requirement, you might be able to skip a step?

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Idk how to use dict. I assume it's more accurate.

 

though if problem is only in variables naming you can do sometimes like this  

AC 22, 24 | Win 10
Solution

Another take on the case with very easy adjustments:

 

values{2} "modeltype",
	1, "Model 1",
	2, "Model 2"

dict cs
cs.sizes[1].s[1] = 100
cs.sizes[1].t[1] = "Short"
cs.sizes[1].s[2] = 200
cs.sizes[1].t[2] = "Tall"
cs.sizes[2].s[1] = 150
cs.sizes[2].t[1] = "Grande"
cs.sizes[2].s[2] = 300
cs.sizes[2].t[2] = "Venti"
cs.sizes[2].s[3] = 450
cs.sizes[2].t[3] = "Just normal coffee pls"

values{2} "sizes",
	cs.sizes[modeltype].s, cs.sizes[modeltype].t

 

Since the user never sees the index numbers from modeltype there never should be a case where they are not consecutive. But if they are: As long they are integers and bigger than zero it should be fine. Archicad would fill the missing gaps between in the array.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»