How to shift a layer's co-ordinate
Moderators: SDS, support, admin
How to shift a layer's co-ordinate
Hi there,
In a DXF file I have no. of layers. I want to change the Z-coordinate of a particular layer, so when the DXF map is viewed in an isometric view, one should be able to see the vertical distance between two layers changed. What I have to do to achieve this? I tried enumerating the entities in a layer and change their Z coordinate using Point property, but it did not work. I tried finding out TsgDXFInsert objects on a layer and change their Z coordinate. Am I doing it correct? Please help.
Regards,
Avinash
In a DXF file I have no. of layers. I want to change the Z-coordinate of a particular layer, so when the DXF map is viewed in an isometric view, one should be able to see the vertical distance between two layers changed. What I have to do to achieve this? I tried enumerating the entities in a layer and change their Z coordinate using Point property, but it did not work. I tried finding out TsgDXFInsert objects on a layer and change their Z coordinate. Am I doing it correct? Please help.
Regards,
Avinash
Hello, Avinash.
Layer itself has no Z coordinate. It is necessary to change Z coordinate of every point in the entities.
The following example is based on Viewer demo of the CAD Import VCL package (available at: http://www.cadsofttools.com/download/cadimportvcl.zip). It moves all lines on the <b>'Lines'</b> layer up to Z = 150.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Layer itself has no Z coordinate. It is necessary to change Z coordinate of every point in the entities.
The following example is based on Viewer demo of the CAD Import VCL package (available at: http://www.cadsofttools.com/download/cadimportvcl.zip). It moves all lines on the <b>'Lines'</b> layer up to Z = 150.
Code: Select all
<b>procedure</b> TForm1.btnMoveZClick(Sender: TObject);
<b>var</b>
vImg: TsgDXFImage;
I: Integer;
vLine: TsgDXFLine;
vPoint: TFPoint;
<b>begin
if</b> sgPaintBox.Picture.Graphic <b>is</b> TsgDXFImage <b>then</b>
vImg := TsgDXFImage(sgPaintBox.Picture.Graphic)
<b>else</b>
Exit;
<b>for</b> I := <font color="blue">0</font id="blue"> <b>to</b> vImg.Converter.Counts[csEntities] - 1 <b>do
begin
if</b> vImg.Converter.Sections[csEntities].Entities[I] <b>is</b> TsgDXFLine <b>then
begin</b>
vLine := TsgDXFLine(vImg.Converter.Sections[csEntities].Entities[I]);
<b>if</b> vLine.Layer.Name = <font color="blue">'Lines'</font id="blue"> <b>then
begin</b>
vPoint := vLine.Point;
vPoint.Z := <font color="blue">150</font id="blue">;
vLine.Point := vPoint;
vPoint := vLine.Point1;
vPoint.Z := <font color="blue">150</font id="blue">;
vLine.Point1 := vPoint;
vImg.Converter.Loads(vLine);
<b>end</b>;
<b>end</b>;
<b>end</b>;
sgPaintBox.Invalidate;
<b>end</b>;
Please post questions to the forum or write to support@cadsofttools.com