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.
    • S Offline
      slbaumgartner
      last edited by

      The mode key seems to be a no-win situation! Maybe I should think of a different mechanism to change the mode. On a PC the TAB key is unassigned, but the VK_ALT activates the File menu! On a Mac, the TAB key is preassigned, but not VK_ALT! By the way, when I try to use VK_ALT on the PC, the cursor alternately disappears and reappears as I press the key! Something similar may be what is happening on the Mac.

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

        @Michaelv,

        the key generator is on the forum, but if you want a slightly updated version, that's easy to add to... I'll PM it to you.

        BTW. if you use either one VK_ALT or 524288 it toggles from the Alt key, but if you use the ruby either/or VK_ALT || 524288 then not only does ALT toggle, so does RETURN!! which shows as 13 when I ran the test. SU key mapping needs checking.

        as for the icons, they work on toolbars, so the file and path are ok (but I made new ones as well), their just not being seen by ruby,

        I'm having a similar problem in another script where only the 'before' half an if not block being seen. Is this a Ruby 1.8.5 (mac SU ruby) issue?

        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:

          the VK_ALT activates the File menu!

          Have you set that as a system shortcut?... do you have assistive devices activated?

          Does Alt open the File Menu when you use 'move' or 'scale' tools?

          are your Plugins still all on? [I turn mine off to test new rubies on there own]

          john

          EDIT: did you try **524288** that work here as well.

          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

            @driven said:

            @slbaumgartner said:

            the VK_ALT activates the File menu!

            Have you set that as a system shortcut?... do you have assistive devices activated?

            Does Alt open the File Menu when you use 'move' or 'scale' tools?

            are your Plugins still all on? [I turn mine off to test new rubies on there own]

            john

            EDIT: did you try **524288** that work here as well.

            Alt key opening a menu is a standard PC shortcut - I didn't do anything special, no assistive devices. Interestingly, ALT seems to affect just about every tool except move, on which it does nothing that I can see! And with the Paint Bucket it displays a dropper icon to let you select a Material to match so long as you hold the ALT key depressed. Goes back to the paint bucket when released. You gotta love consistency and portability!

            I didn't turn off other plugins, but on my PC the tool functions ok so I didn't think that would add anything to this mix.

            Regarding the cursors, is there any chance that the problem is with png files? Do you have other tools with custom cursors from png files that work?

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

              @slbaumgartner said:

              Alt key opening a menu is a standard PC shortcut -

              thought you were taking mac...

              @unknownuser said:

              Interestingly, ALT seems to affect just about every tool except move,
              it should 'move' a copy [with an added + symbol]

              @unknownuser said:

              You gotta love consistency and portability!
              ohhh yerrr

              @unknownuser said:

              Regarding the cursors, is there any chance that the problem is with png files? Do you have other tools with custom cursors from png files that work?

              All of SU's cursors are png's so that's not the problem.

              I want them to work now because I made new ones.... damm
              didn't really need the cursor before.

              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
              • S Offline
                slbaumgartner
                last edited by

                @driven said:

                @slbaumgartner said:

                Alt key opening a menu is a standard PC shortcut -

                thought you were taking mac...

                @unknownuser said:

                Interestingly, ALT seems to affect just about every tool except move,
                it should 'move' a copy [with an added + symbol]

                @unknownuser said:

                You gotta love consistency and portability!
                ohhh yerrr

                @unknownuser said:

                Regarding the cursors, is there any chance that the problem is with png files? Do you have other tools with custom cursors from png files that work?

                All of SU's cursors are png's so that's not the problem.

                I want them to work now because I made new ones.... damm
                didn't really need the cursor before.

                john

                I'm on a PC but trying to help get this tool to work for people with Macs...
                On a PC, the CTRL key toggles the move tool to copy, not ALT!
                Re the cursors, do you have any examples of a tool with custom cursors that do work? I'd like to look at the Ruby to see what it does. I thought I was following the documented code...

                steve

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

                  some progress...

                  if I use either of these changes, I get the inside cursor and a one-off toggle.

                    def onKeyDown(key, rpt, flags, view)
                        if key ==  VK_ALT 
                      #  @inside=nil         # uncomment this with the original order below i.e. true = false
                        !@inside = @inside     # or switch it to false = true     orig.  @inside = !@inside 
                         if @inside
                          @cursor = IN_CURSOR
                          else
                          @cursor = OUT_CURSOR
                        end
                  

                  not sure what to look for next... 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

                    Chris Fulmars 'shapebender.rb' come easily to mind, in the Plugin section here.

                    I got one step more with trying versions of this, I can switch from inside to out logos once...

                    could you split this into 2 separate actions, holding down the Alt is common for SU tools, as apposed to toggling...

                          if key ==  VK_ALT 
                           @inside = false && @cursor = OUT_CURSOR
                            else
                            if key ==  !VK_ALT 
                             @inside = true
                             @cursor = IN_CURSOR
                          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
                    • 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
                                            • 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