[Plugin] Angular Dimension
-
This tool is an extensive rewrite and enhancement of the idea from Didier Bur's dim_angle.rb. It draws angular dimensions onto a SketchUp model. Changes from Bur's original include:
- user input of desired radius of angle arc, modifiable after drawing until next angle is started or another tool is selected
- user selection of inside (<180) or outside (>180) angle, with cursor indication of mode, modifiable after drawing until next angle is started or another tool is selected
- packaging of drawn elements into a named Group
- undo capability
- clockwise vs counterclockwise selection order does not matter
To install, download and unzip the attached file in your Plugins directory.
[edit] The original version works for Windows but has issues on a Mac. Michaelv and Driven worked on it to make it compatible. If you have a Mac, you should download the second version attached.
[another edit] After finally getting my hands on a Mac, I discovered that the reason for all the struggling with the cursors is that on the Mac, SketchUp is not happy with the color profile info that my Windows pixel editor put into the png files. I opened them in an editor on the Mac, touched them and saved, and then they work. This is especially puzzling since other apps on the Mac are quite happy with these files, just not SketchUp! Anyway, those using Macs should load the final version that Michaelv attached to the last post in this thread.
Get the latest version [PC/MAC] from the PluginStore http://sketchucation.com/pluginstore?listtype=1&author=0&category=0&search=angular+dimension&submit=%3F
-
hi,
it's holding on to the 'Orbit' or 'Pan' cursor if I use either between angles.
it's own cursor comes back and functions, but is hidden behind the hand.
I'm on a mac
otherwise it appears to be working, well done. no error messages...
john
-
@driven said:
hi,
it's holding on to the 'Orbit' or 'Pan' cursor if I use either between angles.
it's own cursor comes back and functions, but is hidden behind the hand.
I'm on a mac
otherwise it appears to be working, well done. no error messages...
john
Hmmm...it doesn't do that on my PC. I don't have a Mac to test on. Maybe someone in the group who has a Mac can help sort this out?
-
Hi,
I just read your script and your cursors use all UPPERCASE which was actually failing gracefully, ie. '@cursor' not defined, but the tool still works.I had a look at your cursor images and see that they had never appeared. I'm getting the 'snap to' squares...
I'll downcase the cursor names and see if that works, but I suspect 'Tab' key will be an issue on mac.
john
-
@driven said:
Hi,
I just read your script and your cursors use all UPPERCASE which was actually failing gracefully, ie. '@cursor' not defined, but the tool still works.I had a look at your cursor images and see that they had never appeared. I'm getting the 'snap to' squares...
I'll downcase the cursor names and see if that works, but I suspect 'Tab' key will be an issue on mac.
john
That seems unlikely...all uppercase is pretty typical convention for constants in Ruby, and should have nothing to do with Mac vs PC. If you are finding @cursor not defined, that seems more likely a problem with the path to the icon files. Are they installed in Plugins/draw_dim_angle?
Try this: open the Ruby Console window and type DrawAngleDimTool::IN_ICON into the input space. The output space should then display the path for interior.png. If the path is mangled or isn't where you installed the png image, that is the problem. You can also type DrawAngleDimTool::IN_CURSOR and you should get a number back, probably somewhere a bit more than 50000. If that doesn't work, SketchUp failed to load the image file.
If you look at onKeyDown, there is a code snippet to print the keycode you get on the Mac. Please let me know what value you get and I'll see if I can code in a trap for PC vs Mac.
-
Hi,
on closer inspection, everything seems fine? except the onKeyDown. EDIT: swapped from Tab to Esc and I still can't get outside dims or cursors
very few ' onKeyDown' work on macs. here's a list from today.
PLATFORM = i686-darwin8.10.1
SEQUENCE 0 of 5 [Function Keys]
DN F2 Key 50 flags 0 rpt 1
UP F2 Key 50 flags 256 rpt 1
DN F3 Key 51 flags 0 rpt 1
UP F3 Key 51 flags 256 rpt 1
DN F6 Key 54 flags 0 rpt 1
UP F6 Key 54 flags 256 rpt 1
DN F12 Key 63243 flags 0 rpt 1
UP F12 Key 63243 flags 8388864 rpt 1SEQUENCE 1 of 5 [Modifiers Keys]
DN Shift alone Key 131072 flags 131330 rpt 1
UP Shift alone Key 131072 flags 256 rpt 1
DN Ctrl alone Key 262144 flags 262401 rpt 1
UP Ctrl alone Key 262144 flags 256 rpt 1
DN Alt alone Key 524288 flags 524576 rpt 1
UP Alt alone Key 524288 flags 256 rpt 1
DN Cmd alone Key 1048576 flags 1048840 rpt 1
UP Cmd alone Key 1048576 flags 256 rpt 1SEQUENCE 2 of 5 [Arrow Keys]
UP UP Key 63232 flags 10486016 rpt 1
UP RIGHT Key 63235 flags 10486016 rpt 1
UP DOWN Key 63233 flags 10486016 rpt 1
UP LEFT Key 63234 flags 10486016 rpt 1SEQUENCE 3 of 5 [Validation Keys]
DN RETURN Key 13 flags 0 rpt 1
UP RETURN Key 13 flags 256 rpt 1
UP TAB Key 9 flags 256 rpt 1
UP DEL Key 127 flags 256 rpt 1
UP BACKSPACE Key 63272 flags 8388864 rpt 1
DN ESCAPE Key 27 flags 0 rpt 1
UP ESCAPE Key 27 flags 256 rpt 1SEQUENCE 4 of 5 [Numbers Keys (Numpad not common)]
UP 1 Key 49 flags 256 rpt 1
UP 2 Key 50 flags 256 rpt 1
UP 3 Key 51 flags 256 rpt 1
UP 4 Key 52 flags 256 rpt 1
UP 5 Key 53 flags 256 rpt 1
UP 6 Key 54 flags 256 rpt 1
UP 7 Key 55 flags 256 rpt 1
UP 8 Key 56 flags 256 rpt 1
UP 9 Key 57 flags 256 rpt 1
UP 0 Key 48 flags 256 rpt 1
UP - Key 45 flags 256 rpt 1
UP = Key 61 flags 256 rpt 1
UP / Key 47 flags 256 rpt 1
UP [ Key 91 flags 256 rpt 1
UP ] Key 93 flags 256 rpt 1SEQUENCE 5 of 5 [Alpha keys (do not use Shift)]
UP s Key 115 flags 256 rpt 1
UP c Key 99 flags 256 rpt 1
UP r Key 114 flags 256 rpt 1complements of a Fredo script c.2007 with a slight update.
john -
@driven said:
Hi,
on closer inspection, everything seems fine? except the onKeyDown. EDIT: swapped from Tab to Esc and I still can't get outside dims or cursors
very few ' onKeyDown' work on macs. here's a list from today.
PLATFORM = i686-darwin8.10.1
SEQUENCE 0 of 5 [Function Keys]
DN F2 Key 50 flags 0 rpt 1
UP F2 Key 50 flags 256 rpt 1
DN F3 Key 51 flags 0 rpt 1
UP F3 Key 51 flags 256 rpt 1
DN F6 Key 54 flags 0 rpt 1
UP F6 Key 54 flags 256 rpt 1
DN F12 Key 63243 flags 0 rpt 1
UP F12 Key 63243 flags 8388864 rpt 1SEQUENCE 1 of 5 [Modifiers Keys]
DN Shift alone Key 131072 flags 131330 rpt 1
UP Shift alone Key 131072 flags 256 rpt 1
DN Ctrl alone Key 262144 flags 262401 rpt 1
UP Ctrl alone Key 262144 flags 256 rpt 1
DN Alt alone Key 524288 flags 524576 rpt 1
UP Alt alone Key 524288 flags 256 rpt 1
DN Cmd alone Key 1048576 flags 1048840 rpt 1
UP Cmd alone Key 1048576 flags 256 rpt 1SEQUENCE 2 of 5 [Arrow Keys]
UP UP Key 63232 flags 10486016 rpt 1
UP RIGHT Key 63235 flags 10486016 rpt 1
UP DOWN Key 63233 flags 10486016 rpt 1
UP LEFT Key 63234 flags 10486016 rpt 1SEQUENCE 3 of 5 [Validation Keys]
DN RETURN Key 13 flags 0 rpt 1
UP RETURN Key 13 flags 256 rpt 1
UP TAB Key 9 flags 256 rpt 1
UP DEL Key 127 flags 256 rpt 1
UP BACKSPACE Key 63272 flags 8388864 rpt 1
DN ESCAPE Key 27 flags 0 rpt 1
UP ESCAPE Key 27 flags 256 rpt 1SEQUENCE 4 of 5 [Numbers Keys (Numpad not common)]
UP 1 Key 49 flags 256 rpt 1
UP 2 Key 50 flags 256 rpt 1
UP 3 Key 51 flags 256 rpt 1
UP 4 Key 52 flags 256 rpt 1
UP 5 Key 53 flags 256 rpt 1
UP 6 Key 54 flags 256 rpt 1
UP 7 Key 55 flags 256 rpt 1
UP 8 Key 56 flags 256 rpt 1
UP 9 Key 57 flags 256 rpt 1
UP 0 Key 48 flags 256 rpt 1
UP - Key 45 flags 256 rpt 1
UP = Key 61 flags 256 rpt 1
UP / Key 47 flags 256 rpt 1
UP [ Key 91 flags 256 rpt 1
UP ] Key 93 flags 256 rpt 1SEQUENCE 5 of 5 [Alpha keys (do not use Shift)]
UP s Key 115 flags 256 rpt 1
UP c Key 99 flags 256 rpt 1
UP r Key 114 flags 256 rpt 1complements of a Fredo script c.2007 with a slight update.
johnBased on this, it looks like maybe it would work if you rename onKeyDown to onKeyUp, as it looks like the up is reported for TAB as key 9. Could you try that and let me know if it works?
Thanks
Steve -
> load('/Library/Application Support/Google SketchUp 8/SketchUp/plugins/draw_angle_dim.rb') true > @cursor nil > DrawAngleDimTool;;IN_CURSOR 50013 > DrawAngleDimTool;;OUT_CURSOR 50014
No cursor, no outside dims
Pressing Tab just strobes the 'Input Box'john
-
@driven said:
> load('/Library/Application Support/Google SketchUp 8/SketchUp/plugins/draw_angle_dim.rb') > true > > @cursor > nil > > DrawAngleDimTool;;IN_CURSOR > 50013 > > DrawAngleDimTool;;OUT_CURSOR > 50014
No cursor, no outside dims
Pressing Tab just strobes the 'Input Box'john
The responses to IN_CURSOR and OUT_CURSOR say that the cursors were created, though I'm not sure that means they found the image files. The response of nil to @cursor indicates nothing, since @cursor is an instance variable not a global. So, the problem still seems to be that the keypress is not toggling the mode to outside. Please try the attached, which looks for the up key event (will not trigger until tab key is released) and let me know if it works.
-
Hi,
the path is fine, I just didn't have that in the log I posted, so it's included here.
> load('/Library/Application Support/Google SketchUp 8/SketchUp/plugins/draw_angle_dim.rb') true > DrawAngleDimTool;;IN_ICON /Library/Application Support/Google SketchUp 8/SketchUp/plugins/draw_angle_dim/interior.png > puts "cursor File Exists? " + File.exists?(DrawAngleDimTool;;IN_ICON).to_s cursor File Exists? true nil
with the latest file the Dim Angle itself is switching, but still no custom cursors.
because Tab also toggels focus on the Inputbox, I changed that to use
VK_ALT || 524288
which is more in line with the standard tools and avoids the focus toggling issue.so the tool functions fully now, just no curors...
john -
I have to admit that I am lost and without a Mac I don't know what else to suggest...sorry! If anyone else can figure this out, I'd love to hear.
-
Same as John,
Substituted VK_ALT on line 350 for == 9 so that option key toggles.
I have no cursor, but I'm working on it.
Also I will include a text to outline what key toggles.Otherwise functions great.
Thanks
-
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.
-
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
-
@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. -
@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?
-
@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
-
@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
-
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
-
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
Advertisement