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