sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Reading mm as inches

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 813 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

              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 Login
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement