sgcadexp.dll, the latest version Issue

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Sing
Posts: 48
Joined: 12 Apr 2020, 17:39

sgcadexp.dll, the latest version Issue

Post by Sing » 02 Nov 2020, 18:04

Hello

I recently downloaded and used the latest version of sgcadexp.dll, and found a bug where CADText was displayed in the wrong location.

I tried to attach a test file, but could not attach due to the capacity limit.
Instead, I leave a Google Drive link so you can download it.
https://drive.google.com/drive/folders/ ... sp=sharing

------------------------------------------------------------------------
.Net Framework: 4.6.1
CADImport.dll: v14.1.0.45509
sgcadexp.dll(64bit): modified date is 2020-04-29. <==== Problem Version
sgcadexp.dll(64bit): modified date is 2020-01-31.
------------------------------------

Thank you

Code: Select all

string tmpDWGFile = "temp.dwg";
CADImage cadImage = CADImage.CreateImageByExtension(tmpDWGFile);
cadImage.LoadFromFile(tmpDWGFile);

CADImport.CADText text1 = new CADImport.CADText();
text1.HAlign = 1; // center
text1.VAlign = 1; // bottom
text1.Point1 = new DPoint(5600, -5600, 0);
text1.Height = 200;
text1.Text = string.Format("{0}", "(5600, -5600)");
text1.Color = Color.White;
text1.Layer = cadImage.Converter.LayerByName("0");
cadImage.Converter.Loads(text1);
cadImage.Layouts[0].AddEntity(text1);

CADImport.Export.CADtoDWG.SaveAsDWG(cadImage, "output")

if (cadImage != null)
{
	cadImage.ClearBuffer();
	cadImage.Dispose();
	cadImage = null;
}

GC.Collect();
Attachments
used_sgcadexp_dll_2020_4_29.PNG
used_sgcadexp_dll_2020_4_29.PNG (16.95 KiB) Viewed 3198 times

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

Re: sgcadexp.dll, the latest version Issue

Post by support » 02 Nov 2020, 20:55

Hello,

Thank you for the files.

The problem is in your code: you are using the property CADText.Point1 which sets the second alignment point for the CADText object, while the text insertion point is specified through a CADText.Point property:

Code: Select all

text1.Point = new DPoint(5600, -5600, 0);
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Sing
Posts: 48
Joined: 12 Apr 2020, 17:39

Re: sgcadexp.dll, the latest version Issue

Post by Sing » 03 Nov 2020, 16:44

Hello Mikhail

That's right. I need the second alignment point, so I used Point1 property.

Code: Select all

text1.HAlign = 1; // center
text1.VAlign = 1; // bottom
Do you mean that I should set the Point property and insert the text entity, and then change the Point1 property of the text entity?

However, the old version of sgcadexp.dll is working, but why does not the latest one?

Thank you.

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

Re: sgcadexp.dll, the latest version Issue

Post by support » 03 Nov 2020, 21:45

Hello,

I meant if you need to insert a text at the point (5600, -5600, 0), you should set the Point property, otherwise, the text will be inserted at the point (0, 0, 0). I don't know why you need the second alignment point.

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

Sing
Posts: 48
Joined: 12 Apr 2020, 17:39

Re: sgcadexp.dll, the latest version Issue

Post by Sing » 17 Nov 2020, 08:10

Hello

This is to use the alignment as I already mentioned.
You mean that the alignment (cadText.HAlign and cadText.VAlign) works on cadText.Point property instead of cadText.Point1.

However, this linked page says that I have to use Point1 instead of Point property.
http://www.cadsofttools.com/forum/viewt ... lign#p5500

I haven't checked if Point works for the alignment.
I hope that the Point works for it.

Anyway, thank you for your reply.

Post Reply