Perhaps one of the most classic questions I imagine. So, I am writting this piece of code whereby I want to copy Lisanne (this lady in Sketchup as a default component) and paste in point 10,10,10 (in meters).
However this line I am using: [entities.add_instance(definitions,[10,10,0])] gets her to a point very close to 0,0,0. I understand there is an issue with inches and meters but I can’t figure it out. I tried out the following to account for inches (10m=393.7in)
‘entities.add_instance(definitions,[(393.7.m),(393.7.m),0])’ but this gets her to point circa 13.75,13.75,13.75.
So here is an easy one: how should this line be in order to get her to point 10,10,10?
entities.add_instance(definitions, [10.m, 10.m, 10.m])
10.m is declaring “this number is the number of meters I want.”
There are related
to_x methods if you need to convert a number.
Thom’s post on Dealing with Units in SketchUp is a good read.
Many thanks Jim! Thanks for Thom’s link, will check it out.
… and this pattern is safer
cdef = definitions["Lisanne"] if cdef # place the instance here inst = entities.add_instance(cdef, [10.m, 10.m, 10.m]) end
Indeed, thanks again!