Silvercloak Posted October 14, 2015 Posted October 14, 2015 Sorry, I don't get to code much at my job. We're going through a slow period so I'm trying to brush up on my autoLISP and write a program that takes care servicing slips we do. The idea is to make things as easy as possible for our nontechnical staff so they can generate these slips. So I've come up with an idea to create a unique block that contains an attribute which holds the lot# for each lot. In short - AutoCAD would create a layout referencing the lot # for the name of the layout tab, pan the viewport to that particular lot #, set the scale to say - 1:500 and then make another new layout tab for the next lot and repeat. Right now I'm trying to tackle how autolisp is going to zoom to that lot. I can't figure out how to make that particular part work... here's what I've done so far. Can someone tell me how to pass on the block location to the zoom command? Thanks, sorry I'm terribly noob at this since I don't get alot of opportunities to code here. (defun c:LOTNUM (/ LOTNO) (setq CE-SAV (getvar "cmdecho")) (setvar "cmdecho" 0) (graphscr) (progn (setq SS (ssget "x" '((2 . "lotnum")))) (setq POSITION 0) (while (setq ENAME (ssname SS POSITION)) (setq ELOC (GETDXF 10 ENAME)) ;;; THIS IS THE PART THAT HAS ME HUNG UP (command "zoom" "c" (car ELOC),(cadr ELOC),(caddr ELOC)" ") ;;; (command "zoom" "2xp") (setq POSITION (1+ POSITION)) ) ) ) Quote
Lee Mac Posted October 14, 2015 Posted October 14, 2015 Assuming your GETDXF function looks something like: (defun getdxf ( x e ) (cdr (assoc x (entget e)))) Then change: (command "zoom" "c" (car ELOC),(cadr ELOC),(caddr ELOC)" ") (command "zoom" "2xp") to: (command "_.zoom" "_c" eloc "2xp") Quote
Silvercloak Posted October 14, 2015 Author Posted October 14, 2015 That's exactly what I needed! I don't know anything about the underscores. That wasn't covered in my class on LISP. Quote
Lee Mac Posted October 14, 2015 Posted October 14, 2015 That's exactly what I needed! You're welcome! I don't know anything about the underscores. That wasn't covered in my class on LISP. See here for an explanation. Quote
BIGAL Posted October 15, 2015 Posted October 15, 2015 create a layout referencing the lot I am quite sure this has been asked before for the same purpose of a layout per allotments do a search may be a couple of years ago try LOT + Layout. Quote
BIGAL Posted October 15, 2015 Posted October 15, 2015 A quick search this should get you almost there https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-a-lisp-to-create-layouts-in-multiple-drawings/td-p/4361902 Look at post by Hmsilva change read file to use your selection set. 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.