Author Topic: Text on Polyline plugin  (Read 12365 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #15 on: June 15, 2015, 06:00:11 am »
Eddy, it occurred to me that you should be able to place any object/geometry along a polyline. If I were to arrange a group of objects on a straight line to my liking then they could be copied along an arbitrary polyline as you are doing with text. It is just a thought, I'm not sure under what circumstance it would be useful.


Jeff,
That is correct, the method is basically, an insertion point on the polyline, a rotation to match the angle of the polyline at that position, a translation to place it on the polyline insertion point.
Made in England

Offline Jeff_Birt

  • CNC Jedi
  • *****
  • Posts: 821
    • View Profile
Re: Text on Polyline plugin
« Reply #16 on: June 15, 2015, 13:07:40 pm »
Exactly. I have been trying to think of practical uses of placing arbitrary geometric objects along an arbitrary polyline. One use might be to place a series of holes along a polyline. Picture a cover of some sort, you know that you want a series of bolts around the cover with the centerline 1/2" in from the edge. So you do an offset of the outer edge of the cover to get a polyline describing the centerline and then place a series of holes along that line. For this instance you would likely want the ability to choose a number of holes or an approximate spacing which in either case would mean you would need to know the total length of the polyline to figure out the spacing of holes.

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #17 on: June 15, 2015, 14:38:00 pm »
. . . in either case would mean you would need to know the total length of the polyline to figure out the spacing of holes.

//*************

Polyline pl1 = new Polyline();
double length;

... draw polyline and add to file etc.

length = pl1.GetPerimeter();

//*************

It works for open or closed polylines, the CBubble plugin shows Perimeter values.
« Last Edit: June 15, 2015, 14:41:52 pm by EddyCurrent »
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6211
    • View Profile
    • Cambam V1.0 French Doc
Re: Text on Polyline plugin
« Reply #18 on: June 15, 2015, 16:38:11 pm »
Hello,

You can also found useful functions in PoinlistUtils:

CreatePointlistFromPolyline, CreatePointlistFromPolylineStep

http://www.atelier-des-fougeres.fr/Cambam/Aide/API%20Doc/Cambam_cad_dll/Cambam_cad/PointListUtils.html

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #19 on: June 15, 2015, 18:51:11 pm »
Source code attached to first post.
This time I've tried to write it as a stand alone class (class TextToLine), there is a small front end part ( class TextDemo) that uses an instance of the class.
« Last Edit: March 23, 2016, 12:10:21 pm by EddyCurrent »
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #20 on: January 09, 2017, 20:21:23 pm »
Update attached to first post, version 3

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
Made in England

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin -UPDATE
« Reply #21 on: November 30, 2019, 20:26:59 pm »
The biggest drawback with this plugin was the text being automatically inserted at the start point of the polyline and this could not be changed by the user.
Recently I had an idea how to overcome this so please find attached version4 of the plugin which allows for a left mouse click at the required text insertion point.

Works with CamBam v1 only. (when I tried to compile for 0.9.8 there was a method I'm using not available in those files)

I have attached a sample cb file that used the plugin.

How to use.
1. Create a polyline upon which to flow the text
2. Create some text and place anywhere on the screen, select the required font and size.
3. Select both the polyline and text then use menu item, Plugins->Text on Polyline
4. A message appears "Click Polyline at Text Insertion Point"
5. Position the cursor as required on the polyline then left click the mouse.
6. The text will be inserted.

The original text and polyline can now be deleted as they have served their purpose.

Tips
1. "Undo" (Ctl+Z) is your friend, if the text is not right just Undo and try again
2. If the text is on the wrong side of the polyline, Undo, select the polyline, use menu item, Edit->Polyline->Reverse, try again
3. If the text is longer than the polyline it will wrap around the end and not look pretty, Undo, adjust the line, text or insertion point and try again.
4. Circles, splines, etc. must be converted to a polyline first as the plugin works with polylines only.
5, Before running the plugin it's a good idea to create a new Layer so that any generated text is in one place,
« Last Edit: November 30, 2019, 20:34:12 pm by EddyCurrent »
Made in England

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1356
    • View Profile
Re: Text on Polyline plugin
« Reply #22 on: November 30, 2019, 21:21:50 pm »
Works Fine Eddy.

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #23 on: November 30, 2019, 21:43:16 pm »
Thanks for the feedback Dave.  ;D
Made in England

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6211
    • View Profile
    • Cambam V1.0 French Doc
Re: Text on Polyline plugin
« Reply #24 on: November 30, 2019, 21:43:39 pm »
Hello

Thanks for this new version  ;)

++
David

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3026
    • View Profile
Re: Text on Polyline plugin
« Reply #25 on: December 01, 2019, 01:41:22 am »
Thanks for this new version
*********************
+1 ;) ;)
My 2ยข

Win 10 64 bit, CB [1.0} rc 1 64 bit, Mach3, ESS, G540

Offline swarfing

  • Droid
  • **
  • Posts: 92
    • View Profile
Re: Text on Polyline plugin
« Reply #26 on: January 18, 2020, 17:21:42 pm »
Guys does this plugin work ok on latest version? with windows 10. not seeing it in the menus? Its telling me there was a problem loading the DLL
« Last Edit: January 18, 2020, 17:26:54 pm by swarfing »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4565
    • View Profile
Re: Text on Polyline plugin
« Reply #27 on: January 18, 2020, 17:50:00 pm »
Yes it works on the latest version, I just updated it in November 2019.
Make sure you downloaded the correct version from here; http://www.atelier-des-fougeres.fr/Cambam/Aide/Plugins/TextOnPolyline.html

Read this thread, that should sort it out.
http://www.cambam.co.uk/forum/index.php?topic=6294.msg50090#msg50090
Made in England

Offline swarfing

  • Droid
  • **
  • Posts: 92
    • View Profile
Re: Text on Polyline plugin
« Reply #28 on: January 18, 2020, 18:46:34 pm »
eddy your a star now all sorted, thank you