Page 1 of 1

sgcadexp.dll, the latest version Issue

Posted: 02 Nov 2020, 18:04
by Sing
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();

Re: sgcadexp.dll, the latest version Issue

Posted: 02 Nov 2020, 20:55
by support
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

Re: sgcadexp.dll, the latest version Issue

Posted: 03 Nov 2020, 16:44
by Sing
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.

Re: sgcadexp.dll, the latest version Issue

Posted: 03 Nov 2020, 21:45
by support
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

Re: sgcadexp.dll, the latest version Issue

Posted: 17 Nov 2020, 08:10
by Sing
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.