CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2019, 08:27:42 am


Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: Text on Polyline plugin  (Read 9837 times)
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« Reply #15 on: June 15, 2015, 07: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.
Logged

Made in England
Jeff_Birt
CNC Jedi
*****
Offline Offline

Posts: 821


View Profile
« Reply #16 on: June 15, 2015, 14: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.
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« Reply #17 on: June 15, 2015, 15: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, 15:41:52 pm by EddyCurrent » Logged

Made in England
dh42
Administrator
CNC Jedi
*****
Online Online

Posts: 5675



View Profile WWW
« Reply #18 on: June 15, 2015, 17: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
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« Reply #19 on: June 15, 2015, 19: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 » Logged

Made in England
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« 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
Logged

Made in England
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« 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,

* TextOnPolyline_v4.zip (5.38 KB - downloaded 11 times.)
* Santa.cb (44.2 KB - downloaded 12 times.)
« Last Edit: November 30, 2019, 20:34:12 pm by EddyCurrent » Logged

Made in England
dave benson
CNC Jedi
*****
Offline Offline

Posts: 1168


View Profile
« Reply #22 on: November 30, 2019, 21:21:50 pm »

Works Fine Eddy.


* Capture.PNG (72.3 KB, 887x487 - viewed 17 times.)
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 4077



View Profile
« Reply #23 on: November 30, 2019, 21:43:16 pm »

Thanks for the feedback Dave.  Grin
Logged

Made in England
dh42
Administrator
CNC Jedi
*****
Online Online

Posts: 5675



View Profile WWW
« Reply #24 on: November 30, 2019, 21:43:39 pm »

Hello

Thanks for this new version  Wink

++
David
Logged
Bubba
CNC Jedi
*****
Offline Offline

Posts: 2706



View Profile
« Reply #25 on: December 01, 2019, 01:41:22 am »

Thanks for this new version
*********************
+1 Wink Wink
Logged

My 2ยข
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

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

Copyright © 2018 HexRay Ltd. | Sitemap