mrjagsr744 Posted October 16, 2014 Share Posted October 16, 2014 Can someone help me create a LISP routine for dimensioning 3D piping? Here is what I am trying to accomplish, 1. set the OSNAP to "node" 2. set the UCS origin using 3 points 3. create a linear dimension based on the UCS settings 4. after dimension is drawn go back to step 1 5. when no more dimensions are needed, I would like the UCS to be set back to "World", I don't mind the osnap being left set to "node". Also I would like this routine to work when I am in PS if possible. I was able to do it using a macro, and I want to convert the macro into a lisp routine that can do what I listed above. This is the macro routine I have. ^C^C_.ucsicon _or _.ucs 3 \\\_.dimlinear Quote Link to comment Share on other sites More sharing options...
mrjagsr744 Posted October 16, 2014 Author Share Posted October 16, 2014 here is what I have been able to write so far (still learning) but it stops as soon as the 3 point UCS command is done. What is preventing it from continuing to the dimlinear command? (defun c:3d-dim () (setq osm-old(getvar "osmode")) (setvar "osmode" (setq ort-old (getvar "orthomode")) (setvar "orthomode" 1) (setq spt (getpoint "\nSpecify UCS location and direction")) (command "ucs" "3" spt) (command "_.dimlinear" pause pause pause) (setvar "osmode" (setvar "osmode" osm-old) (setvar "orthomode" ort-old) (command "ucs" "world") ) (princ) Quote Link to comment Share on other sites More sharing options...
hmsilva Posted October 16, 2014 Share Posted October 16, 2014 (edited) (defun c:3d-dim (/ *error* ico-old ort-old osm-old pto ptx pty) (defun *error* (msg) (setvar "osmode" osm-old) (setvar "orthomode" ort-old) (setvar "ucsicon" ico-old) (command "ucs" "world") (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\nError: " msg)) ) (princ) ) (setq osm-old (getvar "osmode")) (setq ort-old (getvar "orthomode")) (setq ico-old (getvar "ucsicon")) (setvar "orthomode" 1) (setvar "osmode" (while (and (setq pto (getpoint "\nSpecify new origin point: ")) (setq ptx (getpoint pto "\nSpecify point on positive portion of X-axis: ")) (setq pty (getpoint pto "\nSpecify point on positive-Y portion of the UCS XY plane : " ) ) ) (command "ucs" "3" pto ptx pty) (setvar "ucsicon" 2) (command "_.dimlinear") (while (> (getvar 'cmdactive) 0) (command pause) ) ) (setvar "osmode" osm-old) (setvar "orthomode" ort-old) (setvar "ucsicon" ico-old) (command "ucs" "world") (princ) ) Henrique Edited October 16, 2014 by hmsilva Quote Link to comment Share on other sites More sharing options...
lrm Posted October 16, 2014 Share Posted October 16, 2014 I am not that experienced in VLISP but I thought I would give this a try. It seems to work. Just hit Enter instead of specifying a location for the next UCS origin to terminate the program and reset the UCS to world. (defun c:3d-dim () (setq osm-old (getvar "osmode")) (setvar "osmode" (setq ort-old (getvar "orthomode")) (setvar "orthomode" 1) (setq spt1 (getpoint "\nSpecify UCS origin")) (setq spt2 (getpoint "\nSpecify UCS 2nd point")) (setq spt3 (getpoint "\nSpecify UCS 3rd point")) (command "ucs" "3" spt1 spt2 spt3) (while spt1 (setq d1 (getpoint "\n1st dim point")) (setq d2 (getpoint "\n2nd dim point")) (setq d3 (getpoint "\ndim location")) (command "dimlinear" d1 d2 d3) (setq spt1 nil) (setq spt1 (getpoint "\nSpecify UCS origin")) (if spt1 (progn (setq spt2 (getpoint "\nSpecify UCS 2nd point")) (setq spt3 (getpoint "\nSpecify UCS 3rd point")) (command "ucs" "3" spt1 spt2 spt3) ) ) ) (princ "\nAll done!") (setvar "osmode" osm-old) (setvar "orthomode" ort-old) (command "ucs" "world") ) (princ) 3d-dim.LSP Quote Link to comment Share on other sites More sharing options...
mrjagsr744 Posted October 16, 2014 Author Share Posted October 16, 2014 That's pretty good Irm, what do I have to add so the ucsicon is shown graphically and the user is able to view on the screen how the ucs is being set before dimensioning? see this video I made from using the macro.https://www.youtube.com/watch?v=su9eP3UBuT4 Quote Link to comment Share on other sites More sharing options...
mrjagsr744 Posted October 16, 2014 Author Share Posted October 16, 2014 you got it! now I just have to make it so the ucsicon is shown as on my video I made https://www.youtube.com/watch?v=su9eP3UBuT4 Quote Link to comment Share on other sites More sharing options...
mrjagsr744 Posted October 16, 2014 Author Share Posted October 16, 2014 never mind, this is exactly what I was looking for, thank you both for your help. Quote Link to comment Share on other sites More sharing options...
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.