sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Reading mm as inches

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 744 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      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


      metric.jpg

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • Didier BurD Offline
        Didier Bur
        last edited by

        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,

        DB

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          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

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          1 Reply Last reply Reply Quote 0
          • OscarLokO Offline
            OscarLok
            last edited by

            Hi,

            Try this :-
            theX = Integer(a[3]).to_mm

            Oscar

            [b:dhgwcjdo][color=#0080BF:dhgwcjdo]JAYA Design & Renovation Sdn. Bhd.[/color:dhgwcjdo][/b:dhgwcjdo] [b:dhgwcjdo][color=#00BF40:dhgwcjdo]T[/color:dhgwcjdo][color=#00BC42:dhgwcjdo]h[/color:dhgwcjdo][color=#00B843:dhgwcjdo]e[/color:dhgwcjdo] [color=#00B247:dhgwcjdo]e[/color:dhgwcjdo][color=#00AE48:dhgwcjdo]x[/color:dhgwcjdo][color=#00AB4A:dhgwcjdo]p[/color:dhgwcjdo][color=#00A84C:dhgwcjdo]e[/color:dhgwcjdo][color=#00A44D:dhgwcjdo]r[/color:dhgwcjdo][color=#00A14F:dhgwcjdo]t[/color:dhgwcjdo] [color=#009A53:dhgwcjdo]i[/color:dhgwcjdo][color=#009754:dhgwcjdo]n[/color:dhgwcjdo] [color=#009058:dhgwcjdo]c[/color:dhgwcjdo][color=#008D59:dhgwcjdo]u[/color:dhgwcjdo][color=#008A5B:dhgwcjdo]s[/color:dhgwcjdo][color=#00865D:dhgwcjdo]t[/color:dhgwcjdo][color=#00835E:dhgwcjdo]o[/color:dhgwcjdo][color=#008060:dhgwcjdo]m[/color:dhgwcjdo][color=#007C62:dhgwcjdo]i[/color:dhgwcjdo][color=#007963:dhgwcjdo]z[/color:dhgwcjdo][color=#007565:dhgwcjdo]e[/color:dhgwcjdo][color=#007267:dhgwcjdo]d[/color:dhgwcjdo] [color=#006B6A:dhgwcjdo]o[/color:dhgwcjdo][color=#00686C:dhgwcjdo]f[/color:dhgwcjdo][color=#00656D:dhgwcjdo]f[/color:dhgwcjdo][color=#00616F:dhgwcjdo]i[/color:dhgwcjdo][color=#005E71:dhgwcjdo]c[/color:dhgwcjdo][color=#005B73:dhgwcjdo]e[/color:dhgwcjdo] [color=#005476:dhgwcjdo]s[/color:dhgwcjdo][color=#005178:dhgwcjdo]y[/color:dhgwcjdo][color=#004D79:dhgwcjdo]s[/color:dhgwcjdo][color=#004A7B:dhgwcjdo]t[/color:dhgwcjdo][color=#00477D:dhgwcjdo]e[/color:dhgwcjdo][color=#00437E:dhgwcjdo]m[/color:dhgwcjdo][color=#004080:dhgwcjdo].[/color:dhgwcjdo][/b:dhgwcjdo]

            1 Reply Last reply Reply Quote 0
            • chrisglasierC Offline
              chrisglasier
              last edited by

              theX = Integer(a[3]).mm works.

              I'm at GMT+8, so please accept delayed thank yous.

              Chris

              With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement