Jump to content

Tool/Lisp to find certain instances of a block or polyline and print to pdf


liamdonnelly0209
 Share

Recommended Posts

Hi All.

 

I was wondering if anyone knows of a tool or a way to basically, batch PDF multiple viewports or specific coordinates within a paper layout. I have an A0 drawing where i need a print of the A0 drawing, and multiple grids set to A4 then a Jpeg showing the full plan with the grids on. I have set up a script using the -plot command and set the Coordinates for each grid. However it is a bit slow and cumbersome to do this on multiple drawings. Does anyone know of a way to maybe either through a script or a lisp, to open a drawing. Find certain instances of a block or polyline and print (with certain parameters like include an outline of 10mm around the edge of the grid) and when it has no more blocks to search for, it saves, closes and opens next drawing to search and print?

 

Any help is very much appreciated.

 

Thanks :)

Link to comment
Share on other sites

this can be changed for model or layout tabs and uses multiple block for location create a block sheet size on a no plot layer use array etc to create.

 

; printing multiple sheets in model space automatically
; by Bigal 2011
(PROMPT ".....PRINTING DRAWING TO plotter....")
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)

(setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Your blockname here")(410 . "Model"))))
(setq n (sslength ss2))
(setq index 0)
(repeat n
   (setq en (ssname ss2 index))
   (setq el (entget en))
   (setq inspt (assoc 10 el)) ; insertion pt
  (setq xmin (- (cadr inspt) 6.0))
  (setq ymin (- (caddr inspt) 6.0))
  (setq xymin (strcat (rtos xmin 2 1) "," (rtos ymin 2 1)))
  (setq xmax (+ xmin 813.0)) ; hard coded for 813 wide 6mm offset
  (setq ymax (+ ymin 566.0)) ;hard code for 566 high
  (setq xymax (strcat (rtos xmax 2 1) "," (rtos ymax 2 1)))

 (COMMAND "-PLOT"  "Y"     "" "Design-5100"
       "A3" "M"     "LANDSCAPE"   "N"
       "W"   xymin   xymax "1=2"  "C"
       "y"   "Designlaser.ctb"      "Y"   "" "n"   "n"
       "y" 
   )

 (setq index (+ index 1))
)
(setvar "osmode" oldsnap)
(princ)

Link to comment
Share on other sites

Ah great thanks. So with this am i able to open a drawing, it searchs for the block ive named, it will then print each one consecutively (to a filename i can suggest?) to A4? what do i need to change to make this work?

 

ive only recently been trying out lisps and scripts etc so still new to all this.

 

Thanks

Link to comment
Share on other sites

Tomorrow will paste pdf code link, you would need to do something like pdf name dwgname+view1 then dwgname+view2 if using layouts so much easier can use layout name+dwgname. You need to learn about scripts also very easy for this task.

 

Wrong computer at moment building a new 1

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 years later...

Hi bigal

I checked this code and get this error message:

Command: PLOTT
.....PRINTING DRAWING TO plotter....
error: bad argument type: lselsetp nil
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
Command:

 

 

I want to use this code to plot directly Any block.

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...