by Jim » Fri Dec 31, 2010 9:12 pm
I made some (hopefully) improvements to Didier's dline.rb double-line & wall tool. Mostly the changes are to improve user interaction with the tool. - Tab key brings up the options dialog, otherwise the previous values are in effect.
- Values are saved between uses, and between sessions.
- Options dialog and Measurements display/accept Model Units.
- Can enter the Width in the Measurements (VCB) upon activation.
- Right-Click empty space to finish the line. (Same as Enter key.)
- Fixed line color wrt inferences, and fixed inference locking.
- Add a ConstructionPoint to start of line for later inferencing (deleted upon completion.)
- Fixed clipping.
- Wrapped code in module namespace.
- Renamed menu to Double Line 2
This file is meant to replace dline.rb file if installed, but can co-exist alongside dline.rb. Download dline2.rb
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by Ben Ritter » Fri Dec 31, 2010 9:49 pm
Thank you Jim.
-
Ben Ritter
-
- Posts: 468
- Joined: Wed Nov 14, 2007 4:55 pm
- Name: Ben Ritter
- Operating system: Windows
- SketchUp version: pre-2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Intermediate
by Jim » Fri Dec 31, 2010 10:17 pm
Sure; although there seems to be some problems with the creation of the geometry in some cases. I haven't looked at that part.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 10:45 am
Jim I also noticed that you use the onKeyDown method to get 'TAB'... this usually fails on a MAC as TAB is screwed on key-down... the recommended way is to use - Code: Select all
def onKeyUp(key, repeat, flags, view) if key==9 or key==15 or key==48 ### TAB =9 for PC, MAC 15/48 for some locales ? ###
Note how I also have some other keys mapped as in some locales/MacOSs it seems that '9' isn't Tab 
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Thu Jan 06, 2011 11:19 am
Is there no VK_* constant for tab that would be correct for the platform it runs on?
-

thomthom
- PluginStore Author

-
- Posts: 19456
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by TIG » Thu Jan 06, 2011 11:31 am
thomthom wrote:Is there no VK_* constant for tab that would be correct for the platform it runs on?
No. There should be but it's missing... It's a simple matter to always check for 'key-up' if using 'Tab' though 
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by pilou » Thu Jan 06, 2011 1:34 pm
Don't work on the V6 (pc) Drawing lines are good but Walls are not drawn when Enter pressed  - Code: Select all
Error: #<ArgumentError: wrong number of arguments(2 for 1)> C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157:in `start_operation' C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157:in `onReturn' C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157
-

pilou
- Top SketchUcator
-
- Posts: 22694
- Joined: Wed Jan 23, 2008 10:33 pm
- Name: Pilou
- Operating system: Windows
- SketchUp version: 2017
- License type: Free/Make
- SketchUp use: hobby
- Level of SketchUp: Advanced
-
by TIG » Thu Jan 06, 2011 2:25 pm
Pilou wrote:Don't work on the V6 (pc) Drawing lines are good but Walls are not drawn when Enter pressed  - Code: Select all
Error: #<ArgumentError: wrong number of arguments(2 for 1)> C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157:in `start_operation' C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157:in `onReturn' C:/Program Files/Google/Google SketchUp 6/Plugins/dline2.rb:157
This is the same problem I mentioned with DrawHelix and model.start_operation taking a second argument after v6. Unfortunately in this tool it is NOT coded to allow use in v6 at all... BUT here is the fix... In a copy of the script in the v6 folder find the two lines reading [one might be in French  ] Sketchup.active_model.start_operation("Double Line", true)and edit the text so there is no 'true' thus Sketchup.active_model.start_operation("Double Line")Now it will work in v6 [this will also work in v7/8 but is less efficient in refresh of display terms] I think a relatively idiot proof way of doing a start_operation that is optimized for all versions is - Code: Select all
begin Sketchup.active_model.start_operation("Double Line", true) rescue Sketchup.active_model.start_operation("Double Line") end
That is, it tries to start an operation with a second argument flag set [best for most v7/8 uses] BUT if it fails then it does one without the flag - e.g. v6..........
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 2:48 pm
No one really responded when I asked the question about begin-rescue clause with start_operation. Probably a poor choice for a topic sentence on my part. viewtopic.php?f=180&t=22338
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 2:54 pm
Jim wrote:No one really responded when I asked the question about begin-rescue clause with start_operation. Probably a poor choice for a topic sentence on my part. viewtopic.php?f=180&t=22338 Great minds think alike... fools never differ...I agree that this begin-rescue way is less prone to error like your .version v. .version_number typo which screwed Pilou's v6...
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 3:03 pm
I can't get my Mac to print out the key code for a Tab? using this: http://rhin.crai.archi.fr/RubyLibraryDe ... php?id=205
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 3:15 pm
For onKeyDown it won't as Tab on Mac doesn't fire onKeyDown But with onKeyUp it should return 9 BUT note that some locales/MacOSs can return 15 or even 48 for Tab... I use this - Code: Select all
### Type 'keycode' in the Ruby Console... class TIG_KeyCode def activate @key="" puts "TIG's Non-Shortcut Keycode Reporter.\n" puts "Click in the Main Window outside of the" puts "Ruby Console then Press Non-Shortcut Keys..." end def onKeyDown(key, repeat, flags, view) @key=key.to_s puts "You Pressed Keycode = "+@key end def onKeyUp(key, repeat, flags, view) @key=key.to_s puts "You Released Keycode = "+@key end def deactivate(view) puts "You have pressed a Shortcut Key...\nExiting." return nil end end#class def keycode() Sketchup.active_model.select_tool(TIG_KeyCode.new) puts "" end#if
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 3:23 pm
Well, that's rather a pain, not to mention bug-ish.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by thomthom » Thu Jan 06, 2011 3:26 pm
Is it reported?
-

thomthom
- PluginStore Author

-
- Posts: 19456
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by TIG » Thu Jan 06, 2011 3:31 pm
thomthom wrote:Is it reported?
I have seen it discussed in various places - I've added it to the Tool's API notes...
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 4:13 pm
TIG wrote:I have seen it discussed in various places - I've added it to the Tool's API notes...
Link?
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by thomthom » Thu Jan 06, 2011 4:16 pm
Jim wrote:TIG wrote:I have seen it discussed in various places - I've added it to the Tool's API notes...
Link? http://code.google.com/apis/sketchup/do ... idgetTitle
-

thomthom
- PluginStore Author

-
- Posts: 19456
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Jim » Thu Jan 06, 2011 4:17 pm
I don't see any note.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by Jim » Thu Jan 06, 2011 4:21 pm
Updated to fix Tab issue and correct start_operation for version 6+ viewtopic.php?f=323&t=33875
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 4:27 pm
Jim wrote:TIG wrote:I have seen it discussed in various places - I've added it to the Tool's API notes...
Link?
Y'know... I don't recall... BUT I have been avoiding using onKeyDown for TAB-key for MAC compatibility for ages by using onKeyUp key==9 etc... I even teach it to my students I've search my usual haunts... and not found a link but there must be something somewhere as I can't have dreamed up the problem alone... It seems to have been raised around here viewtopic.php?p=273542#p273542 Jeff was also involved and Fredo? ...
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by TIG » Thu Jan 06, 2011 4:29 pm
Jim wrote:I don't see any note.
It's currently the first item in the User Notes list [~5 hours ago] - are your pages cached ? Try refreshing them...
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by TIG » Thu Jan 06, 2011 4:31 pm
Jim When you link back to something you need to get the link from the 'small-file-square' below the post's title Capture.PNG that way you link to the very page, not the thread itself... viewtopic.php?p=297720#p297720 works viewtopic.php?f=323&t=33875 does not.
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 4:38 pm
Of course it works. I'm not sure what problem you are having.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 4:43 pm
Jim wrote:Of course it works. I'm not sure what problem you are having.
No - these link to different posts... Click on the two I gave to see the difference. If you have your posts sorted in chronological order it looks the same [at least initially] because the first post is at/near the top BUT if you sort in reverse order, like I do, so that the most recent posts are shown first then the initial download thread is not accessed by the click as it's by now on another page... In passing... I not that you latest version of dline2 missed a 'start_operation' around line #287 so it's still not v6 compatible...  It's effectively defining 'double-click' to be taken as 'enter' - I note that ones 'Double ligne' and the others 'Double line' are also probably typos left over from Didier...
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 4:45 pm
Well, that different than "not working." I see your point.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 4:48 pm
Jim wrote:Well, that different than "not working." I see your point.
It 'wasn't working' because it wasn't 'linking to the post' but rather linking directly to the thread itself which was somewhat redundant as you were linking from within it already - not the desired result I must assume... 
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 5:27 pm
TIG wrote:In passing... I not that you latest version of dline2 missed a 'start_operation' around line #287 so it's still not v6 compatible...  It's effectively defining 'double-click' to be taken as 'enter' - I note that ones 'Double ligne' and the others 'Double line' are also probably typos left over from Didier...
I only intended to add some user-interface niceties such as persistent options for selfish reasons, and didn't look too closely at the other parts of the script. I did add version checking to the other start_operation, thanks. Download link in first post. viewtopic.php?f=323&t=33875#p297720
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by TIG » Thu Jan 06, 2011 5:55 pm
Your download link isn't working for me again [ viewtopic.php?f=323&t=33875#p297720 viewtopic.php?f=323&t=33875#p297720 ] It should be viewtopic.php?p=297720#p297720 viewtopic.php?p=297720#p297720 ??? What do you get if you copy the link from the 'square' as I suggested earlier ?
TIG
-

TIG
- Global Moderator
-
- Posts: 20333
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Jim » Thu Jan 06, 2011 6:36 pm
TIG wrote:whilst I am sure that there are very 'good reasons' for your suggested approach, I can still see little benefit to me personally to break a habit of a lifetime and actually do things 'properly' 
I might have to take your attitude on this one. viewtopic.php?f=323&t=33956#p298681
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by simon le bon » Thu Jan 06, 2011 9:15 pm
Thank you so much to both of you Dear Tig and Jim. Double line works now "like a charm" in V6 +simon
-

simon le bon
-
- Posts: 1070
- Joined: Sat Jan 26, 2008 10:22 am
- Location: Chouy/ Picardie/ France
- Name: simon le bon
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Plugins
|