script for using dwg to pdf, specifying path, but using default file name

script for using dwg to pdf, specifying path, but using default file name

Anonymous
Not applicable
1,155 Views
2 Replies
Message 1 of 3

script for using dwg to pdf, specifying path, but using default file name

Anonymous
Not applicable

hello,


I am currently able to use "dwg to pdf" in a script file to adjust layers in a drawing, etc, and automatically print to pdf where the pdf file name (the dwg file name I am plotting from) and location (same folder that dwg files are in) are set by default.


I am also able to specify a custom path and file name.


However, I would like to know if I can specify the path and then allow the pdf name to be the default name, which would be the name of the dwg file. I have not been able to do this in a script.


Ultimately, I would like to use this script in ScriptPro so that I can direct pdfs to a custom folder, while using the default file name, for a group of drawings.


thx /v

0 Likes
1,156 Views
2 Replies
Replies (2)
Message 2 of 3

hencoop
Advisor
Advisor

(STRCAT (GETVAR "DWGPREFIX") (SUBSTR (GETVAR "DWGNAME") 1 (-(STRLEN (GETVAR "DWGNAME"))4)) ".pdf")

(Lisp statements like this work in scripts.)

 

Replace (GETVAR "DWGPREFIX") with your custom location if needed (must end with "\\")

 

DOSLIB (a free utility from Robert McNeel & Associates) has good path function (dialog driven too) that make specifying paths in your routines very easy.

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 3 of 3

hencoop
Advisor
Advisor

You can use VL-BB-SET and VL-BB-REF functions to store and retrieve variable values in subsequent drawings when SDI=0.

 

If SDI=1 and LISPINIT=0 you can just set variables that will be available in subsequent drawings.  (Such as your custom file location).

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes