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

Set z Axis orientation to two user points to draw and extrude circle

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1038 Views, 2 Replies

Set z Axis orientation to two user points to draw and extrude circle

I'm trying to change a routine i just wrote that draws 3d pipes.

I wanted to make it so that when a user selects the beginning point and ending point of the pipe,

the LISP changes the ucs to that vector, draws the circle at the beginning point

and extrudes it to the second point.

 

It actually works great except when the ucs changes, so do my user points because of teh origin change.

Is ther a better way I might get this to do what I wnat it to?

 

(setq ip (getpoint "\nPick First Point:"))
(setq ep (getpoint "\nPick Second Point:"))
(command ".ucs" "za" ip ep)
(setvar "osmode" 0)
(command ".circle" ip "d" od)
(command ".extrude" (entlast) "" (distance ip ep))
(command ".ucs" "w")
(setvar "osmode" oldsnap))

 

2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

....when a user selects the beginning point and ending point of the pipe, the LISP changes the ucs to that vector, draws the circle at the beginning point and extrudes it to the second point.

 

It actually works great except when the ucs changes, so do my user points because of teh origin change.

....

(setq ip (getpoint "\nPick First Point:"))
(setq ep (getpoint "\nPick Second Point:"))
(command ".ucs" "za" ip ep)
(setvar "osmode" 0)
(command ".circle" ip "d" od)
(command ".extrude" (entlast) "" (distance ip ep))
(command ".ucs" "w")
(setvar "osmode" oldsnap))

No time to test it, but I think you can either do:

(command ".circle" "0,0,0" "d" od)

since you've made that location the origin point of the current UCS, or

(command ".circle" (trans ip 0 1) "d" od)

to (trans)-late that point from the WCS coordinates that it will be saved in to the current UCS.

Kent Cooper, AIA
Message 3 of 3
Anonymous
in reply to: Kent1Cooper

Wow! I was way over thinking that one.

I just used 0,0,0 to insert the circle and it works perfectly.

 

Thanks for all your help, Kent.  I just started learning LISP this week and I'm alot farther along than I expected to be thanks to all the people here that are willing to share their knowledge.

 

-Anthony

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

Post to forums  

Autodesk Design & Make Report

”Boost