convert text entities to lines and arcs

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Sergi
Posts: 10
Joined: 09 Jan 2012, 13:00

convert text entities to lines and arcs

Post by Sergi » 09 Jul 2012, 10:38

Hello,

Is there a way to convert text entities to lines and arcs ?

Best regards.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 09 Jul 2012, 16:35

Hello.
The task is not trivial. What is the purpose of such conversion? Have you considered using SHX fonts?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Sergi
Posts: 10
Joined: 09 Jan 2012, 13:00

Re: convert text entities to lines and arcs

Post by Sergi » 09 Jul 2012, 17:40

Hello Alexander,

I need a way to extract vertices from CADText entities.

I've been working with hgpl and cgm export without good results.

SHX font could help me to achive my goal ?

Sergi.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 10 Jul 2012, 11:59

Hello Sergi.
SHX font contains a set of polylines for texts visualization. The following code must be used before importing a drawing to allow using SHX fonts:

Code: Select all

CADImage cadImage;
...
cadImage.Converter.SHXSettings.UseSHXFonts = true;
cadImage.Converter.SHXSettings.SearchSHXPaths = true;
cadImage.Converter.SHXSettings.SHXSearchPaths = @"c:\Program Files\Autodesk\DWG TrueView 2011\Fonts;c:\Users\Support.CST\AppData\Roaming\Autodesk\DWG TrueView 2011\R8\enu\Support"; 
SHXSearchPaths must contain the path(s) to required SHX files. The following example shows how to add SHX text to a drawing:

Code: Select all

CADText entText = new CADText();

CADStyle txtStyle = new CADStyle();
txtStyle.Name = "my_style";
txtStyle.PrimaryFont = @"c:\Program Files\Autodesk\DWG TrueView 2011\Fonts\txt.shx";
cadImage.Converter.Styles.Add(txtStyle);
cadImage.Converter.Loads(txtStyle);

entText.Style = (CADStyle)cadImage.Converter.Styles[cadImage.Converter.Styles.Count - 1];
entText.Color = Color.Red;
entText.Point = new DPoint(0, 0, 0);
entText.Height = 10;
entText.Rotation = 0;
entText.Text = "Hello World!!!";
entText.Loaded(cadImage.Converter);
cadImage.Converter.OnCreate(entText);
cadImage.CurrentLayout.AddEntity(entText);
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Sergi
Posts: 10
Joined: 09 Jan 2012, 13:00

Re: convert text entities to lines and arcs

Post by Sergi » 10 Jul 2012, 18:10

Hello Alexander,

but how can I get the PolyPoints of the CADText entity ?

Sergi

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 11 Jul 2012, 10:35

Hello Sergi.
DXF specification doesn't provide any polypoints for texts. Have you tried export shx texts to hpgl or cgm? What's the problem with export?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Sergi
Posts: 10
Joined: 09 Jan 2012, 13:00

Re: convert text entities to lines and arcs

Post by Sergi » 11 Jul 2012, 11:02

Hello Alexander,

I've tried export to hpgl (bad resolution for arcs and splines) and cgm (better than hpgl, but not good, and moreover resizes the original).

You answered me an email telling that CADtoHPGL.Settings.XScale works incorrectly in current software version and you are working for fixing the problem.

Do you know when it will be solved ?

Sergi.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 12 Jul 2012, 12:50

Hello Sergi.
The resolution term doesn't applicable to vector formats. HPGL sizes defined by its commands. CAD Import .NET current version exports to HPGL with default scale 1 drawing unit = 1 HPGL millimeter. CADtoHPGL.Settings.XScale will be fixed expected at close time.
What about SHX fonts, have you received required effect?

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Sergi
Posts: 10
Joined: 09 Jan 2012, 13:00

Re: convert text entities to lines and arcs

Post by Sergi » 13 Jul 2012, 11:03

Hello Alexander,

- The resolution is not 1 unit -> 1 mm HPGL. Long arc entities have only a few points.


- If I increase text height the resulting HPGL file is the same ! More units not give me more points.


- I've tried SHX fonts with no new effect.


- On Mainform()

cadImage.Converter.SHXSettings.UseSHXFonts = true;
cadImage.Converter.SHXSettings.SearchSHXPaths = true;
cadImage.Converter.SHXSettings.SHXSearchPaths = @"c:\Fonts"; //shx fonts directory


- On create text entity

CADText entText = new CADText();

CADStyle txtStyle = new CADStyle();
txtStyle.Name = "my_style";
txtStyle.PrimaryFont = @"c:\Fonts\extfont.shx";
cadImage.Converter.Styles.Add(txtStyle);
cadImage.Converter.Loads(txtStyle);

//entText.Style = (CADStyle)cadImage.Converter.Styles[cadImage.Converter.Styles.Count - 1];

entText.Style = txtStyle;
entText.Color = Color.Red;
entText.Point = new DPoint(0, 0, 0);
entText.Height = mm_alt;
entText.Rotation = 0;
entText.Text = text;
entText.Loaded(cadImage.Converter);
cadImage.Converter.OnCreate(entText);
cadImage.CurrentLayout.AddEntity(entText);

- If I import the resulting hpgl file the entity is not the same as the original (not complete, broken ...)

- The resulting hpgl file duplicate points (example with cadtext entity representing number 1)


%-12345X@PJL SET RESOLUTION = 300
@PJL SET ORIENTATION = LANDSCAPE
IN;SP1;
PC1,255,0,0;
PU14810,-11656;
PD14318,-11656;
PD14318,-8527;
PD14272,-8569;
PD14170,-8654;
PD14054,-8739;
PD13924,-8823;
PD13853,-8866;
PD13782,-8907;
PD13646,-8981;
PD13516,-9044;
PD13395,-9097;
PD13337,-9119;
PD13337,-8644;
PD13438,-8595;
PD13631,-8488;
PD13811,-8371;
PD13978,-8243;
PD14057,-8176;
PD14131,-8107;
PD14262,-7971;
PD14371,-7837;
PD14458,-7706;
PD14493,-7640;
PD14810,-7640;
PU14810,-11656;
PM0;
PU14810,-11656;
PD14318,-11656;
PD14318,-8527;
PD14272,-8569;
PD14170,-8654;
PD14054,-8739;
PD13924,-8823;
PD13853,-8866;
PD13782,-8907;
PD13646,-8981;
PD13516,-9044;
PD13395,-9097;
PD13337,-9119;
PD13337,-8644;
PD13438,-8595;
PD13631,-8488;
PD13811,-8371;
PD13978,-8243;
PD14057,-8176;
PD14131,-8107;
PD14262,-7971;
PD14371,-7837;
PD14458,-7706;
PD14493,-7640;
PD14810,-7640;
PM1;
PM2;FP;


Sergi.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 13 Jul 2012, 11:40

Hello Sergi.
Please specify if you create the drawing from start or import it. Please send to support@cadsofttools.com an imported drawing, if any. Otherwise please send a demo with one or two entities creation and export, as it proceeded in your application.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

MuhammadSulaiman
Posts: 3
Joined: 16 Jul 2020, 13:11

Re: convert text entities to lines and arcs

Post by MuhammadSulaiman » 16 Jul 2020, 14:27

Hello,

As this might be an old thread, is there any update or a new feature to help converting text entity into a polyline? whether the text is imported from DXF or created using CADEditorX editor.

Best.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: convert text entities to lines and arcs

Post by support » 17 Jul 2020, 19:23

MuhammadSulaiman wrote:
16 Jul 2020, 14:27
As this might be an old thread, is there any update or a new feature to help converting text entity into a polyline?
Unfortunately, there is no function for converting a TEXT entity into polylines.

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply