- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Our company is now using a document management system to store and view our drawings (viewed as PDF's). For the PDF's to be shown correctly the plot setup has to be correct or else the PDF looks like crap. I've been trying to think of the best way to set this up so it can be done through a LISP or script between the different groups. Using the ObjectDBX Wrapper Lisp lisp from Lee Mac and the below code thanks to Ajilal I can set the CTB file to all the drawings in a folder. What I didn't realise is that they need the make sure the printer is always the same (Adobe PDF), plot area is extents, centre plot, fit to paper, plot lineweights is off and the fun part of making sure the paper size is correct and the orientation. We're now about to roll out a new standard border that's created as a block so I was thinking with an 'if' function maybe it could detect the block then apply the correct settings. On the other hand we also have a bunch of older drawings moving to our DM system that are in Model space and there's no defined border block, just a bunch of lines. Is it possible to detect the outer limits of the drawing in a model space then apply the print setup?
Sorry for the trouble I know it's a big ask. I'm not sure if I could incorporate so much into the below code.
(defun c:RV ( / )
(LM:ODBX
(function
(lambda ( doc )
(princ (strcat "\nOpening file : "(vla-get-name doc)))
(vlax-for lay (vla-get-layouts doc)
(vla-put-stylesheet lay "StandardCTB.ctb")
(princ (strcat "\nCTB changed for : "(vla-get-name lay)))
);vlax-for
)
)
nil t
)
(princ)
);defun
Thanks to the help of the community I also have this code below that would set the CTB via a script. If the above code isn't capable of the options needed would I be better to try and add it to the below code?
(defun C:RV ( / COUNT DIR FILENAME FILES SCRIPTNAME)
(if (setq dir (getfiled "Select the drawing directory:" "" "dwg" 0))
(setq dir (vl-filename-directory dir))
)
(if dir
(setq files (vl-directory-files dir "*.dwg" 1))
)
(if files
(progn
(setq scriptname (open (strcat "C:\\Users\\" (getenv"username") "\\Desktop\\batch.scr") "w")
count 0
)
(while (setq filename (nth count files))
(setq filename (strcat dir "\\" filename))
(write-line (strcat "_open \"" filename "\"") scriptname)
(write-line "(setq *acad-object* (vlax-get-acad-object))" scriptname)
(write-line "(setq *active-document* (vla-get-activedocument *acad-object*))" scriptname)
(write-line "(setq *active-layout* (vla-get-activelayout *active-document*))" scriptname)
(write-line "(vla-put-stylesheet *active-layout* \"StandardCTB.ctb\")" scriptname)
(write-line "_qsave" scriptname)
(write-line "_close" scriptname)
(setq count (1+ count))
)
(close scriptname)
)
)
(princ)
)
Thanks again everyone.
Solved! Go to Solution.
|