Hello,
I’m working on a code that is making a column stucture with dynamic components.
I can give up the info with an inputbox. Everything is working except the height of the dynamic component.
The default input for the height is 3000 mm (called “hoogte” in this code). When i run the code the dynamic component height is 0. How can you call the “hoogte” that the code see it’s a value? When i replace “hoogte” with for example “100”
it works correct.
Here is the code:
prompts = [" Breedte vloer “, " Diepte vloer “, " Hoogte “,” Aantal Velden in de breedte “,” Aantal Velden in de diepte “, " Stramienmaat in de breedte “, " Stramienmaat in de diepte “, " Type Kolom “, " Hartmaat kinderbalken “, " RAL kleur “]
defaults = [8000.mm, 10000.mm, 3000.mm, 2, 2, 4000.mm, 5000.mm, 100, 1050, ‘RAL 5003’,]
list = [””, “”,””, “”,””, “”,””,“100|120|140”,“”,“RAL 5003|RAL 5010|RAL 7035|RAL 7016|RAL 9010|RAL 9017”]
results = inputbox(prompts, defaults,list, “Invoergegevens”)
return nil unless results
breedte, diepte, hoogte, velden1, velden2, str1, str2, kolom, hoh , ral = results
#veld kolommen
model = Sketchup.active_model
defn = model.definitions.load( “Z:/Algemeen 2015/Systeemvloer/Tekeningen/Sketchup/t1.skp” )
for i in 0…velden1-1 do
for j in 0…velden2-1 do
inst = model.active_entities.add_instance( defn, [i*str1,j*str2,0] )
#afmeting en hoogte bepalen
t1 = Sketchup.active_model.entities[0]
t1_def = t1.definition
t1_def.set_attribute ‘dynamic_attributes’, ‘_lenz_formula’, ‘“hoogte”’
dcs = $dc_observers.get_latest_class
dcs.redraw_with_undo(t1)
inst.material = ‘red’
end
end