Reading mm as inches
-
point = Geom::Point3d.new 50,0,0
UI.messagebox(point)The messagebox states (1270mm,0mm,0mm)
Window Entity, Model and Preferences are all metric.
Can anyone help please?
Chris

-
Hi,
Writing point = Geom::Point3d.new 50,0,0 means 50 inches on X axis
A numeric value (for coordinates,lengths, distances, etc) is always in inches (class Length) in SketchUp. That's weird but that's the way it is.Just write point = Geom::Point3d.new 50.mm,0,0
Hope this helps,
-
Yes that's very good (given the imp/metric debacle) but now I have a problem (because I'm new to this)adding .mm to the variable in the following code:
def self.start
@dlg = UI::WebDialog.new("Nameset")@dlg.set_size 300, 180 @dlg.set_file File.join(File.dirname(__FILE__), "openNames.html") @dlg.add_action_callback("find") {|d, p| a= p.split(",") subDir = a[0]+"/"+a[1]+"/" fileName = a[2]+".skp" theX = Integer(a[3]) theY= 0 theZ = 0 point = Geom::Point3d.new theX,theY,theZ UI.messagebox(point) transform = Geom::Transformation.new point model = Sketchup.active_model entities = model.active_entities path = Sketchup.find_support_file fileName, subDir definitions = model.definitions componentdefinition = definitions.load path instance = entities.add_instance componentdefinition, transform view = model.active_view newview = view.zoom_extents } @dlg.show {}I tried theX = Integer(a[3])+".mm" but no good.
Would be most grateful for more sagacity!
Chris
-
Hi,
Try this :-
theX = Integer(a[3]).to_mmOscar
-
theX = Integer(a[3]).mm works.
I'm at GMT+8, so please accept delayed thank yous.
Chris
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement