How to change ATTDEF
Moderators: SDS, support, admin
How to change ATTDEF
Hi,
I hope to change ATTDEF with following code.
AEnt: TsgDXFEntity;
ADef: TsgDXFAttdef;
.....
if (AEnt is TsgDXFAttdef)
begin
ADef := AEnt as TsgDXFAttdef;
ShowMessage(ADef.Tag + ':' + ADef.Text);
ADef.Text := 'hello attdef';
//ADef.Tag := 'hello attdef';
//Adef.Visible := FALSE;
EntList.Loads(ADef);
end
.....
From the message box, I knows that ADef was changed. But whatever I refresh the image, ADef is still showing its initial text (or tag )
Why the Visible property doesn't work? How can I change ATTDEF? Please give me a example.
Thank you in advance.
Thought that I found a powerfull CAD tool, keep on testing.....
I hope to change ATTDEF with following code.
AEnt: TsgDXFEntity;
ADef: TsgDXFAttdef;
.....
if (AEnt is TsgDXFAttdef)
begin
ADef := AEnt as TsgDXFAttdef;
ShowMessage(ADef.Tag + ':' + ADef.Text);
ADef.Text := 'hello attdef';
//ADef.Tag := 'hello attdef';
//Adef.Visible := FALSE;
EntList.Loads(ADef);
end
.....
From the message box, I knows that ADef was changed. But whatever I refresh the image, ADef is still showing its initial text (or tag )
Why the Visible property doesn't work? How can I change ATTDEF? Please give me a example.
Thank you in advance.
Thought that I found a powerfull CAD tool, keep on testing.....
Hello!
<br />Thank you for the useful remark.
This bug has been solved. Corrected (beta) version of CADImportVCL is available on: http://www.cadsofttools.com/download/CA ... _08_06.zip
<br />Please try is with the following code:
Sergey.
please post questions to the forum or write to support@cadsofttools.com
<br />Thank you for the useful remark.
This bug has been solved. Corrected (beta) version of CADImportVCL is available on: http://www.cadsofttools.com/download/CA ... _08_06.zip
<br />Please try is with the following code:
Code: Select all
<b>procedure</b> TMyApp.Forum_313_ButtonClick(Sender: TObject);
<b>var</b>
I: Integer;
vImg: TsgDXFImage;
vAttDef: TsgDXFAttdef;
vInvRect: TRect;
S: <b>string</b>;
<b>begin
if not</b> OpenDialog1.Execute <b>then</b>
Exit;
sgImage1.LoadFromFile(OpenDialog1.FileName);
<b>if</b> sgImage1.Picture.Graphic <b>is</b> TsgDXFImage <b>then
begin</b>
sgImage1.Align := alClient;
Img := TsgDXFImage(sgImage1.Picture.Graphic);
<b>end
else
begin</b>
Img := <b>nil</b>;
Exit;
<b>end</b>;
<b>for</b> I := 0 <b>to</b> Img.Converter.Sections[csEntities].Count - 1 <b>do
begin
if</b> Img.Converter.Sections[csEntities].Entities[I] <b>is</b> TsgDXFAttdef <b>then
begin</b>
vAttDef := TsgDXFAttdef(Img.Converter.Sections[csEntities].Entities[I]);
S := S + 'TsgDXFAttdef.Text = ' + vAttDef.Text + #13#10;
S := S + 'TsgDXFAttdef.Tag = ' + vAttDef.Tag + #13#10;
<b>end</b>;
<b>end</b>;
<b>if</b> vAttDef = <b>nil then</b>
Exit;
ShowMessage(S);
vAttDef.Text := 'hello attdef';
vAttDef.Tag := 'hello attdef';
S := S + 'TsgDXFAttdef.Text = ' + vAttDef.Text + #13#10;
S := S + 'TsgDXFAttdef.Tag = ' + vAttDef.Tag + #13#10;
Img.Converter.Loads(vAttDef);
ShowMessage(S);
vInvRect := sgImage1.PictureRect;
InvalidateRect(sgImage1.Parent.Handle, @vInvRect, False);
<b>end</b>;
please post questions to the forum or write to support@cadsofttools.com
Hi,
Property <b>Visible</b> works for <b>TsgDXFLayer</b> only. This is made for compatibility with old versions of the library. To set visibility of the <b>ATTDEF</b> entity use property <b>TsgDXFAttdef.Visibility</b>.
Sergey.
please post questions to the forum or write to support@cadsofttools.com
Property <b>Visible</b> works for <b>TsgDXFLayer</b> only. This is made for compatibility with old versions of the library. To set visibility of the <b>ATTDEF</b> entity use property <b>TsgDXFAttdef.Visibility</b>.
Sergey.
please post questions to the forum or write to support@cadsofttools.com