Follow on from Stevez floorplan question
Moderators: SDS, support, admin
-
- Posts: 8
- Joined: 10 Oct 2006, 12:08
- Location: United Kingdom
Follow on from Stevez floorplan question
Hi,
Looking at the example from the 28th April, this will colour all entities on the 'www' layer - if I am interpreting it correctly.
How can you select just one of these entities? Is there an attribute for polyline, or circle etc, that can be set to a unique value, and hence, check this value when searching through all of the entities?
If not, is there a layer count limitation in dxf files, if so what is it?
...Andy
Looking at the example from the 28th April, this will colour all entities on the 'www' layer - if I am interpreting it correctly.
How can you select just one of these entities? Is there an attribute for polyline, or circle etc, that can be set to a unique value, and hence, check this value when searching through all of the entities?
If not, is there a layer count limitation in dxf files, if so what is it?
...Andy
Hello Andy,
Here goes a simple example how to get rectangles from the specified layer and to fill them with a red color:
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Is there an attribute for polyline, or circle etc, that can be set to a unique value, and hence, check this value when searching through all of the entities?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
A unique value is the layer name in the example above.
Sergey.
please post questions to the forum or write to support@cadsofttools.com
Here goes a simple example how to get rectangles from the specified layer and to fill them with a red color:
Code: Select all
<b>uses</b>
...DXFImage, DXFConv, SGImage, sgConsts;
<b>type</b>
TForm1 = <b>class</b>(TForm)
...
<b>private</b>
FImg: TsgDXFImage;
...
<b>end</b>;
<b>procedure</b> TForm1.Open1Click(Sender: TObject);
<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</b>
FImg := TsgDXFImage(sgImage1.Picture.Graphic)
<b>else</b>
FImg := <b>nil</b>;
sgImage1.Align := alClient;
<b>end</b>;
<b>procedure</b> TForm1.btnSelectAllClick(Sender: TObject);
<b>var</b>
I: Integer;
vPolyLine: TsgDXFPolyline;
vTRect: TRect;
vColor: TColor;
<b>begin
if</b> FImg = <b>nil then</b> Exit;
vColor := sgImage1.Canvas.Brush.Color;
sgImage1.Canvas.Brush.Color := clRed;
<b>for</b> I := 0 <b>to</b> FImg.Converter.Sections[csEntities].Count - 1 <b>do
begin
if</b> FImg.Converter.Sections[csEntities].Entities[I] <b>is</b> TsgDXFPolyline <b>then
begin</b>
vPolyLine := TsgDXFPolyline(FImg.Converter.Sections[csEntities].Entities[I]);
<b>if</b> (vPolyLine.Count = 4) <b>and</b> (vPolyLine.Closed = True) <b>and</b>
(vPolyLine.Layer.Name = 'WWW') <b>then
begin</b>
vTRect.TopLeft := FImg.GetPoint(vPolyLine.Points[2]);
vTRect.BottomRight := FImg.GetPoint(vPolyLine.Points[0]);
vTRect.BottomRight.X := vTRect.BottomRight.X + 1;
vTRect.TopLeft.Y := vTRect.TopLeft.Y + 1;
sgImage1.Canvas.FillRect(vTRect);
<b>end</b>;
<b>end</b>;
<b>end</b>;
sgImage1.Canvas.Brush.Color := vColor;
<b>end</b>
A unique value is the layer name in the example above.
Sergey.
please post questions to the forum or write to support@cadsofttools.com
-
- Posts: 8
- Joined: 10 Oct 2006, 12:08
- Location: United Kingdom
Sergey,
Thanks for the example.
This is why I asked the question about the layer count in a dxf file.
As you say, the unique part of the entity in this example is the layer name, so If I want to add 110 unique entities, then I would need to create an additional 110 layers.
Is there a limit for dxf files that govern the maximim number of layers I can use?
...Andy
Thanks for the example.
This is why I asked the question about the layer count in a dxf file.
As you say, the unique part of the entity in this example is the layer name, so If I want to add 110 unique entities, then I would need to create an additional 110 layers.
Is there a limit for dxf files that govern the maximim number of layers I can use?
...Andy
Hello Andy,
There are no layer count limitations in DXF files.
Sergey.
please post questions to the forum or write to support@cadsofttools.com
There are no layer count limitations in DXF files.
Sergey.
please post questions to the forum or write to support@cadsofttools.com