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

Help with semi-auto UCS LISP

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
663 Views, 2 Replies

Help with semi-auto UCS LISP

I am brand new to creating LISPs so please forgive any bad practices and basic coding skills. 

I am trying to create a LISP to semi-automate creating UCSs for drawing building elevations. 

I want to create a line across the face of a building, Create a circle with elevation above the first point on the line, and then define the UCS origin as the first point on the line. X axis as the second point on the line and the XY as the circle above the line. 

The code basically woks except the view becomes mirrored. I.E What I want to be the top face of the drawing is the bottom face. 

I would also love to be able to select the center point of the circle automatically but I can't figure that out at all and its not TOO important. It would also be great to delete these lines after the UCS is created but again I have no idea and it doesn't matter too much.

Any help would be much appreciated.  The code can be seen below. Thanks. 

 

(defun c:ucswiz(/ pt1 pt2)
(command "ucsfollow" "1" "")
(command "ucs" "delete" "elev")
(setq pt1(getpoint "\n Select the first point for elevation"))
(setq pt2(getpoint "\n Select the second point for elevation"))
(command "line" pt1 pt2 "")
(command "circle" pt1 "10")
(command "_.change" pause "" "P" "E" 10 "")
(command "ucs" pt1 pt2 pause)
(command "ucs" "save" "Elev" "")
(princ)
)

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

The "" at the end of your UCSFOLLOW command is extraneous -- giving it the "1" completes the command.  It can also be done more concisely, this way:

(setvar 'ucsfollow 1)

 

If you draw the Line in the opposite direction, do you get the UCS "facing" the way you want?

 

The whole thing is certainly doable without actually drawing a Line or a Circle.  You mention deleting the Lines [plural], but I'm not sure whether by that you mean the Line and the Circle -- is the Circle serving any other purpose than to Osnap to in answer to the point-on-XY-plane prompt?  If not, try just this [untested]:

 

(defun c:ucswiz ()
  (command
    "ucsfollow" "1"
    "ucs" "delete" "elev"
    "ucs" pause pause "@0,0,10"
    "ucs" "save" "Elev" ""
  )
  (princ)
)

 

Again, which order you use to pick the points at the pauses [what would have been the ends of your Line] will determine from which side you will view things in that UCS.

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

Changing the direction the line is drawn doesn't seem to correct the issue. 

 

The reason I think the line and circle are necessary is because the UCS is being defined to draw elevations from a point cloud. Therefore the UCS isn't  always going to be in the same orientation, but yes the line and circle are just use as snapping references. 

 

As I say I have only discovered LISPs earlier this week and i'm just figuring things out as I go so thanks for your help and patience. 

 

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

Post to forums  

Forma Design Contest


AutoCAD Beta