A method of converting region to polyline

Source: Internet
Author: User
Tags polyline

In Autocad.net Two development, there are several ways to convert a polygon to polyline:

1. Use explode to explode the area into line and arc, and then string it up, this method can be used for all versions of AutoCAD2007 start.

Reference: http://through-the-interface.typepad.com/through_the_interface/2008/08/creating-a-seri.html

2. Try to get a point within the region, recreate the boundary using the CAD Bo command, and listen for the command end event to get the last generated entity.

3, developed with C # and Lisp, use Bpoly to create boundaries in Lisp.

4. Use the Editor.tracboundary method in the Autocad.net interface to obtain a new boundary, but this method starts with the AutoCAD2011.

5, using BREP and edge to obtain the region sub-entity, these interfaces from the beginning of AutoCAD2009 to add in,

Use Brep to get each side of the region, then turn those edges into arcs and segment objects, and then concatenate them, with the sample code as follows:

Reference Acdbmgdbrep.dll

Promptentityresult per = ed. GetEntity ("\ n Please select"); if(per. Status = =Promptstatus.ok) {using(Documentlock dlk =Doc. LockDocument ()) {using(Transaction trans =db. Transactionmanager.starttransaction ()) {Entity ent=(Entity) trans. GetObject (per.                        ObjectId, Openmode.forwrite); if(! (ENT isRegion )) return; Region Reg=(region) ENT; Brep Brep=NewBrep (REG); Brepedgecollection Bec=Brep.                        Edges; if(Bec! =NULL)                        {                            foreach(Edge EdgeinchBec) {Curve3d cv3d=Edge.                                Curve; Externalcurve3d ecv3d=(Externalcurve3d) cv3d; if(ecv3d. ISCIRCULARARC) {circulararc3d ca3d= Ecv3d. Nativecurve ascirculararc3d; Ed. Writemessage ("\ n Arc"); }                                Else if(ecv3d. Isline) {ed. Writemessage ("\ n Line"); }                                Else if(ecv3d. islinesegment) {Linesegment3d ls3d= Ecv3d. Nativecurve asLinesegment3d; Ed. Writemessage ("\ n Line Segments"); }                                Else if(ecv3d. Isnativecurve) {ed. Writemessage ("\ n Original Curve"); }                                Else if(ecv3d. Isnurbcurve) {ed. Writemessage ("\ n Spline curve"); }                                Else{ed. Writemessage ("\ n"+ecv3d.                                Externalcurvekind); } ed. Writemessage ("\ n starting point:"+ cv3d. Startpoint.tostring () +"-end point:"+cv3d.                            Endpoint.tostring ()); }                        }                    }                }            }

A method of converting region to polyline

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.