Thanks @MikeWayzovski,
Thats interesting, I am not able to get that to work for some reason though? If I make a quick component and try and add some data to a new attribute dictionary (that is: not the ‘dynamic_attributes’ dictionary) using something like:
sel = Sketchup.active_model.selection
sel.each do |s|
if s.class == Sketchup::ComponentInstance
s.definition.set_attribute('my_attributes', '_mytest_access', 'VIEW')
s.definition.set_attribute('my_attributes', '_mytest_label', 'myTest')
s.definition.set_attribute('my_attributes', '_mytest_formlabel', 'Some test label')
s.definition.set_attribute('my_attributes', '_mytest_units', 'FLOAT')
s.definition.set_attribute('my_attributes', '_mytest_formatversion', 1.0)
s.definition.set_attribute('my_attributes', '_mytest_hasbehaviors', 1.0)
s.definition.set_attribute('my_attributes', 'mytest', "Some test value")
end
end
I can’t seem to get that new value to pass over Layout? The new attribute value and dictionary seem to get added to the component definition just fine:
but for some reason I just don’t see that new attribute dictionary available in my Auto-Text tags in Layout:
If use basically identical code, but add the new data to the ‘dynamic_attributes’ dictionary instead, it seems to work and I have access to my new attribute value in Layout as expected:
sel = Sketchup.active_model.selection
sel.each do |s|
if s.class == Sketchup::ComponentInstance
s.definition.set_attribute('dynamic_attributes', '_mytest_access', 'VIEW')
s.definition.set_attribute('dynamic_attributes', '_mytest_label', 'myTest')
s.definition.set_attribute('dynamic_attributes', '_mytest_formlabel', 'Some test label')
s.definition.set_attribute('dynamic_attributes', '_mytest_units', 'FLOAT')
s.definition.set_attribute('dynamic_attributes', '_mytest_formatversion', 1.0)
s.definition.set_attribute('dynamic_attributes', '_mytest_hasbehaviors', 1.0)
s.definition.set_attribute('dynamic_attributes', 'mytest', "Some test value")
end
end
Can you spot where I’m going wrong there? It does seem to make sense as @eneroth3 says to try and use deliberate dictionaries if they are actually able to pass their data over, rather than building on top of the dynamic_attributes.
much thanks!
-Ed