Arc Lisp help

Arc Lisp help

lecheverriaK6J4P
Participant Participant
2,719 Views
17 Replies
Message 1 of 18

Arc Lisp help

lecheverriaK6J4P
Participant
Participant

first post on the forums. I used to work at a utility department creating permit drawings (water, sewer, gas etc...)

We used to have this neat LISP by typing in BD it would give us the options to draw a line using bearing and distance, It ALSO gave us the option to create curves using radius and length. My question is does somebody have something like this? i have a lisp that does arc from end, by selecting the end of line, entering radius then specifying delta. Can someone edit it to instead of delta its the over all length of the curve instead? 

 

Thanks, 

 

Luis 

0 Likes
Accepted solutions (2)
2,720 Views
17 Replies
Replies (17)
Message 2 of 18

CodeDing
Advisor
Advisor

@lecheverriaK6J4P ,

 

Are you using Civil 3D by chance? Transparent Commands are built into C3D.

 

Best,

~DD

0 Likes
Message 3 of 18

lecheverriaK6J4P
Participant
Participant

I am not. I am using AutoCad Map 2014

0 Likes
Message 4 of 18

john.uhden
Mentor
Mentor

I have a great LineByDirection routine that works exactly as Land Desktop used to, but I never built anything for arcs.

John F. Uhden

0 Likes
Message 5 of 18

lecheverriaK6J4P
Participant
Participant

How tedious would that be to incorporate arcs into that lisp? I also provided a lisp that i feel works great but it asks me for delta. Its a command that lets you draw an arc at the end of a line, sort of like curve from end of object like in Civil 3d. Ill start the command select my end point (end of line) it will ask me for a radius then a delta. The delta is whats throwing me off. If i could get it replace with length that would be perfect. I just dont have the most LISP writing skills.

0 Likes
Message 6 of 18

Sea-Haven
Mentor
Mentor
Accepted solution

If you look carefully at ARC command there are lots of options, one is the following sequence.

ARC Cen Start Length enterlength

 

The only issue is it will draw counter clockwise this can be solved by a "Flip" option. This can be programmed in lisp, pretty sure should exist.

 

The second is to draw plines and use the arc option, a arc length is Rad*theta so angle can be worked out. The combination of brg/dist then arcs, using a dcl could help. I have something like John's its copyrighted will look at updating it using a dcl. -ve radius = Clockwise. The dcl is a library routine posted here multiple times, Multi getvals.

 

SeaHaven_0-1625014234183.png

 

 

Just a quick answer 

delta (/ (getdist "\nlength: ") rad)

 

SeaHaven_1-1625014337742.png

 

 

 

Message 7 of 18

CADaSchtroumpf
Advisor
Advisor
Accepted solution

@Sea-Haven  a écrit :

 

Just a quick answer 

delta (/ (getdist "\nlength: ") rad)

Yes, you are rigth.

If he change:

delta (getangle "\nDelta: ")

by

delta (/ (getdist "\nLength: ") (abs rad))

 in his code

A negative or positive value for radius give the orient of the arc

0 Likes
Message 8 of 18

john.uhden
Mentor
Mentor
Knowing that L=R*Delta, you can rearrange the equation...
Delta=L/R

John F. Uhden

0 Likes
Message 9 of 18

john.uhden
Mentor
Mentor

"the orient of the arc?!"

 

Here's one for ya.

If you entmod the radius to a negative value, AutoCAD assigns it a radius of 1.0.

The point is that you will have to draw it backwards.

John F. Uhden

0 Likes
Message 10 of 18

Sea-Haven
Mentor
Mentor

Yes thats why I often use the dcl "FLIP" yes or no so would mirror the arc. 

 In the supplied code is (if (minusp rad) which reworks the start end points. Not tested.

0 Likes
Message 11 of 18

CADaSchtroumpf
Advisor
Advisor

@john.uhden  a écrit :

If you entmod the radius to a negative value, AutoCAD assigns it a radius of 1.0.


Yes it's true, moreover in its program we have:

(vlax-invoke space 'addarc ctrPt (abs rad) startang endang)

Which implies that it is always a positive value ...
But the introduction of a negative radius in its program will calculate the center point of the arc (variable 'ctrPt') differently and will imply if this one is to the right or to the left of the line.

ctrPt (polar endPt (- ang (/ pi 2)) rad)
0 Likes
Message 12 of 18

lecheverriaK6J4P
Participant
Participant
One more thing. What do i need to change in the code in order to do a curve from polyline, line and arc?
Currently its only set up to do a curve at the end of a line.
0 Likes
Message 13 of 18

lecheverriaK6J4P
Participant
Participant
Can you share that "flip" command?
0 Likes
Message 14 of 18

Sea-Haven
Mentor
Mentor

I think using a -ve radius would be better so draws correct 1st go, the flip for a simple arc is using mirror and some sq off points. I have this as front end. It just uses my Multi radio buttons.lsp 

 

(setq ans (ah:butts but "h" '("Flip " "Yes" "No")))

 

 

SeaHaven_0-1626332237932.png

 

0 Likes
Message 15 of 18

lecheverriaK6J4P
Participant
Participant
Thank you for that just got the multi radio buttons.lisp

What do i need to change in the code in order to do a curve from polyline, line and arc?
Currently its only set up to do a curve at the end of a line. Im not the most knowledgeable when it comes to lisp so pardon the questions.

Thanks,
Luis
0 Likes
Message 16 of 18

Sea-Haven
Mentor
Mentor

For an arc from the end of a  pline need to get the angle of the pline at end picked than can do a arc as know the angles required. The use pedit to join to pline. Similar for an arc but a bit easier as arcs have start end angle as property. 

 

Need to have  a think.

0 Likes
Message 17 of 18

john.uhden
Mentor
Mentor
Why not just add another vertex with the correct bulge?

John F. Uhden

0 Likes
Message 18 of 18

Sea-Haven
Mentor
Mentor

Yes better way.

0 Likes