How to add fonts to cadImage library, I have tried, but can not search fonts
Moderators: SDS, support, admin
-
- Posts: 1
- Joined: 03 Feb 2023, 09:05
How to add fonts to cadImage library, I have tried, but can not search fonts
I added the shx path with the following code, but the number of fonts searched was 0; I don't know what went wrong. I hope you can help me. Thank you very much.
SearchedFonts = Count = 0
SearchedFonts = Count = 0
Code: Select all
CADImage cAD = CADImage.CreateImageByExtension(@"d:\123.dwg");
cAD.LoadFromFile(@"d:\123.dwg");
var shxFonts = cAD.Converter.SHXSettings;
string shxPath = Path.GetFullPath(@".\shx");
var shxFonts1 = cAD.Converter.SHXFonts;
shxFonts1.SearchPath.Clear();
shxFonts1.SearchPath.Add(shxPath);
cAD.SearchSHXPaths = true;
cAD.SHXSearchPaths = shxPath;
cAD.UseSHXFonts = true;
var shxFonts2 = cAD.Converter.SHXFonts;
foreach (var item in cAD.Converter.Entities)
{
if (item is CADShape shape)
{
// shape.ShapeName = "742";
}
}
CADtoDWG.SaveAsDWG(cAD, @"d:\999.dwg");
CADExport expObject = new CADtoDXF(cAD);
expObject.SaveToFile("d:\\666.dxf");
Re: How to add fonts to cadImage library, I have tried, but can not search fonts
Hello,15069127176 wrote: ↑03 Feb 2023, 10:24I added the shx path with the following code, but the number of fonts searched was 0; I don't know what went wrong. I hope you can help me. Thank you very much.
SearchedFonts = Count = 0
Code: Select all
CADImage cAD = CADImage.CreateImageByExtension(@"d:\123.dwg"); cAD.LoadFromFile(@"d:\123.dwg"); var shxFonts = cAD.Converter.SHXSettings; string shxPath = Path.GetFullPath(@".\shx"); var shxFonts1 = cAD.Converter.SHXFonts; shxFonts1.SearchPath.Clear(); shxFonts1.SearchPath.Add(shxPath); cAD.SearchSHXPaths = true; cAD.SHXSearchPaths = shxPath; cAD.UseSHXFonts = true; var shxFonts2 = cAD.Converter.SHXFonts; foreach (var item in cAD.Converter.Entities) { if (item is CADShape shape) { // shape.ShapeName = "742"; } } CADtoDWG.SaveAsDWG(cAD, @"d:\999.dwg"); CADExport expObject = new CADtoDXF(cAD); expObject.SaveToFile("d:\\666.dxf");
Please, have a look at the code example below:
Code: Select all
private void menuItem14_Click(object sender, EventArgs e)
{
CADImage cAD = CADImage.CreateImageByExtension(@"d:\123.dwg");
cAD.LoadFromFile(@"d:\123.dwg");
string SHXPath = @"D:\SHX\Fonts\SHX";//for example
CADConst.SHXSearchPaths += SHXPath;//adds a path, where shx fonts are located
string savePath = @"d:\test123SHAPE.dxf";
CADtoDXF vExp = new CADtoDXF(cAD);
vExp.SaveToFile(savePath);
}
Catherine.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
-
- Posts: 3
- Joined: 09 Mar 2023, 12:41
Re: How to add fonts to cadImage library, I have tried, but can not search fonts
Thanks for helping me out as well, if I face any more problem, I will message here.
Last edited by MichealStanton on 30 Mar 2023, 16:18, edited 1 time in total.