Author Topic: Substitute Primitive  (Read 15628 times)

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4042
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Substitute Primitive
« on: October 19, 2016, 15:32:37 pm »
This may be a little out there for some folks so I know some may not find it as useful, but I do a lot of 3D work from STL files.  Sometimes I get all done with a project I find I need to tweak the original 3D primitive a little bit to get it right.  Or sometimes I cut the job, and find I need to modify the design and recut it for practical reasons. 

Now if I only had one MOP dealing with the 3D operation in the project it might not be any big deal, but I usually have several and sometimes dozens of operations using different tools and different strategies to cut everything the way its supposed to be.  When I deleted the old primitive and insert the new one all those operations become disassociated.  Even if the 3D primitive is ID 1 and the new one comes in as ID 1 all those operations now have blanks in them.  I have to open them one by one and reenter the ID or click select it. 

In the same thought process sometimes I create outlines for selected shape boundaries directly from the 3D primitive.  For molds (99% of my work) I usually create a thin .001 extrusion of the parting line surface of the mold just for the purpose of creating this boundary shape cleanly.  It would be really nice if I could click on the new shape and have it over write the old shape, or be able to delete the old shape and assign its ID number to the new shape. 

Maybe something as simple (in usaeage) as clicking on a primitive, selecting "REPLACE" and then clicking on the new primitive would be possible. 
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

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8394
    • View Profile
Re: Substitute Primitive
« Reply #1 on: October 19, 2016, 15:38:46 pm »
Bob,
Oddly, I had an email conversation with a friend this morning about CB's leaving 'empty MOps' when a primitive is re-drawn or replaced.

I think that it would be useful to do what you suggest.  I also think it would be 'polite' of CB to warn the user that the primitive he's about to replace is "in use" in MOps, and ask if the replacement should be done right there, on the spot.

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6307
    • View Profile
    • Cambam V1.0 French Doc
Re: Substitute Primitive
« Reply #2 on: October 19, 2016, 19:02:11 pm »
Hello,

Quote
I think that it would be useful to do what you suggest.  I also think it would be 'polite' of CB to warn the user that the primitive he's about to replace is "in use" in MOps, and ask if the replacement should be done right there, on the spot.

Yes sure ; it's the reason because I creates the "select unused" plugin to avoid deleting an used shape when I do some cleaning, but Bob request is a good idea.

At least it would be fine if we can select multiple mop then change the ID for all selected mop, as for other values (but that work to select the boundary object if it is used by multiple 3d mop)

++
David


Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4622
    • View Profile
Re: Substitute Primitive
« Reply #3 on: October 19, 2016, 19:34:54 pm »
I've got this 'replace' idea working now hopefully, just needs some tidying up tomorrow :D


Edit: The latest version can always be found here;

Version1
Version2
Version3

Latest: Version4

Edit:
Update attached, version 5


Has been compiled with .NET version 4 assemblies and references to CamBam v1.0 dlls

Has been modified and tested to work on;

    Windows
    Linux

Works with CamBam version 1 ONLY

Edit: (30 October 2018)
Update attached, version 5.1

Fixes a crash reported here; http://www.cambam.co.uk/forum/index.php?topic=6138.msg61539#msg61539
« Last Edit: October 30, 2018, 11:17:49 am by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6307
    • View Profile
    • Cambam V1.0 French Doc
Re: Substitute Primitive
« Reply #4 on: October 19, 2016, 19:41:22 pm »
 ;D minute plugin ?  ;)

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3085
    • View Profile
Re: Substitute Primitive
« Reply #5 on: October 19, 2016, 20:21:51 pm »
Soooo, Eddy you created the plugin while reading Bob's post simultaneously?  ;) :D ;D ;D ;D Man that's fast.
My 2ยข

Win10 (64 bit, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, Endurance Laser.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8394
    • View Profile
Re: Substitute Primitive
« Reply #6 on: October 19, 2016, 20:22:35 pm »
Oh, wow!  Eddy!  You may have produced the most useful plugin in a long time! (I don't mean YOU particulary, I mean "all of us").

I wait for it with 'bated breath!

LLoyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4622
    • View Profile
Re: Substitute Primitive
« Reply #7 on: October 20, 2016, 12:41:22 pm »
Oh, wow!  Eddy!  You may have produced the most useful plugin in a long time! (I don't mean YOU particulary, I mean "all of us").

I wait for it with 'bated breath!

LLoyd

I can't believe that for one minute.  :D

Try the attached. Please note version 1 may fail in some instances until testing is complete.
Also no UNDO added yet.

1. make a new drawing with 2 polylines, closed or open, they do not need to have the same number of points.
2. assign some MOPs to ONE of them and generate toolpaths
3. run the plugin, Plugins->Polyline Replace
4. select the first line, the one you assigned MOPs to, hit Enter
5. select the second line, hit Enter
6. Now just generate toolpaths again and all should work.

Having to go out for a while so I just wanted to get this posted first.

Edit: See my first post for the latest verison.
« Last Edit: October 24, 2016, 15:32:06 pm by EddyCurrent »
Made in England

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4042
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Substitute Primitive
« Reply #8 on: October 20, 2016, 15:39:58 pm »
Eddy, 

It works with basic polylines, but it doesn't work with arcs, circles, poly rectangles or surfaces.  In addition I found when I converted a circle to a polyline it truncated part of the polyline circle when I applied the replacement plugin. 

Its a good start on a plugin, but what I was hoping for is a replace primitive functionality that is mostly book keeping.



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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4622
    • View Profile
Re: Substitute Primitive
« Reply #9 on: October 20, 2016, 16:34:49 pm »
Bob,

Thanks for the feedback.
It seems after reading your first post I got tunnel vision on just applying this to Polylines, I'll have to see if other entities can be accommodated.
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6307
    • View Profile
    • Cambam V1.0 French Doc
Re: Substitute Primitive
« Reply #10 on: October 20, 2016, 19:11:35 pm »
Hello Eddy

Maybe you can have a look on the code of my "select unused" plugin that scan for all drawing objects that can be used in mop (ID field and also other usage like limits) and in parts (points list for nesting)

http://www.cambam.co.uk/forum/index.php?topic=3925.msg26292#msg26292

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4622
    • View Profile
Re: Substitute Primitive
« Reply #11 on: October 21, 2016, 12:47:39 pm »
David,

Saved again ! I don't know how you keep coming up with these code gems but I'm pleased you do.  ;D


Try the attached, hopefully this works as Bob intended.

it's in Plugins->Entity Replace

but if all's well it can be moved somewhere more appropriate.
no UNDO or translation as yet.

Edit: See my first post for the latest verison.
« Last Edit: October 24, 2016, 15:32:20 pm by EddyCurrent »
Made in England

Offline Garyhlucas

  • CNC Jedi
  • *****
  • Posts: 1391
    • View Profile
Re: Substitute Primitive
« Reply #12 on: October 21, 2016, 17:03:30 pm »
This sounds like a killer plug-in. Wish I had the time and programming skills to help you guys. I used the spiral to helix plug-in over the weekend to cut a spherical valve seal in teflon and it worked great.
Gary H. Lucas

Have you read my blog?
 http://a-little-business.blogspot.com/

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4622
    • View Profile
Re: Substitute Primitive
« Reply #13 on: October 22, 2016, 08:30:53 am »
Gary,
Thanks for your comments, if someone can make use of these plugins that's good enough for me, I certainly use plugins written by others and much appreciate them.
Made in England

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4042
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Substitute Primitive
« Reply #14 on: October 22, 2016, 16:22:32 pm »
I just did some basic testing using surfaces, closed polylines, circles, and poly rectangles and it worked for all MOPs using those entities as the primary Primitive ID for the MOP.  Actually once I figured out the very basic steps it worked very well.  

It did not work for those 3D MOPs where it used those entities as Selected Shapes boundaries.  I am not sure if that's good or bad.  I have to think about it to decide if that functionality would be more beneficial or more confusing for users.  I think I am more for this ability than against it.  I think if you change the primary entity you are likely to change the selected shape boundary as well, but since its a 1 for 1 operation it leaves the option open to the user.  A safety check might be to pop a list that says "These MOPs will be affected - (YES/NO)" before implementing the book keeping change.  If you name all your MOPs like I do that would be hugely useful as a heads up.  

I do like that it leaves both entities in place with their original IDs now allowing you to decide whether or not to delete the now unused entity.  I can see more templates now being possible to further automating certain types of jobs.

This will make job tweaks much faster between CAD and CAM, and with templates it can make CAM itself much faster as well.  I am with Lloyd.  This is a massively useful Plug-In.  I don't know if I 100% agree that its the most useful plug-in ever, but its certainly tied with several others for the very top.  

I also think this topic should be moved to the scripts and plug-ins forum since it is no longer wishful thinking, but a solidly useful plug-in now. 

« Last Edit: October 22, 2016, 16:32:19 pm by Bob La Londe »
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