EBROWN Posted February 19, 2014 Posted February 19, 2014 (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 February 19, 2014 by EBROWN Quote
Jef! Posted February 19, 2014 Posted February 19, 2014 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 Quote
EBROWN Posted February 19, 2014 Author Posted February 19, 2014 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. Quote
hmsilva Posted February 19, 2014 Posted February 19, 2014 (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 Quote
EBROWN Posted February 19, 2014 Author Posted February 19, 2014 Many thanks Henrique, I had to google trans (trans []) Translates a point from one coordinate system to another. Works as I hoped it would... Quote
hmsilva Posted February 19, 2014 Posted February 19, 2014 You're welcome, EBROWN Glad I could help Henrique Quote
Recommended Posts
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.