Author Topic: Add Points ( Node Editing ) To Polylines  (Read 36039 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Add Points ( Node Editing ) To Polylines
« on: April 25, 2015, 07:02:38 am »
In response to this thread; http://www.cambam.co.uk/forum/index.php?topic=4470.msg32433#msg32433

Allows the user to add point to polylines by just clicking the line with the mouse.

1. Install the dll into your CamBam 'plugins' folder, restart CamBam
2. In the Plugins menu a new item will appear, "Poly Add Point"
3. Draw a polyline, or convert a circle etc. to polylines (it only works with polylines)
4. Select the object so it's highlighted (one object only)
5. click on "Poly Add Point" to run the plugin.
6. You now enter an edit mode "Insert points then press Esc to end"
While in the edit mode you can zoom in or out.
Just click on the line to insert points and when done hit the Esc key.
7. Now you are back to CamBam

To edit the points double click the line; http://www.cambam.info/doc/plus/cad/EditPolyline.htm

I still have to add the translation files, this is version 1 for testing.

Edit: version 2 ( dll only) added below (see this post for details); http://www.cambam.co.uk/forum/index.php?topic=4855.msg36727#msg36727

Edit: version 3 ( dll only) added below

When you click to add a point, now if you keep 'Shift' pressed when you click, the point will be deleted.
other changes listed here; http://www.cambam.co.uk/forum/index.php?topic=4855.msg36739#msg36739

Edit: version 4 (dll only for now) added below

It should address all(most) issues raised in this thread.

Edit: version 5 (dll and source) added below

An undo point was added to the the start and text was changed to;
em.Prompt = TextTranslation.Translate("Points; LeftClick to Insert, Shift + LeftClick to Delete, Esc to end");

Edit version 7 added below
Undo seems to work well using Ctrl+Z

Edit version 8 added below
fixes crash when sometimes starting a new file.

Edit: version 9 attached
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: version 9.1 attached
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

Fixed issue with layers

« Last Edit: January 13, 2017, 12:31:13 pm by EddyCurrent »
Made in England

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1511
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #1 on: April 25, 2015, 08:14:27 am »
Hi Eddy
Just test drove the plugin, Works well and there is some stuff in there I could use in the future.
Dave

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #2 on: April 25, 2015, 08:21:34 am »
Dave, thanks, yes I think I might have broken into new ground with the code this time  ;D
« Last Edit: April 25, 2015, 08:40:25 am by EddyCurrent »
Made in England

Offline tau

  • Storm Trooper
  • ***
  • Posts: 149
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #3 on: April 25, 2015, 09:31:33 am »
Eddy,

thx for sharing this nice piece of code!

One suggestion that came to my mind when i first used it:
 
would it be possible to include the plugin selection to the Polyline Edit Context Menu (calling it while having the Polyline in Edit mode/Polyline Points visible) for better placement of the new points?!

Cheers,

Tunc

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #4 on: April 25, 2015, 09:44:33 am »
Tunc,
I tried that but it seems you can't run 2 'edit modes' at the same time, but that's not to say it's impossible.

Edit: just had a thought, maybe I could make the existing points visible rather than hidden as they are now, I'll have a look at that.  :D
« Last Edit: April 25, 2015, 09:47:16 am by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6583
    • View Profile
    • Cambam V1.0 French Doc
Re: Add Points ( Node Editing ) To Polylines
« Reply #5 on: April 25, 2015, 12:19:13 pm »
Hello,

Cool, a very useful plugin  ;D

About Tau request ; maybe I don't understand the same thing ?

I understand he talk about the menu item position to move from the plugin menu to the Edit/polyline sub menu and/or the context polyline menu ... but visible existing node could be a good addition too  ;D.


Translation for French is done ;)

menu become "Insérer des points"

++
David

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8494
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #6 on: April 25, 2015, 12:54:51 pm »
Yes!  It's a dandy little function that will be very useful!

I, too, encourage you to move it to the Edit/Polylines menu... because it belongs there. <G>

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #7 on: April 25, 2015, 13:25:08 pm »
Yes I will do all of that, just fitting a new Chainset to the wife's bike at the moment, previous owner destroyed the threads for the crank puller  >:(

Thanks for the translation  ;D
Made in England

Offline tau

  • Storm Trooper
  • ***
  • Posts: 149
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #8 on: April 25, 2015, 13:31:54 pm »
Eddy,

thanks for considering my request!  ;)

Quote
Edit: just had a thought, maybe I could make the existing points visible rather than hidden as they are now, I'll have a look at that.
That should do exactly what i had in mind!

And if it is a state or method for the polyline object, than this should do just fine.

You guys are doing great extending CamBam's Features!

Wish i had the time to code some useful stuff as well.... :(


Tunc

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8494
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #9 on: April 25, 2015, 13:50:49 pm »
Do you mean "visible all the time"?

You understand that points can be made visible, if you wish them to be.

If you simply double-click on a polyline, all the points will become visible (and mouse-editable)

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

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6583
    • View Profile
    • Cambam V1.0 French Doc
Re: Add Points ( Node Editing ) To Polylines
« Reply #10 on: April 25, 2015, 14:13:01 pm »
Re

Eddy; I found other texts to translate when reading your code (not understand all), but I think there is a spell error in "Duplicat Point Not Added" ;) .. I'll wait you correct it to avoid duplicate entry in the translation table.

EDIT: when we are in insert mode, the insert function can be run twice if we click another time the menu item without exiting before, and in this case, except for the first point clicked, the little square are not visible. maybe a check is nedded to avoid that the plugin can be run twice ?
(I've the same problem with plugins that use forms; if no check, the form can be open more than one time)

++
David
« Last Edit: April 25, 2015, 14:24:05 pm by dh42 »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #11 on: April 25, 2015, 15:08:54 pm »
David,
These are the strings and translation via google

Poly Add Points
Poly Ajouter des points

Please Select One Item Only
Se il vous plaît sélectionner un élément Seulement

Polylines Only ! - Please Convert to Polylines and try again
Polylignes seulement ! - Se il vous plaît Convertir en polylignes et essayez à nouveau

Insert points then press Esc to end
Points d'insertion puis appuyez sur Echap pour terminer

1 Point Added
1 point ajouté

Duplicate Point Not Added
Dupliquer point pas ajouté
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #12 on: April 25, 2015, 15:12:01 pm »
Do you mean "visible all the time"?

You understand that points can be made visible, if you wish them to be.

If you simply double-click on a polyline, all the points will become visible (and mouse-editable)

Lloyd

No I think he means this;
When the plugin is started and you are ready to click on the line to add new points, the points already in the line should also be visible so you can see where they are, thus helping with placement of new points and avoiding duplicate points.
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #13 on: April 25, 2015, 15:14:24 pm »
Re

Eddy; I found other texts to translate when reading your code (not understand all), but I think there is a spell error in "Duplicat Point Not Added" ;) .. I'll wait you correct it to avoid duplicate entry in the translation table.

EDIT: when we are in insert mode, the insert function can be run twice if we click another time the menu item without exiting before, and in this case, except for the first point clicked, the little square are not visible. maybe a check is nedded to avoid that the plugin can be run twice ?
(I've the same problem with plugins that use forms; if no check, the form can be open more than one time)

++
David

Yes, spelling error  :P

Good point about not running twice, I had not tried that, thanks.
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4782
    • View Profile
Re: Add Points ( Node Editing ) To Polylines
« Reply #14 on: April 25, 2015, 15:18:43 pm »

Wish i had the time to code some useful stuff as well.... :(
Tunc

Thanks, yes it does take quite a bit of time, much to my wife's dismay. She used to be a 'computer widow' in the 80's, looks like she's not in the mood to repeat that  8)
Made in England