how can i convert a region to a polyline?

how can i convert a region to a polyline?

Anonymous
Not applicable
862 Views
5 Replies
Message 1 of 6

how can i convert a region to a polyline?

Anonymous
Not applicable
whitch command convert a region to a polyline?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
nicel3
ondraw@hotmail.com
---------------------------
0 Likes
Accepted solutions (1)
863 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
You will have to open the AcDbRegion, explode it. Then use the
AcDbVoidPtrArray returned. Note that the original Region will not be
exploded as AutoCAD-explode, but you will get all the entities that autocad
would have created in the array. You will have to erase the region your self
if thats what you want to do.

Now to the fun part!
The array may include Lines, Arcs and/or Splines. So you have to create your
polyline from this array all by your self.




"Glad niceguyl3" wrote in message
news:D4A126D590099675B5FB4573B3088793@in.WebX.maYIadrTaRb...
> whitch command convert a region to a polyline?
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> nicel3
> ondraw@hotmail.com
> ---------------------------
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
thank you very much, 🙂

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
nicel3
ondraw@hotmail.com
---------------------------
"zatopek" wrote in message
news:E23018745BF9A5F40B7BB027CADC4334@in.WebX.maYIadrTaRb...
> You will have to open the AcDbRegion, explode it. Then use the
> AcDbVoidPtrArray returned. Note that the original Region will not be
> exploded as AutoCAD-explode, but you will get all the entities that
autocad
> would have created in the array. You will have to erase the region your
self
> if thats what you want to do.
>
> Now to the fun part!
> The array may include Lines, Arcs and/or Splines. So you have to create
your
> polyline from this array all by your self.
>
>
>
>
> "Glad niceguyl3" wrote in message
> news:D4A126D590099675B5FB4573B3088793@in.WebX.maYIadrTaRb...
> > whitch command convert a region to a polyline?
> >
> > --
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > nicel3
> > ondraw@hotmail.com
> > ---------------------------
> >
> >
>
>
0 Likes
Message 4 of 6

jignesh.rana
Advocate
Advocate

can any one share the code of this logic ?

0 Likes
Message 5 of 6

wispoxy
Advisor
Advisor

To convert a region to a polyline in AutoCAD using ObjectARX, you would typically follow these steps:

  1. Open the AcDbRegion object.
  2. Explode the region to get the constituent curves.
  3. Use the AcDbVoidPtrArray returned by the explode operation.
  4. Create a new polyline and add the exploded curves to it.
  5. Erase the original region if necessary.

Here’s a simplified code snippet that outlines the process:

 

// Assume pRegion is a pointer to your AcDbRegion object
AcDbVoidPtrArray curveSegments;
pRegion->explode(curveSegments); // Explode the region into constituent curves

// Create a new polyline
AcDbPolyline* pPolyline = new AcDbPolyline();

// Iterate through the curve segments and add them to the polyline
for (int i = 0; i < curveSegments.length(); ++i) {
    AcDbEntity* pEntity = static_cast<AcDbEntity*>(curveSegments[i]);
    // Check if the entity is a line, arc, or spline and add it to the polyline
    // You may need to convert arcs and splines to polyline segments
}

// Add the polyline to the drawing and erase the original region if needed

 

Remember to handle memory management appropriately when working with pointers and arrays in ObjectARX.

0 Likes
Message 6 of 6

tbrammer
Advisor
Advisor
Accepted solution

See this topic.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes