sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Angular Dimension

    Scheduled Pinned Locked Moved Plugins
    63 Posts 14 Posters 68.6k Views 14 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.
    • D Offline
      driven
      last edited by

      here's some I made earlier.
      interior.pngexterior.png

      so we have to get them working.... john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        got it...... could be tidier but it's working

          def onKeyDown(key, rpt, flags, view)
              if key ==  VK_ALT 
               @inside = false
               @cursor = nil
               @cursor = OUT_CURSOR
             # end
              
              # redraw in new mode if appropriate
              if @drawn
                # undo the previous operation before redrawing
                # this avoids buildup of unneeded operations on
                # the undo stack        
                Sketchup.undo if @state==0
                draw_angle_dim
                else
                # make sure the cursor change takes effect immediately
                # without this it doesn't change until the user moves
                # the mouse
                UI.set_cursor(@cursor)
              end
            end
          end
          
        def onKeyUp(key, rpt, flags, view)
              if key ==  VK_ALT 
               @inside = true;
               @cursor = nil
               @cursor = IN_CURSOR
               end
        end
        

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • S Offline
          slbaumgartner
          last edited by

          How strange! The key feature seems to be the assignment of nil before assignment of the new cursor. I can't imagine why that would be necessary, but if it works...

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by

            This is something I was looking at today for the other ruby issue, and I just thought I'd play around with the assumption that
            having Booleans and conditionals mixed together Can cause issues like false = false ==> true
            http://stackoverflow.com/questions/3783483/odd-ruby-if-statement-question

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              @slbaumgartner said:

              I thought I was following the documented code...

              hi Steve
              I missed this earlier, but that could explain the problem... there are so many gotcha's...

              one thing that happens now is the to icon switches on button up but the @inside changes on next mouse click, could a conditional delay the icon?

              you should probably move 'cursor bits' of this to the developers forum, tidier for plugin browsers and you might get some answers from people who know what their doing....

              I just try and make other peoples scripts work on mac's, and write a few applescript/shell/su type helpers.. and bets test for anyone really...

              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • M Offline
                Michaelv
                last edited by

                Well at this point in regard to the mod keys for scripts, I'm figuring that the easiest way is to have a Mac and a PC version of the script. Not only it's the easiest from the point of view of scripting, but it allows to use different modifiers, which is more within the usual practice of each machine.

                I have a version ready for you, including text but there is still the cursor issue.

                I worked on the cursor issue yesterday and it's a tough nut. I changed the cursor scripting to make it similar to the API example and to another script I have (in progress) where it works. And it still doesn't work 😲 . There is no difference between the two, yet it doesn't work in this script, and there is still the orbit and pan cursor remanence issue. So something else is going on, which I have to figure out. Maybe today.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  @Michaelv

                  hi,

                  the cursors work on OSX 10.5.8 with the script above if inserted into the original. did you try it?

                  john

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Michaelv
                    last edited by

                    @driven said:

                    @Michaelv

                    hi,

                    the cursors work on OSX 10.5.8 with the script above if inserted into the original. did you try it?

                    john

                    Sent you a PM

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      Michaelv
                      last edited by

                      All Right, done.

                      So here is my final script for MAC:
                      Thanks John I used your mod (and changed it a bit, no more onkeyup), cursor works great now. And option toggles everything, text display and cursor, try it!


                      draw_angle_dim.rb

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        Michaelv
                        last edited by

                        OK the plot thickens.

                        I tried the original icons for the cursor, and it doesn't work. Only John's Icons work, now that's weird, they have the exact same name and extension and location.

                        Also when the option key is pressed the icon only switches when the mouse moves on my version. I'll see what can be done.

                        EDIT: Only when I toggle as the dimension is already drawn, if I toggle while it is being drown, icon switches instantly. πŸ˜„ I thought I didn't dream it before.

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          driven
                          last edited by

                          Hi,

                          test's fine here, I'm not sure what was up with the original icons, they work when I stuck them in a Toolbar button, but not as a cursor,

                          I know when I scaled mine down 50% to 16x16 they stopped working, so maybe there's a minimum file size?

                          john

                          learn from the mistakes of others, you may not live long enough to make them all yourself...

                          1 Reply Last reply Reply Quote 0
                          • ipsketchpiI Offline
                            ipsketchpi
                            last edited by

                            Hi

                            How to switch from inner angle tool, which looks like is defoult, to outside angle tool?

                            /IP

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

                              After activating the tool, read the message line at the bottom of the drawing window. πŸ˜’

                              You can also find the usage instruction at the beginning of the rb file if you open it in a text editor.

                              @unknownuser said:

                              • The TAB key toggles between drawing the interior (<180) angle

                              and drawing the exterior (>180) angle dimension. If you press tab

                              after an angle dimension is drawn but before picking the first

                              point of the next angle, the current angle dimension will be

                              redrawn in the new mode.

                              Etaoin Shrdlu

                              %

                              (THERE'S NO PLACE LIKE)

                              G28 X0.0 Y0.0 Z0.0

                              M30

                              %

                              1 Reply Last reply Reply Quote 0
                              • ipsketchpiI Offline
                                ipsketchpi
                                last edited by

                                Thank you for "TAB", now al works, I could not find that πŸ˜„

                                /IP

                                1 Reply Last reply Reply Quote 0
                                • B Offline
                                  BrooksL
                                  last edited by

                                  Uhm, please forgive me if this is a 'duh' question, but I can't seem to get the draw_angle_dim.rb tool to work at all... Running WinXP Pro, SketchUp 8 Pro 8.0.11752.

                                  The icons don't show up, I don't see it on the Plugins menu... how do I activate the tool??

                                  Unfortunately, I don't know much about Ruby, but did try typing DrawAngleDimTool::IN_ICON into the Ruby Console and it does return the correct path and icon file name...and the files are there...
                                  DrawAngleDimTool::IN_CURSOR returns 50001

                                  Help?

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

                                    The most common reason that plugins don't work for people is they aren't installed correctly. Make sure you have both a folder called 'draw_angle_dim' and a file called 'draw_angle_dim.rb' in the Plugins folder of SketchUp. The folder contains two image files; interior.png and exterior.png. When you have all those files in place correctly, open SketchUp and look in the tools menu for 'Angular Dimension.' There you have it. There is no toolbar and it doesn't appear in the Plugins menu.

                                    Etaoin Shrdlu

                                    %

                                    (THERE'S NO PLACE LIKE)

                                    G28 X0.0 Y0.0 Z0.0

                                    M30

                                    %

                                    1 Reply Last reply Reply Quote 0
                                    • B Offline
                                      BrooksL
                                      last edited by

                                      Thanks Dave R; I had just found it hiding on the Tools menu. [is there a way to make it (and other ruby's) appear in a certain order on the Tools menu - like next to the native Dimensions item?]

                                      Would help new users if the usage doc were posted and mentioned how/where to activate it...like this:

                                      Name: draw_angle_dim

                                      Description: Create an angle dimension with arc and text in a new group

                                      Adds item "Angular Dimension" to the SketchUp Tools menu

                                      Usage: - Click 3 points, going around an angle in sequence from any point

                                      on one leg, to vertex, to any point on the other leg (clockwise or

                                      counterclockwise doesn't matter). Be careful where you click -

                                      this tool lets the inference engine assist you but doesn't

                                      force you to click on existing model entities!

                                      - The tool will draw two edges along the sides of the angle,

                                      an arc across the angle, and a text with leader showing the

                                      value of the angle. The two edges make it easy to realign

                                      the group with the original angle if the entity containing it is

                                      subsequently moved or rotated.

                                      - The primitive elements of each dimension are gathered into a Group

                                      named Angular Dimension (<angle>), where <angle> is the measured

                                      angle. If you draw multiple angle dimensions, the <angle> value

                                      will help you identify which is which (unless, of course, you have

                                      several with the same value!).

                                      - Each Angular Dimension drawing is packaged in an operation, so that

                                      undo and redo treat all of the elements as a single step.

                                      - The default radius for the arc is half the distance between

                                      the first pick point and the vertex. The user can override

                                      the radius by typing in the VCB at any time. If a new radius is entered

                                      before the first point is picked for the next angle, the prior

                                      dimension is redrawn at the new radius. The user-selected

                                      radius remains in effect for additional angles until the

                                      user enters a new value or selects a different tool.

                                      - The TAB key toggles between drawing the interior (<180) angle

                                      and drawing the exterior (>180) angle dimension. If you press tab

                                      after an angle dimension is drawn but before picking the first

                                      point of the next angle, the current angle dimension will be

                                      redrawn in the new mode.

                                      - Unlike the built-in "smart" linear dimensions in SketchUp, the

                                      entities drawn by this tool are just graphics; they have no tie

                                      to the original angle and will not follow it or scale if it is

                                      modified. You can open the Group for edit, but it is not likely

                                      you will like the results - it is easier to delete the dimension

                                      Group and do it again.

                                      Date: December 23, 2011

                                      Type: Tool

                                      1 Reply Last reply Reply Quote 0
                                      • B Offline
                                        BrooksL
                                        last edited by

                                        And of course, thanks, slbaumgartner for a cool tool! ...was just a bit mysterious for me since the location and doc were not posted...

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

                                          Most plugin writers put that information in their plugins so you can read it after you download it.

                                          As to putting the menu entry in a specific location in a menu, I'm not sure it can be done.

                                          Etaoin Shrdlu

                                          %

                                          (THERE'S NO PLACE LIKE)

                                          G28 X0.0 Y0.0 Z0.0

                                          M30

                                          %

                                          1 Reply Last reply Reply Quote 0
                                          • T Offline
                                            Texasclodhopper
                                            last edited by

                                            I decide to finally try out this plugin with Sketchup v8 on my Mac. I used the Preferences/Extentions/Install Extension... method after renaming the ZIP file extension to RBZ. The files were installed as stated in a previous post here called "The most common reason that plugins don't work..." with a slight variation that doesn't allow the plugin to work.

                                            The version that I downloaded was for the Mac and was called "draw_angle_dim_Mac". The above extensions installer within Sketchup v8 installed the plugin correctly but one folder level too deep. The installation folder was named the same as the ZIP file "draw_angle_dim_Mac".

                                            You have to move the Ruby script "draw_angle_dim.rb" and the folder "draw_angle_dim" up one level for the plugin to work in Sketchup. Get rid of the folder "draw_angle_dim_Mac".

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

                                            Advertisement