π‘ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
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 @myid
I 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