Generate multisheet PDF from modelspace drawings in blocks from command line

This widget could not be displayed.

Generate multisheet PDF from modelspace drawings in blocks from command line

Anonymous
Not applicable

I need to automatically generate multi sheet PDF from DWG modelspace with several or just single drawings on it. The drawings do not have views or anything I can reliably reuse other than title block with certain names like "My Size D", "Company C" etc. Right now the generation of PDFs is based on command line script of accoreconsole but it is very basic and prints everything on one PDF page with Extends so maximum zoom out and using the same page size. I am looking for a way to make PDF with multiple pages based on blocks found in the model space.  I am trying to do that using Lisp script inside of accoreconsole but I am wondering if there is anything readily available I can use or code I can use. I found many examples for layout but not for blocks. And the solution should be able to work from a command line as the PDF generation is a part of larger system and should run unattended.

0 Likes
Replies (9)

Sea-Haven
Mentor
Mentor

This can be changed for pdf, you will need to change the "W" window settings to suit the title block size, likewise the (2 . "titleblockname") expects the insert point to be lower left.

 

 

(PROMPT ".....PRINTING DRAWING TO plotter....")
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
 
(setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Da1drsht")(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"     "" "//PRODPRN01/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)

 

Anonymous
Not applicable

Thank you very much for this example! So far I am trying to run it and getting "; error: bad argument type: lselsetp nil".

Google saying that the selection set is missing, I tried to select one of the drawings block but it still falling. So I am looking further.

I seems to be able to make a code to find a size of block, the challenge is also to be able to find the format blocks. I am thinking to have an additional file with a list of names of the format blocks used (of course incomplete initially) and update the list as more drawings get processed.

I really appreciate your help, any additional pieces I can use would greatly help.

I think that I need

  • Get list of all blocks in the DWG
  • Filter out only the format blocks according to the external file list
  • For each of the formats found get its size
  • Create viewports based on the size
  • Print to multi-page PDF
  • If no appropriate block found just dump everything into one PDF with extends window size and maybe dump list of blocks into some kind of additional file for future refining.

What do you think?

0 Likes

maratovich
Advisor
Advisor

use this - Revers 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes

Sea-Haven
Mentor
Mentor

maratovich has the best solution, but if you want to persist.

 

Your steps are right, dont need get all blocks just look for the ones that make the title block. Dont put in a file the names and details can do in a list

 

("A1" "0,0" "820,575")("A1P" "0,0" "575,820")(........

Anonymous
Not applicable

Hi @maratovich  I really appreciate the hint.

I watched several of your videos and have questions:

Do you know if Revers can be set with AutoPrint to start automatically when Windows boot?

Also can the folder scan time for AutoPrint be shortened as I need to process hundreds drawings per hour?

or

Can the Revers be started as a command-line tool only in specific folder to read DWG from that folder and place the PDF into that folder and then exit from Revers?

My goal is to have a completely unmanned automated solution where no user would touch the machine with convertor for many month.

 

 

0 Likes

maratovich
Advisor
Advisor

yes

yes

no

yes

 

 

you need to try and customize to fit your needs.

and specificity and examples are needed ... there are a lot of functions and a lot depends on your style of creating drawings.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes

Anonymous
Not applicable

Hi @maratovich  thank you for the reply. So I would need to do customization one way or another. I will try to do it in lisp then...

0 Likes

Anonymous
Not applicable

Hi @maratovich , please check your company email

0 Likes

maratovich
Advisor
Advisor

No letters came from you.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes