ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can i convert a region to a polyline?

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
514 Views, 5 Replies

how can i convert a region to a polyline?

whitch command convert a region to a polyline?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
nicel3
ondraw@hotmail.com
---------------------------
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

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
> ---------------------------
>
>
Message 3 of 6
Anonymous
in reply to: Anonymous

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
> > ---------------------------
> >
> >
>
>
Message 4 of 6
jignesh.rana
in reply to: Anonymous

can any one share the code of this logic ?

Message 5 of 6
wispoxy
in reply to: Anonymous

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.

Message 6 of 6
tbrammer
in reply to: Anonymous

See this topic.


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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost