Jump to content

Recommended Posts

Posted

Hello to everyone!

 

I wand to create a lisp file that prints on a loop while hiding and unhiding different layers. I am working on a cad software called 4MCAD. 4MCAD unfortunately does not have the native Autocad DWGtoPDF printer. The main problem I am facing is that I have to use third party printers to plot to PDF which ask for the name of the PDF file name on a seperate window. I have tried Nitro PDF creator, cutePDF, doPDF and I cannot figure out how to supress the pop-up window while giving the desired name to the PDF file. 
 

Has anyone know how to solve this problem? 

  • Can you get DWGtoPDF printer as system printer so my Cad software can find it?
  • Has anyone suceeded with any third party software at giving the file name inside the lisp file?

 

For example let's say that the desired filename is "C:\DWG_prints\DWGpr1.pdf" and I want a command like this:

 

(command "-plot" "n" "" "" "" "n" "n" "" "C:\DWG_prints\DWGpr1.pdf" )

Posted

This is default eg "dwg to Pdf" it is in windows what the printer name is or set the printer as default then printer hopefully is "Default Windows System Printer"

image.png.6643bb8b3d27f82b9895326ed5744ece.png

 

This was a company printer name.

(COMMAND "-PLOT" "Y" "" "\\\\PROD\\Lev5-04-BW"
      "A3" "m"    "LANDSCAPE"	   "N"   "W"  "-6,-6"    "807,560"	"1=2"  "C"
	       "y"	  "Designlaser.ctb" "Y"	"N" "N" "N" "N" "N" "y"      )
  )

Trying to remember how I got the name.

Posted

Thank you dan20047,

 

I used the Microsoft XPS printer which recognizes the paper sizes I already created for Nitro PDF creator. I only have to set up the Print settings for Nitro, apply to layout and then just change the printer in the command without changing any of the of the settings:

 

Quote

 

(vl-load-com)

 (if (not (vl-file-directory-p "C:\\DWG_prints\\PDFs\\"))
    (vl-mkdir "C:\\DWG_prints\\PDFs\\"))

(setq DwgPfx "C:\\DWG_prints\\")          

(setq XPSFILE (strcat DwgPfx "Some Name with or without blanks"))

    (while (vl-string-search " " XPSFILE)
        (setq XPSFILE (vl-string-subst "_" " "   XPSFILE)) ; Replace blanks with underscores in the filename
    )

(command "-plot" "n" "" "" "Microsoft XPS Document Writer" "y" XPSFILE "n" "y" )  ; Plot to XPS


 

 

After this I used the the topic on theswamp with the Ghostscript you suggested and the bat file which converts all the XPS Files inside the current folder. 

https://www.theswamp.org/index.php?topic=50646.0 

I only added a command to change the current directory and a command to delete the XPS files after they have been converted:

 

Quote

@echo off
setlocal enableDelayedExpansion
cd "C:\DWG_prints" 
SET PROG=C:\DWG_prints\CONVERTER_DO_NOT_DELETE\gxpswin64.exe
SET OPTS=-sDEVICE=pdfwrite -dNOPAUSE 
::-sPDFSETTINGS=/prepress

 

for %%F in (*.xps) do (
  set "name=%%F"
  ren "!name!" "!name:*- Sheet - =!")
 
:: create the PDFs
for %%F in (*.xps) do (
        echo Making PDF of: %%~nF.xps
        call %PROG% -sOutputFile="PDFs\%%~nF.pdf" %OPTS% "%%~nF.xps"
        DEL "%%~nF.xps")

 

Finally I call the bat file at the end of the lisp file with the following command:

 

Quote

(command "shell" "C:\\DWG_prints\\CONVERTER_DO_NOT_DELETE\\xpstopdf.bat")


        

 

  • Like 1
Posted

Great to hear! Thanks for posting your solution. Real props go to JohnK at the swamp

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