Get_attribute ("SU_LiveComponent" , "Parameters") information on missing units

Hello to all the development team.

When I extract the parameters of a live component from the “Parameters” attribute in the “SU_LiveComponent” dictionary, we find the name of each parameter and its value,
But there is no information on the unit value.
The data is therefore not usable as is unless it is read in the dialog box.
To be able to use the parameters, it is essential that you add an index of units and make known their transcriptions.

inst = Sketchup.active_model.selection.grep(Sketchup::ComponentInstance)[0]

if inst.definition.live_component?
  parameters_json = inst.definition.get_attribute("SU_LiveComponent","Parameters")
  parameters = JSON.parse(parameters_json)["parameters"]
  puts parameters
end

return is

[{"name"=>"width curtain", "value"=>1405},
 {"name"=>"Height curtain", "value"=>2500},
 {"name"=>"2 piece curtain", "value"=>true},
 {"name"=>"curtain fold number", "value"=>21},
 {"name"=>"width curtain open", "value"=>173.401898734177},
 {"name"=>"Opening curtain", "value"=>0.3},
 {"name"=>"Ø rod", "value"=>64},
 {"name"=>"lateral rod overhang", "value"=>150},
 {"name"=>"Height rod", "value"=>0.95}]

What do you think?, it would be an opening start!
:grinning:

Great question and good investigation!

In theory, there ARE “display units” that could be mapped to these values. It can be done, just not sure how easy it can be done, I’ll have a chat with the team.

1 Like