Jump to content

Recommended Posts

Posted

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))
     )
   )
 )
     

     

Posted

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")

Posted

That's exactly what I needed! I don't know anything about the underscores. That wasn't covered in my class on LISP.

Posted
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.

Posted
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.

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...