Page 1 of 1

Installation of coordinates TsgDXFInsert

Posted: 07 Jun 2006, 13:17
by Yura
I do so:

Code: Select all

vInsert:TsgDXFInsert;
...
vInsert.Point:=MakeFPoint(0, 0, 0); // Passes
vInsert.Block.Offset:=MakeFPoint(0, 0, 0); //Passes
vInsert.Block.Entities[0].Box.TopLeft:=MakeFPoint(1, 2, 0); // Not pass, writes:
[Error] MainUnit.pas(192): Left side cannot be assigned to
How to install last coordinate?

Posted: 07 Jun 2006, 14:18
by support
Hello Yura,

Property <b>TsgDXFEntity.Box: TFRect;</b> is read only. That is why you get error when compiling. This property determines a 3d box which embraces the entity.

The following code sets coordinates of the second point.

Code: Select all

  <b>if</b>  vInsert.Block.Entities[0] <b>is</b> TsgDXFLine <b>then
  begin</b>
    TsgDXFLine(vInsert.Block.Entities[0]).Point1 := MakeFPoint(1, 2, 0); 
    ... 
  <b>end</b>;
Sergey.

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

Posted: 07 Jun 2006, 14:52
by Yura
I so have understood, what for moving TsgDXFInsert it is enough to make so?

Code: Select all

Img: TsgDXFImage;
vInsert:TsgDXFInsert;
...
vInsert.Point:=MakeFPoint(0, 0, 0);
vInsert.Block.Offset:=MakeFPoint(1, 2, 0);
Img.Converter.Loads(vInsert);
Or not?

Posted: 07 Jun 2006, 15:22
by support
Hello again,

<b>TsgDXFInsert.Point</b> - defines coordinates of Insert itself.
<b>TsgDXFInsert.Block.Offset</b> - defines offset of block (inside of insert) respectively to <b>TsgDXFInsert.Point</b>.
The following code demonstrates Insert moving:

Code: Select all

<b>var</b>
  FP: TFPoint;
<b>begin</b>
  FP := vInsert.Point;
  FP.X := FP.X + 100;
  FP.Y := FP.Y + 150;
  vInsert.Point := FP;
  TsgDXFImage(sgImage1.Picture.Graphic).Converter.Loads(vInsert);
  TsgDXFImage(sgImage1.Picture.Graphic).GetExtents;
  ...
<b>end</b>;
It is important to use <b>GetExtents</b> because of coordinates of insert may get out of drawing extensions.

Sergey.

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

Posted: 07 Jun 2006, 16:36
by Yura
Thanks! All has turned out