Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I am trying to convert arc to polyline

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
patilhdipak
19420 Views, 20 Replies

I am trying to convert arc to polyline

If arc have a 3d value it's should be in 3d polyline. Mapclean function only changes arc entity type as polyline. For converting arc to polyline i copied all arcs in new layer. Because I think its will not convert direct to polyline or 3d polyline.
20 REPLIES 20
Message 2 of 21
ВeekeeCZ
in reply to: patilhdipak

An ARC is 2D entity. You can have set center Z value, then the plane is elevated. I any can you can use PEDIT to convert them to LWPOLYLINE ARC.

Message 3 of 21
Kent1Cooper
in reply to: patilhdipak


@patilhdipak wrote:
If arc have a 3d value it's should be in 3d polyline. ....

3DPolylines cannot have arc segments -- only line segments.

Kent Cooper, AIA
Message 4 of 21
patilhdipak
in reply to: Kent1Cooper

yes you are right sir. but arc have a z value so i want to put in it in new polyline

Message 5 of 21
schulz8NPAP
in reply to: patilhdipak

PEDIT3D converts an arc into small straight line segments and joines these 3D-Lines into a 3DPolyline.

(download from www.ant-ares.de)

Regards

Jochen

 

Message 6 of 21
Kent1Cooper
in reply to: patilhdipak


@patilhdipak wrote:

yes you are right sir. but arc have a z value so i want to put in it in new polyline


You can use PEDIT to turn it into a LWPolyline, no matter what its Z value.  Being off the XY plane does not mean it needs to be a 3D  Polyline -- it will just have an Elevation  other than zero.  It doesn't even need to be parallel to  the XY plane.  If it's not, it will have an extrusion direction [or "normal"] other than straight up in the WCS Z direction [0,0,1], but it can still be a LWPolyline and therefore have real curvature.

Kent Cooper, AIA
Message 7 of 21
john.uhden
in reply to: patilhdipak

Just because an arc has an elevation other than zero, it does not mean that it must be treated as 3D.  In the civil discipline we deal with contours, continuous combinations of lines and arcs but all at the same elevation.  Historically these have been best represented by 2D polylines.

 

What is your purpose in converting them to 3D?  From where will the Z values come?  As someone here pointed out, you can't have a 3D arc in the WCS.  You would have to break it into multiple straight segments to create a 3D polyline that approximates the path of an arc but with differing elevations at each vertex.

Is that what you are looking for... a routine that takes an arc, a beginning and ending elevation, and converts it into a 3D poly?  Yes, we could help you with that.

John F. Uhden

Message 8 of 21
patilhdipak
in reply to: john.uhden

Yes that's the we should have to do. At the same time how much point we have to put on a arc so it's should be calculate base on radius and length. Because if arc radius and length will change in every case so sometimes it's will extra points or less points.
So that calculation I don't understand how to do.
Message 9 of 21
fkp7057
in reply to: patilhdipak

Hi

@patilhdipa  i think you can achieve by using help of ucs or 3D rotate, to covert arc to polyline you can use pedit command or you draw poly line  select it and and put your mouse courser to middle grip of polyline  one windows kind of thing will open and select convert to arc form the option.

hope this will help you to short out your problem.

 

Regards,

FKP

Message 10 of 21
john.uhden
in reply to: patilhdipak

I don't think you can calculate via radius and length.  If all you are starting with is points, the radius has to be calculated from them.  I think it was this topic where I suggested using a 3PCIRCLE function and a DANGLE function (that I would provide) to calculate the curves from the points.

Once again, from where are the Z values coming?  Are they included in the point data?

Which makes me think that maybe you just want to connect the 3D points without any curves, unless you know that a curve is present but is defined by just 3 points and you would rather have many more points to have the 3Dpoly appear to follow a smooth curve.

Ya know, I did all this many years ago to have AutoCAD draft both 2D and 3D polylines from Land Desktop survey point data.  It was called PCONNECT, which I sold to Rex Cooper [Smartdraft].  Thank goodness for him (with thanks to John Cooke) because at the time I needed money to finish a room reconstruction.  He was more eager and motivated than I anyway, so it was good to see some good code get improved by a younger mind.

John F. Uhden

Message 11 of 21
patilhdipak
in reply to: john.uhden

 if we are talking about arc to polyline, I already say that i am creating a points by divide command. So first we have to decide how much points should be on that arc so we can connect these points and convert it into polyline. I think you all know much better than me that arcs length and angle is various at every different arc. So we should have to calculate it how much points we have to place on the basis of arcs length and its angle. How to calculate it I dont know. So first I am focusing on it that how much points should be on arc. If we give the constant distance then for small length  arc its will place more points and same angle but more length its will generate too less points. it will change the full geometry.

 

Message 12 of 21
patilhdipak
in reply to: john.uhden

This is an attachement where we have to give z value. I dont know it is possible or not but just for query I am talking on this fourum.

Message 13 of 21
Kent1Cooper
in reply to: patilhdipak

Something is wrong with the posted image -- it says both Arcs are of the same radius [which has no 'o' in it], but clearly they are not.

 

I think something could be worked out, BUT explain more about why it needs to be converted to a 3D  Polyline made up of line  segments.  It can be converted into a LWPolyline very easily and quickly with just a simple native AutoCAD command, and  still be in one segment instead of many, and  still have true curvature, and  if it doesn't lie in the WCS XY plane, retain its non-zero elevation and/or different extrusion direction -- what is wrong with doing it that way?

Kent Cooper, AIA
Message 14 of 21
john.uhden
in reply to: patilhdipak

I guess you lost me somewhere. If you are using the DIVIDE command to
place points along the path of an arc, then you already have the arc, which
means you don't need any points. If you turn on PEDITACCEPT, you can use
the PEDIT command on the arc and it will convert it into a polyline without
any further input.

John F. Uhden

Message 15 of 21
john.uhden
in reply to: patilhdipak

My apologies.  I forgot about the Z values, meaning you want to create a 3D poly.

The simplest answer is to graduate the elevations from the line where the arc starts to the other line where the arc ends.  The number of points you use would depend on a variable for "degree of definition."  The higher the value, the greater number of points.

Whether the two straight segments were 3D lines or 3D polylines, would you want the arced segments to be joined to both, creating one 3D polyline?

It almost seems like you are wanting a 3D Fillet command, which was included in Softdesk and Land Desktop and perhaps in Civil 3D.

John F. Uhden

Message 16 of 21
Kent1Cooper
in reply to: patilhdipak


@patilhdipak wrote:

This is an attachement where we have to give z value. ....


I still don't understand why it needs to be a 3D Polyline.  In new-enough versions, you can just JOIN them all together.  The arc part will retain is true curvature.  The overall joined object will be a Spline, but the Line parts will still be straight.

 

But if there is some legitimate reason for breaking up the Arc into line segments, you can use WobblyPline.lsp, with its WPL command, available >here<.  You need to use it in a particular way, "unrandomized" as described, thus:

 

Command: WPL

Path type [new Line(single)/Arc/Circle/Pline(2D)/3dpoly/Spline/Ellipse, or EXisting] <Pline>: EX

Retain or Delete base path [R/D] <D>: {your choice -- I accepted the default with Enter}

To make an EXisting path wobbly,
Select objects: {select the Arc}

Number of segments: 12 {any number you want to try first}

Maximum displacement as percentage of average segment length: 0 {<---this is critical}

 

That makes a Polyline of line segments along the Arc.  With zero randomization, the vertices will be equally spaced and exactly on it.  If you don't like the result, and want more or fewer segments, just recall the command and use the PRevious option to have it do it over to the same path object, but with a different number, without your having to select the Arc or specify the zero randomization again:

 

Command: WPL

Path type [new Line(single)/Arc/Circle/Pline(2D)/3dpoly/Spline/Ellipse, or EXisting/PRevious/Redo] <EXisting>: PR

Retain or Delete base path [R/D] <D>: {Enter to accept default of choice from before}

Number of segments <12>: 24 {give it a different number}

Maximum displacement as percentage of average segment length <0.00>: {Enter to accept default}

 

[Don't use the Redo option -- that's for when you do  use randomization, and it just takes another shot at it with all your previous choices, for a differently-randomized result.]

 

That makes a LW Polyline, but it follows the Arc's path in whatever 3D orientation it lies in, no matter what your current UCS or view.  If you really always need it to be a 3D Polyline for some reason that has not been explained, change this one line in the code:

 

    (if 3Dpath "_.3dpoly" "_.pline"); command type - Pline for all but 3D Polylines

 

to just this:

 

    "_.3dpoly"

 

Or, don't change the code, let it make a LWPolyline, and JOIN that to your Lines, which because they're not co-planar will result in a 3DPolyline anyway.

Kent Cooper, AIA
Message 17 of 21
patilhdipak
in reply to: patilhdipak

on this case where is arc and both side have 3d polyline and when i converted the arc to polyline what should be the z value will calculate on that newly created object (polyline). I think we can get these z value of the vertex depend on distance. the z value may be calculate from the vertex distance divide by overall distance.

Message 18 of 21
john.uhden
in reply to: patilhdipak

I have to come back to the 3DFILLET command (only in Land Desktop but maybe in Civil 3D).  If you had to draw the arc, then why not just fillet the two straights.  It's not easy coding, but can obviously be done.  Perhaps a little clunkier in AutoLisp than ARX, but still probably doable.  Sadly, I would do it but these days I don't have much time to play (as I am constantly reminded by a spouse I have.  No, just one).

But the other guys and gals here can do it probably better than myself.  Let's see who volunteers.

@Kent1Cooper likes to use the command function, but in this case he may have to do some calculations, God forbid.

John F. Uhden

Message 19 of 21
Kent1Cooper
in reply to: patilhdipak


@patilhdipak wrote:

on this case where is arc and both side have 3d polyline ….


If I understand correctly, WPL will do what you want.  Apply it to the Arc [it will be at be in the same elevation and orientation], and then JOIN the new segmented Polyline to the 3D Polylines on both sides.

Kent Cooper, AIA
Message 20 of 21

try this lisp 

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

Post to forums  

Autodesk Design & Make Report

”Boost