Quantcast
Channel: Autodesk AutoCAD forums
Viewing all articles
Browse latest Browse all 14319

Redefining plot issue on workaround for MD_ layers LW - overwritting PDFs fails

$
0
0

Since we use Acad 2014, some of my coworkers have started using viewbase style views. Since we have standards regarding lineweights, I've tried to find in vain a way to set the lineweight default values for the viewbase layers (MD_Annotation, MD_Hatching...) when CAD create them. Since i couldn't find any way to give them default values upon creation, my only option was to pre created in our templates all the layers generated by viewbase. The thing is that when someone purge a drawing prior to create the first viewbase, (which is 95% of the cases - designers make the design/3d model, purge, then the draftsman takes over the project to make the fab plans) the MD_ layers get deleted, and when they are generated again all the lineweights don't match our standards. I thought about the adding a dot on each layer in the titleblock but didn't as we wanted to keep the posibility of being able to purge these layers whenever they are not in use, mainly because we use a lot of xrefs...so it wasn't a viable option.

A guardian angel (jdiala - cadtutor.net forum) made me a simple yet very effective lisp redefining the plot command:

 

(defun C:vplot (/ laylist lwlist laytbl)
(setq laylist (list "MD_Annotation" "MD_Hatching" "MD_Hidden" "MD_Visible")
      lwlist  (list -3 5 13 -3)
      laytbl  (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
)

(mapcar 
  (function  
    (lambda (a b) 
      (if 
        (tblsearch "LAYER" a)
        (vla-put-Lineweight (vla-item laytbl a ) b) 
        (princ (strcat "\nLayer " (strcase a) " does not exist")) )))
      laylist
      lwlist
)
(princ)
(initdia)
(command "_.plot")
)

 The lisp works like it is supposed to. When I plot a PDF file, and the PDF file name already exists (but is not opened, nor in read only),CAD ask if I want to overwrite the file, I say yes, Cad plot then open the PDF in the PDF viewer. (normal behavior). Don't know if it is related, but now, if I hit preview prior to plot, and in the preview window I right click then choose plot from within the right click menu, instead of asking if I want to overwrite it, sometimes Autocad don't ask anything and cancel the job (says so on the "click to view plot and publish details" popup). Same behavior occasionnaly occur using the publish command. Today one designer wasn't able to overwrite a PDF by simply hitting "ok" on the plot dialog, tried few times, came to get me to show me his issue and while I was there it worked without issue. When the issue occurs, deleting the PDF or restarting Autocad without acaddoc.lsp are 2 (slightly annoying) workarounds for this issue... but manual workaround can lead to costly errors if a previous version of a fabrication plan get released because the draftsman didn't realize that the PDF wasn't overwritten.

 

Many questions are now haunting my head...might the problem be caused from undefining the original plot command?

What I cant stop asking me right now is "What if the plot command I've undefined contained more than (initdia)(command "_.plot")?
Is there any way of looking at the lisp/code of an original command - in this instance the original Plot command? (To know exactly what we are redefining)
Could redefining any command be somehow.. hazardous?

Or maybe there is an already known issue not related to redefining the plot command?

Is there any way to control to what lineweigths the MD_ layers will have upon creation?

 

Any advices/suggestions/answers to the above questions would be appreciated!

*using DWG to PDF (by Autodesk) to plot PDFs.*

(sorry for the length of the post!) Cheers,

Jef!


Viewing all articles
Browse latest Browse all 14319

Trending Articles