Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 1 of 6 (644 Views)

Arcview line segments back to Autocad arc

644 Views, 5 Replies
04-19-2012 03:14 PM

When importing Shape files from Arcview/ArMap to Autocad you will find that all yor arcs were converted to the series of lines.

Now the question is how to convert them back to the true arc.

 

I wrote some lisp to address it, but you have to do a lot af manual work before use it and it is sooooow

The lisp is inside of the cad file, just copy/paste to command line.

I will stuck after about 5 min, just kill it Ctrl+Breack or Esc.

 

is anybody has a better solution, cause mine is not solution at all. If I'll start to improve it and analyse dipper it'll get even slower.

*Expert Elite*
Kent1Cooper
Posts: 5,382
Registered: ‎09-13-2004
Message 2 of 6 (622 Views)

Re: Arcview line segments back to Autocad arc

04-20-2012 05:24 AM in reply to: MetroVancouverDrafting

Caddhelp wrote:

When importing Shape files from Arcview/ArMap to Autocad you will find that all yor arcs were converted to the series of lines.

Now the question is how to convert them back to the true arc.

....


Maybe you can use elements of PolygonToCircle.lsp attached to message 20 [if you have them chronologically] here:

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Circle-to-Polyline-circular-Polyline-...

 

It's built to convert regular Polygons to Circles, so it contains some things that you won't want [it works only with closed Polylines, and checks that all segments are the same length, which your little Lines are not quite].

 

But here's what you probably can use:  it calculates the center of the Circle, using qualities of two Polyline segments that shouldn't be hard to convert to qualities of two Lines.  I think you would need to select two lines on the same arc path that you want.  Then something could be made to go through a selection set of all Lines, keep only those Lines with both endpoints the same distance from that calculated center [that part is in there, but using Polyline vertices], and it would be pretty easy to make the Arc that follows those, and erase the Lines.

 

That assumes that the endpoints of the little Lines are on the arc path that it was converted from, within whatever fuzz factor is appropriate.

Kent Cooper
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 3 of 6 (611 Views)

Re: Arcview line segments back to Autocad arc

04-20-2012 11:03 AM in reply to: Kent1Cooper

The method to find the center will not work, the segments hvae different(random) angle and you are rigth, there will be a fuzz. Other idea could be that all lines in the arc are ENTNEXT and check each time the angle?

*Expert Elite*
Kent1Cooper
Posts: 5,382
Registered: ‎09-13-2004
Message 4 of 6 (606 Views)

Re: Arcview line segments back to Autocad arc

04-20-2012 12:44 PM in reply to: MetroVancouverDrafting

Caddhelp wrote:

The method to find the center will not work, the segments hvae different(random) angle and you are rigth, there will be a fuzz. Other idea could be that all lines in the arc are ENTNEXT and check each time the angle?


If the endpoints of the Lines are actually and accurately on the desired Arc path, then it doesn't matter that their angles [and lengths] vary.  The routine [when converted from working on Polyline segments to working on Lines] would find the intersection of the perpendicular bisectors of two of the Lines.  Oh-- no, wait, that one doesn't -- see the attached routine: TriangleCenters.lsp, with its TCI command for finding the Circumcenter of a Triangle.  If all Lines are chords, that intersection will be the center of the desired Arc.  The fuzz factor would be in testing for all Lines with both endspoints the same distance from there, and ignoring other Lines.  I think User selection of two Lines would be necessary -- I don't know how a routine could find two Lines applicable to the same Arc, out of a selection set of all Lines in the drawing.

 

Whether the (entnext) approach would work would depend on whether the conversion makes all the Lines coming from one Arc into sequential entities in the drawing file.  If there are never any short-enough Lines touching end-to-end that are not part of one of the desired Arcs (but that seems like a not-very-reliable assumption), I guess a routine could find the starting one for every Arc, and "chain" along subsequent Lines with shared endpoints.

Kent Cooper
Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 5 of 6 (597 Views)

Re: Arcview line segments back to Autocad arc

04-20-2012 01:04 PM in reply to: Kent1Cooper

 

I will try to use the combination of the ENTNEXT (since the lines in arc are consecutive) and then use your method to check if they belong to the same arc. Then get StartPoint of the first segment, EndPoint of the last point and any point in the middle to build the arc. I just afraid it would work very slow.

 

 

I know, this program was badly needed by autocad users who use shape files for many many years. I thought, collectively,we can build something like that. I’m not a programmer, though in the past 20 years I wrote thousands of Lisp, VB and C programs for Autocad and Access. Maybe someone more knowledgeable could step in and solve this problem once for all?

 


Thanks to ALL.

 

Valued Contributor
MetroVancouverDrafting
Posts: 66
Registered: ‎06-29-2010
Message 6 of 6 (558 Views)

Re: Arcview line segments back to Autocad arc

04-24-2012 10:15 AM in reply to: MetroVancouverDrafting

Ok, the use of both metods did work somehow.

 

I tested it on 2.6Mb file, the lisp created 738 arcs and analysed 53475 lines in about 1 minute, not bad.

The proccess involves Acad Map cleaning and then exploding of polylines.

 

Thanks Kent1Cooper for ideas.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.