Jump to content

Recommended Posts

Posted

I have written a send a .dwg to .pdf routine and it is not working.

 

Here are the plot settings.

 

attachment.php?attachmentid=63700&cid=1&stc=1

 

Any ideas?

 

(defun c:SendToPDF ( / *error* vars old s file Fname fsl dwgN)

  (defun *error* ( msg )
     (and old (mapcar 'setvar vars old))
     (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
     (princ (strcat "\n** Error: " msg " **")))
     (princ)
  )

  (setq vars '("CMDECHO" "FILEDIA") old (mapcar 'getvar vars))
  (mapcar 'setvar vars '(0 0))
  (setq dwgN (getvar "dwgname"))
  (setq fsl (strlen dwgn))
  (Setq Fsl (- fsl 4))
  (setq Fname (substr dwgn 1 fsl))
  (setq Fname (strcase fname t))
  (setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ".pdf"))

  (while
     (progn
        (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : ")))
        
        (cond ( (eq "" s)
        (setq s (getvar 'DWGNAME)) nil)
        
        ( (not (snvalid s))
        (princ "\n** Invalid **")))
     )
  )
(setq path (getvar "dwgprefix"))


; (command "_.saveas" "_2010" (strcat "G:\\Group\\2D AutoCAD\\HDAL Library\\" s))
;(command "_.saveas" "_2007" (strcat path s))
 (command "-plot"         "yes"           ""              "DWG TO PDF.PC3"
          "ANSI expand B (11.00 x 17.00 Inches)" "Inches"        "Landscape"     "yes"           "Extents"
          "yes"           "yes"               "yes"           "monochrome.ctb"       "yes"
          "no"            "no"            "yes"           file            "no"            "Yes"
         )
(mapcar 'setvar vars old)

(princ)
)

Greg

Plt to PDF.jpg

Posted

I'm not sure because I haven't tested your routine but does it maybe fail on the paper size? You don't mention... I ask because I had this problem once and after I replaced the spaces in my paper size with underscores it worked...

Posted
I'm not sure because I haven't tested your routine but does it maybe fail on the paper size? You don't mention... I ask because I had this problem once and after I replaced the spaces in my paper size with underscores it worked...

 

Thanks. I will give that a shot and see what happens.

 

Greg

Posted

GregGleason,

 

try this.

 

 

(defun c:Test()
     (vl-load-com)
   
     (if (setq filename (getfiled "Save File Location" ""  "pdf" 1))
 (progn 
     (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)"
         "inches" "landscape" "yes" "Extents"
         "fit" "center" "yes" "monochrome.ctb" "yes" "a" filename "no" "yes")
               )
         )
     )

Posted

Probably Brian's suggestion will work so just show where you went wrong:

 

to make the file name try his :

 (setq file (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf")) 

 

also :

 (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : "))) 

 

file is not a system variable so it should be :

 (setq s (getstring (strcat "\nEnter Filename for Save <" file "> : "))) 

 

hope this helps

 

gr. Rlx

Posted

2c - I'd store the file lisp variable like this:

(setq file (apply '(lambda (a b c) (strcat a b ".pdf")) (fnsplitl (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname))))))

Posted
2c - I'd store the file lisp variable like this:

(setq file (apply '(lambda (a b c) (strcat a b ".pdf")) (fnsplitl (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname))))))

 

make it 20 dollar cause never seen this construct :? haha

Posted
make it 20 dollar cause never seen this construct :? haha

 

Haha.. cheers! :beer:

Posted

AH! now the biting makes sense! fnsplitl is a real function....

NowTheBitingMakesSense.jpg

Posted
GregGleason,

 

try this.

 

 

(defun c:Test()
     (vl-load-com)
   
     (if (setq filename (getfiled "Save File Location" ""  "pdf" 1))
 (progn 
     (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)"
         "inches" "landscape" "yes" "Extents"
         "fit" "center" "yes" "monochrome.ctb" "yes" "a" filename "no" "yes")
               )
         )
     )

 

That worked great BrianTFC! I appreciate the help.

 

Greg

Posted
Probably Brian's suggestion will work so just show where you went wrong:

 

to make the file name try his :

 (setq file (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf")) 

also :

 (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : "))) 

file is not a system variable so it should be :

 (setq s (getstring (strcat "\nEnter Filename for Save <" file "> : "))) 

hope this helps

 

gr. Rlx

 

I appreciate you taking the time to show me these. THIS is how I learn. Kudos to you, rlx!

 

Greg

Posted

Glad both me and BrianTFC were able yo help you

 

:beer:

Posted

Greg,

 

Your welcome Greg!! I've leaned a lot from everyone on this site and I'm glad I could finally help someone on here.

 

Brian

  • 1 year later...
Posted (edited)

finally managed to get this all setup and working properly using the getvals, plota3pdfrange etc. one thing i noticed with the merging of the pdf's though, it seems to change the appearance of symbols in text. my diameter symbol for example looks fine in the individual sheets but once combined it changes..

 

single pdf sheet like this:

image.png.af5010d1bb6bd85ec9ef571d4f338c80.png

after its combined it looks like this:

image.png.9621747b569e36b3624ead21fe6efab1.png

anyone know how to fix this? I've got latest version of ghostscript installed

Edited by masterfal
Posted

Are you using the %%c for the diameter ? You may need to use the correct alt+ octal code for the diameter symbol, it is in Mtext.

 

Posted

yeh usually use %%c.

it only happens when i use the arial font. if i change to calibri it works. need to use arial though as thats our standard style..

Posted (edited)

Trying to remember pretty sure arial has a diameter symbol. Go to mtext pretyy sure the key code is there. Go down to other and it will open the font map need to work out the key number.

Edited by BIGAL

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