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
Advertisement