Jump to content

Recommended Posts

Posted

I've experimented with smaller LISP routines, but my attempts at a bigger project (still pretty small) haven't quite worked. Hopefully someone has some snippits of code that would help. Here's what I'm trying to accomplish;

 

  1. Invert selection
  2. Delete new selection (essentially just leaving what was originally selected)
  3. Purge all extra layers
  4. Delete all paper-space tabs
  5. Zoom to extents (in modelspace)
  6. Plot to a printer named "Adobe PDF"

 

I do this routine multiple times throughout the day and a LISP routine would be oh so lovely... I just don't know how. My biggest problem comes in deleting the paper-space tabs and plotting, the rest I think I can figure out.

 

Any help would be appreciated!

DKT

Posted

FYI, you have to have at least one paperspace tab. However, you could delete with:

(vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
 (or (eq "Model" (vla-get-name x)) (vla-delete x)))

 

For plotting, look at vla-plottofile or (command "_.-plot" ...)

Posted

A pointer for deleting the inverse selection perhaps:

 

(defun DeleteInverse ( sel / all )
 
 (if (and sel (setq all (ssget "_X")))
   (
     (lambda ( i / e )
       (while (setq e (ssname all (setq i (1+ i))))
         (or (ssmemb e sel) (entdel e))
       )
     )
     -1
   )
 )
)

 

Feed with user selectionset :)

Posted
Don't forget to account for locked layers.

 

Won't error, but yeah, user would have to include routines to unlock all layers if need be.

Posted
Won't error, but yeah, user would have to include routines to unlock all layers if need be.

Oh, I know. That's why it wasn't directed at you.

Posted

Thanks! I think I have all the bits I need now, except the plotting. Do you have an example of that code that I could mess with to make it work for my purpose?

 

DKT

Posted
Thanks! I think I have all the bits I need now, except the plotting. Do you have an example of that code that I could mess with to make it work for my purpose?

 

DKT

 

Two ways you can do it DKT,

 

1) Using the plot command in a command call - just submitting the data to the prompts.

 

2) Using vla-PlotToDevice, and either configuring the plot configuration of the layout to how to want it, or use a separate PC3 configuration file.

 

I wrote a BatchPlotter a while back, to perform a centered extents plot on multiple drawings, but unfortunately its not freeware :(

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