CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 20, 2017, 11:29:18 am


Login with username, password and session length


Pages: [1] 2 3
  Print  
Author Topic: 'Extender' plugin (autocad-like 'extend' and 'trim' features)  (Read 4017 times)
jk
Storm Trooper
***
Offline Offline

Posts: 205


View Profile
« on: September 24, 2016, 15:06:09 pm »

Hello.

One of features I've missed most in CamBam's CAD is the ability to extend line/arc up to the intersection with some object. Think of 'extend' command of Autocad.

So here is the quick and dirty plugin designed to mimic it.

How to use:
1) Run 'Extender' from the Plugins menu
2) Select boundary objects (any objects except points and surfaces wil do)
3) (Repeatedly) click on lines or arcs to be extended

Clicked line/arc should extend from the clicked side up to intersection with the nearest boundary object.
Line or arc segments of polyline may be extended too, in some cases mutating the polyline in a funny way.

Should be very useful for preparing imported dxfs to machining, say, move one edge of pocket boundary to get a sharp corners.

Version 2.0 adds the trim functionality. Hold shift while clicking on lines to perform trim instead of extend.

Source code:
https://github.com/jkmnt/extender

PS Plugin is experimental and may fail in some cases, e.g. for lines with nonzero Z. Or may not )

---
Version 2.0.0
* Added the trim functionality

Version 1.2
  Changed toolbar icon

Version 1.1
  Added pre-extend step to select boundaries
  Text resources are wrapped for translation
  Selection of extendable object is non-snapping for easy aiming
  Toolbar "icon" and Ctrl+Plus shortcut
 

* extender_2_0_0_cb098.zip (13.69 KB - downloaded 48 times.)
* extender_2_0_0_cb_10.zip (13.77 KB - downloaded 34 times.)
« Last Edit: April 10, 2017, 20:42:50 pm by jk » Logged
tau
Storm Trooper
***
Offline Offline

Posts: 113



View Profile
« Reply #1 on: September 24, 2016, 15:40:42 pm »

jk, Thx for this nice extension to the CB toolset!

Works like a charm! Grin
Logged
Bob La Londe
CNC Jedi
*****
Offline Offline

Posts: 2932


^ 8.5 pounds on my own hand poured bait.


View Profile WWW
« Reply #2 on: September 24, 2016, 17:17:50 pm »

Just did a simple test and it works as described.  Very nice tool.  

Critique:
1.  Its a little finicky to select the line to extend because it seems to use the snap to function which is often the grid and not the line, but its workable.  
2.  It would be nice to be able to terminate the plugin by selecting another tool or menu option instead of just by hitting the ESC key.  

Overall:  It is a useful tool as is.  
« Last Edit: September 25, 2016, 00:25:33 am by Bob La Londe » Logged

Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3139



View Profile
« Reply #3 on: September 24, 2016, 19:00:29 pm »

Good plugin and nicely coded in proper OOP style, unlike the hybrid 'ANSI C / C#' style I use  Cheesy and can't see me even getting out of that way either, too old to change.

Bob,
I see what you mean about terminating the plugin but I think hitting 'Esc' is consistent with other CamBam functionality.

Jasper,
I used ILSpy to save the code as a Visual Studio project but some parts do not export in a way that the compiler likes. Can you tell me how your original code code looks compared to this ILSpy saved method ?

private void replace_arc(Arc dst, Polyline src)
      {
         Arc arc = (Arc)src.ToPrimitives()[0];
         dst.set_Point(arc.get_Point());
         dst.set_Start(arc.get_Start());
         dst.set_Sweep(arc.get_Sweep());
         dst.set_Radius(arc.get_Radius());
         dst.Update();
      }

Also to keep David and non English speaking users happy,  it might be a good idea to include translation in this and future plugins, there are plenty of examples and threads about it.

It just needs this include at the strart,

         include CamBam.Util;

and for example,

    CamBam.ThisApplication.AddLogMessage("No valid boundaries selected");

becomes

         CamBam.ThisApplication.AddLogMessage(TextTranslation.Translate("No valid boundaries selected"));


keep up the good work !


« Last Edit: September 25, 2016, 07:23:05 am by EddyCurrent » Logged
SquibLoad
CNC Ewok
*
Offline Offline

Posts: 7


View Profile
« Reply #4 on: September 24, 2016, 19:22:56 pm »

Very nice, I've been hoping for this feature for quite a while. 
This is a great addition!

Please don't take these as criticisms, but a few suggestions occurred to me while using:


Allow selecting plugin tool first, and then select lines to be extended.


Allow serial selection of pairs, for example, select line A and line B to be extended, perform extension, release selections, then select line C and line D, extend them, repeat, etc.


Extend two selected lines to meet that don't currently have an extended crossing point.  this would be useful for changing a corner fillet, for example. Sample work flow- explode, delete fillet, select extender, rejoin lines, re-fillet with different radius.


Thanks for this plugin!
John B



Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3139



View Profile
« Reply #5 on: September 24, 2016, 19:28:48 pm »

Maybe it should follow the same user interface method as Cambam's Trim function ? having said that I've no real problem with it as it stands.
Logged
lloydsp
CNC Jedi
*****
Offline Offline

Posts: 7114



View Profile
« Reply #6 on: September 24, 2016, 21:16:28 pm »

Thank you, JK!  Welcome to the club of CB plugin-ers!

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
Bubba
CNC Jedi
*****
Offline Offline

Posts: 2225



View Profile
« Reply #7 on: September 25, 2016, 00:48:16 am »

Nice addition. Thank you JK. Wink
Logged
dh42
Administrator
CNC Jedi
*****
Offline Offline

Posts: 4686



View Profile WWW
« Reply #8 on: September 25, 2016, 01:55:52 am »

Hello,

Very nice ! and it works very well, good addition !

Quote
1.  Its a little finicky to select the line to extend because it seems to use the snap to function which is often the grid and not the line, but its workable.  

I do not have this pb, I can select any or both of the 2 snap mode, grid or/and object, or nothing (I use the snap toolbar, but it works also with the menu) all mode works with this plugin.

Quote
Also to keep David and non English speaking users happy,  it might be a good idea to include translation in this and future plugins, there are plenty of examples and threads about it.

Lol ; but remember to not translate the menu item itself (the "Extender" text that appears in the Plugin menu) ; it is automatically translated by CamBam.

++
David

Edit: and it works on alpha version too Cool ... I like also the ability to detect multiple intersections with a same object. One request ? ... a toolbar icone, because certainly I will use this tool frequently !
« Last Edit: September 25, 2016, 02:15:03 am by dh42 » Logged
Garyhlucas
CNC Jedi
*****
Offline Offline

Posts: 1001


View Profile
« Reply #9 on: September 25, 2016, 03:51:09 am »

I haven't tried the plug-in yet but I am sure I will find it useful as I brought up this function being needed on the forum a long time ago!

Thanks,
Logged

Gary H. Lucas

Have you read my blog?
 http://a-little-business.blogspot.com/
jk
Storm Trooper
***
Offline Offline

Posts: 205


View Profile
« Reply #10 on: September 25, 2016, 10:55:02 am »

Thank you all for replies. Think I'm not the only one to miss this feature )

Quote
Critique:
1.  Its a little finicky to select the line to extend because it seems to use the snap to function which is often the grid and not the line, but its workable. 
the snap to is getting in the way sometimes, yes.
If somebody knows a suitable EditMode without snap, I may use it.
Now I use PointSelectEditMode (adopted this part of code from the dh42's Filler-Chamfer plugin)
which snaps. Alternatively, I may try to disable the snaps and restore then afterward.

Quote
I used ILSpy to save the code as a Visual Studio project but some parts do not export in a way that the compiler likes. Can you tell me how your original code code looks compared to this ILSpy saved method ?

Also to keep David and non English speaking users happy,  it might be a good idea to include translation in this and future plugins, there are plenty of examples and threads about it.
See the full source code on github (link in updated first post).
Good idea to wrap text resources in Translate(). Easy and may be useful )

Quote
Allow selecting plugin tool first, and then select lines to be extended.
I think I'll add 'Select boundaries' step followed by 'Select object to extend', this way it will be a little more consistent with the native 'Trim'.

Quote
One request ? ... a toolbar icone, because certainly I will use this tool frequently !
Hmm, is there a user way to do a custom toolbars I don't know ? Or you mean plugin should insert itself there programmatically ? )
Logged
lloydsp
CNC Jedi
*****
Offline Offline

Posts: 7114



View Profile
« Reply #11 on: September 25, 2016, 11:47:23 am »

"Hmm, is there a user way to do a custom toolbars I don't know ? Or you mean plugin should insert itself there programmatically ?"

----
The tool should insert a button in the existing toolbar.  There's still plenty of room. 

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
Bubba
CNC Jedi
*****
Offline Offline

Posts: 2225



View Profile
« Reply #12 on: September 25, 2016, 12:07:51 pm »

Not steal the thread but I still could use the dash/dot lines now and then... Wink
 
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3139



View Profile
« Reply #13 on: September 25, 2016, 12:33:06 pm »

Personally I'm not a fan of github, I can't imagine I'll ever use it for my own projects.
Logged
Bob La Londe
CNC Jedi
*****
Offline Offline

Posts: 2932


^ 8.5 pounds on my own hand poured bait.


View Profile WWW
« Reply #14 on: September 25, 2016, 15:45:27 pm »

I would note that while I had some critique I think this is a good plug-in that does what is intended on the first release.  I will use it.  I doubt I'll ever have the time to learn to program for CamBam, and I appreciate those of you who do. 
Logged

Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.153 seconds with 18 queries.

Copyright © 2008 HexRay Ltd. | Sitemap