Jump to content

Recommended Posts

Posted (edited)

I am working in a 3d drawing and having to define many new UCS planes.

I start with UCS 3P

pick my 3 points

type plan and hit enter twice.

This works but AutoCAD does a zoom extents….NOW I HAVE TO FIND WHERE I WAS AND ZOOM TO THE AREA.

 

I need some help programing a new command 3ptucs.

I want to type 3ptucs.

Be asked to select the origin.

Select the x direction.

Select the y direction.

 

The program uses these points to make the new UCS, gets normal to plane

and do a zoom window using the same points. No Hide and seek to find where I was working.

 

I have a start and it works for everything in the same plane but as soon as I pick something with a z value my zoom window may not be correct.

 

 

(defun c:3ptucs (/ p1 p2 p3 )

(setq p1 (getpoint "\npick origin of UCS : "))

(setq p2 (getpoint "\npick x direction : "))

(setq p3 (getpoint "\npick y direction : "))

(command "ucs" "3P" p1 p2 p3)

(command "plan" "")

(command "zoom" "w" p2 p3)

 

 

(princ)

 

 

)

(PRINC)

Edited by EBROWN
Posted

try this

(defun c:3ptucs (/ p1 p2 p3 )
(setq p1 (getpoint "\npick origin of UCS : "))
(setq p2 (getpoint "\npick x direction : "))
(setq p3 (getpoint "\npick y direction : "))
(command "ucs" "3P" p1 p2 p3) 
(command "plan" "")
(command "zoom" "w" (REVERSE(CAR(REVERSE P2))) (REVERSE(CAR(REVERSE P3))))

(princ)

)

 

 

reversing the list, with car you get rid of the z. then you reverse it again.

 

 

ps.: Next time, please use code tags

Posted

Thank you Jeff.

 

 

I did try the reversing of list as you have shown but the zoom seems to be to extents and not window.

Posted

(defun c:3ptucs (/ p1 p2 p3 p2a p3a)
(setq p1  (getpoint "\npick origin of UCS : ")
      p2  (getpoint "\npick x direction : ")
      p3  (getpoint "\npick y direction : ")
      p2a (trans p2 1 0)
      p3a (trans p3 1 0)
);; setq
(command "ucs" "3P" p1 p2 p3
  "plan" ""
  "zoom" "w" (trans p2a 0 1) (trans p3a 0 1)
)
(princ)
)

 

HTH

Henrique

Posted

Many thanks Henrique,

 

 

I had to google trans

 

 

(trans [])

Translates a point from one coordinate system to another.

 

 

Works as I hoped it would...

Posted

You're welcome, EBROWN

Glad I could help

 

 

Henrique

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...