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

    How the RUBY apply a dimension(with label, dimension line wi

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 1.8k Views 4 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.
    • OscarLokO Offline
      OscarLok
      last edited by

      May I know that how the RUBY apply a dimension(with label, dimension line with arrow end) to a line or edge, please?

      Thanks
      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
      • Didier BurD Offline
        Didier Bur
        last edited by

        It can't, AFAIK 😞 At least V5 can't.
        Don't know with V6, some topics here are about dims being added to geometry so I suppose it is possible. Did you found nothing helpful in the Ruby docs ? 😲

        DB

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

          Hi, Didier Bur

          Thanks for your reply!
          May I know how to select the end point or mid point with the mouse indicator select via RUBY, please? Just like the indicator appear when the mouse near the end or mid point of an edge.

          Thanks
          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
          • Didier BurD Offline
            Didier Bur
            last edited by

            Hi,

            When implementing a tool class, the pick method called for an InputPoint object should do the trick itself:
            For instance:

            
            def activate
              @ip1 = Sketchup;;InputPoint.new
            ...
            end
            
            def onLButtonDown_old(flags, x, y, view)
              @ip1.pick view, x, y
            ...
            
            

            Look at the example "linetool.rb" which comes with SU.
            Hope this helps,

            DB

            1 Reply Last reply Reply Quote 0
            • R Offline
              RickW
              last edited by

              To confirm, dimensions are unaccessible through ruby, C++, fortran, or anything else, for any version of SketchUp (through v6 at least).

              It's been requested, so we'll see what happens...

              RickW
              [www.smustard.com](http://www.smustard.com)

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                There is a trick that could do this...

                I'll use 'metres' in the example below but you can adjust this to suit whatever units you want...

                Make a 1m long dimension (X) against a horizontal edge - in a 'flat' XY orientation, with a 1m long leader offset (Y).
                Highlight the dim and make it into a component - called let's say 'Dim'.
                Save it externally as its own 'skp' - into a logical folder path.
                In a model, your script then inserts an instance of Dim.skp from the folder.
                In your model/script you have the required edge...
                The edge has a knowable length (let's say 2.1m), so your script transform scales the instance proportionately by x2.1 in X.
                The figured dimension will automatically adjust to 2.1m to suit.
                You can also adjust the leader scale (Y).
                Transform the instance location and rotation to suit the edge's.
                You now have a dimension that reflects the edge's length and orientation. You can also use this method to script a 'dimension' between any two known points...

                You might also be able to change the 'orphaned dim' colour to match the normal dim's colour ? Not sure how to access/set this ???

                The dim's arrow heads will scale in the X... too so you might want to make a set of Dim skps - say 1-100mm, 100mm-1m, 1m-3m, 3m-10m etc and then insert instances of them to match nearest to the edge's length - so that the subsequent scaling of them wouldn't distort the dim-compo's arrow heads too much...

                You could also 'connect' the edge and component-dim using attributes and observers, so if the particular edge changed, then the associated dim-compo could be adjusted automatically to suit... It would then behave very much like a normal associated dimension.
                This could be all very convoluted to achieve, BUT it's still possible...

                TIG

                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