question about font and solid object in dxf export

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
tanyg
Posts: 2
Joined: 17 Jul 2006, 17:09

question about font and solid object in dxf export

Post by tanyg » 17 Jul 2006, 17:14

how to add a font and a solid circle to a dxf file when i use dxf export .net to create a dxf file?
thx!

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

Post by support » 18 Jul 2006, 16:27

If you mean text when you say "font" then here is an example of adding the text:

Code: Select all

DXFExport vDXF = new DXFExport();
DXFData Data = new DXFData();
Data.height = 1;
Data.text = "Text";
Data.point.X = 1;
Data.point.Y = -2;
vDXF.AddText(Data);
vDXF.SaveToFile(FileName);	
The code below represents an example of adding a solid circle:

Code: Select all

...
Data.Clear();
Data.color = DXFExport.ColorToDXF(Color.FromArgb(r, g, b));
Data.point.X = 100;
Data.point.Y = 100;
Data.point1.X = 150;
Data.point1.Y = 150;
Data.radius = (Data.point1.X - Data.point.X) / 2;
Data.startAngle = 0;
Data.endAngle = 360;
Data.style = (byte)DXF.HatchStyle.hsSolid; 
Data.selfType = (byte)DXF.HatchBoundaryType.hbtCircle;
vDXF.AddHatch(Data);
...

please post questions to the forum or write to support@cadsofttools.com

tanyg
Posts: 2
Joined: 17 Jul 2006, 17:09

Post by tanyg » 19 Jul 2006, 11:39

thx very much for your reply!
about the font,my mean is in DXFExport the default character font is "txt",but i want change it to "Arial",but how?
and i use the Unicode character,the code below

Data.height = 1;
string tmpText = "ExampleText"
tmpText = "{\\f" + fontName + tmpText + "}"; //font name
Data.text = tmpText;
Data.point.X = 1;
Data.point.Y = -2;
vDXF.AddText(Data);

but the result is not correct,why?thx!

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

Post by support » 19 Jul 2006, 13:38

We apologize for incorrect code. Try the following code now:

Code: Select all

Data.rotation = 0;
Data.color = DXFExport.ColorToDXF(Color.SaddleBrown);
Data.height = 1;
Data.text = "{\\fARIAL|i0|b0;TextExample}";
vDXF.AddMText(Data);
Insert it into the click-handling method of the "Make DXF directly..." button. To select a font other than ARIAL just type the font name right after \\f, for example: \\fTIMES NEW ROMAN.

Best regards,
Igor Tobolov (CADSoftTools support team)

please post questions to the forum or write to support@cadsofttools.com

Post Reply