Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
π« Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
Set_attribute problem
-
I'm getting an attribute from a component this way:
@myid = e.definition.get_attribute("A", "Id")If I do a:
puts @myidI get the correct value.
Something like this: 0481e69d-cbc0-4e4c-2c32-e2d2f7932bdfAnd setting it this way:
e.definition.set_attribute("A", "Id", @myid)or
e.definition.set_attribute("A", "Id", @myid.to_s)But all I get is nil.
What am I doing wrong?
-
If you use this code in your script, then what do you see in the Ruby Console when it runs ?
puts"{@myid}"; e.definition.set_attribute("A", "Id", @myid)Remember that @myid will probably not be accessible in the Console, as I suspect that it's being set within your own method ??
-
~~Then I get:
{@myid}I'm doing it inside a:
sel.each {|e| puts"{@myid}"; e.definition.set_attribute("A", "Id", @myid) }~~
Edit:
Doh!
It was all a small typo with a D instead of a d.
Works as it should now.
Advertisement