How to write Polygon with DXFLIB ?
Moderator: andrew
How to write Polygon with DXFLIB ?
Hello,
Can you help me please.
I'm trying to create polygon with dxflib.
But unfortunately it does not work: (
Maybe you have an outtake from the Sourse code?
Can you help me please.
I'm trying to create polygon with dxflib.
But unfortunately it does not work: (
Maybe you have an outtake from the Sourse code?
I assume you mean to write a polyline entity to a DXF file:
Code: Select all
DL_Dxf dxf;
...
dxf.writePolyline(
<DL_WriterA instance>,
DL_PolylineData(
<number of segments>,
0, 0,
<true for closed polyline, false for open polylines>
),
<DL_Attributes instance>
);
// for every vertex in the polyline:
dxf.writeVertex(
<DL_WriterA instance>,
DL_VertexData(
<vertex position X>, <vertex position Y>, <vertex position Z>,
<vertex bulge, always 0.0 for straight segments>
)
);
dxf.writePolylineEnd(<DL_WriterA instance>);
Thank you!
It works very well. Only now I have another question. How I write a polyline in the polyline entity to a DXF file? I have tried it with Exterior Rings and Internal Rings. But unfortunately when I click on the Exterion area, the Internal polyline was marked to.
It works very well. Only now I have another question. How I write a polyline in the polyline entity to a DXF file? I have tried it with Exterior Rings and Internal Rings. But unfortunately when I click on the Exterion area, the Internal polyline was marked to.
andrew wrote:I assume you mean to write a polyline entity to a DXF file:
Code: Select all
DL_Dxf dxf; ... dxf.writePolyline( <DL_WriterA instance>, DL_PolylineData( <number of segments>, 0, 0, <true for closed polyline, false for open polylines> ), <DL_Attributes instance> ); // for every vertex in the polyline: dxf.writeVertex( <DL_WriterA instance>, DL_VertexData( <vertex position X>, <vertex position Y>, <vertex position Z>, <vertex bulge, always 0.0 for straight segments> ) ); dxf.writePolylineEnd(<DL_WriterA instance>);
andrew wrote:A polyline is an entity that consists of a sequence of lines (and sometimes arcs).
Since a polyline is not a shape or surface, it cannot have a "hole" or "island" by definition.
Hatches and solid fills can have holes or islands.
I have tried with solid already. That problem is, Solid has only four corners. If i have five corners I can no use it.
Or is it wrong?
There are "solid" entities (3-4 corners) and solid hatches (HATCH entity with solid fill, any number of corners, islands, etc.).
If you tell me what you are trying to achieve, I will be able to help much more efficiently, thanks.
Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.
If you tell me what you are trying to achieve, I will be able to help much more efficiently, thanks.
Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.
[quote="andrew"]There are "solid" entities (3-4 corners) and solid hatches (HATCH entity with solid fill, any number of corners, islands, etc.).
If you tell me what you are trying to achieve, I will be able to help much more efficiently, thanks.
Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.[/quote]
I want to write a polygon with five corners and in this polygon will be an island.
Can you show me a code example?
If you tell me what you are trying to achieve, I will be able to help much more efficiently, thanks.
Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.[/quote]
I want to write a polygon with five corners and in this polygon will be an island.
Can you show me a code example?
[quote="andrew"]Does the result have to be one entity (selected as one entity) or two separate entities?
Does the result have to be a filled surface or two outlines only?
Please note: Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.[/quote]
The result have to be a filled surface with two serarate entities.
Does the result have to be a filled surface or two outlines only?
Please note: Please untick "Disable BBCode in this post" when posting to this forum if you are quoting.[/quote]
The result have to be a filled surface with two serarate entities.
Unfortunately, that is not possible. In DXF, you can store either one entity (a hatch with an island) or two entities (two polygons, no filling).Davidow wrote:The result have to be a filled surface with two serarate entities.
Please untick "Disable BBCode in this post" when posting to this forum if you are quoting, thank you.
Please refer to this thread:
http://www.ribbonsoft.com/rsforum/viewtopic.php?t=823
http://www.ribbonsoft.com/rsforum/viewtopic.php?t=823