;_____________________________________________________________________________
;;SETS XREF ATTACH DIALOGUE AND SHEET MANAGER START FOLDER TO CURRENT DRAWING PATH
;_____________________________________________________________________________
(defun writereg (/ dwgpath profile hkey version regpath)
(if (not (wcmatch (getvar 'dwgname) "Drawing*.dwg"))
(progn
(setq dwgpath (strcat (getvar 'dwgprefix))
profile (strcat (getvar 'cprofile))
hkey "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\"
version (strcat "R" (substr (getvar 'acadver) 1 4)))
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\XattachFileDialog"))
(if (vl-registry-read regpath "InitialDirectory")
(vl-registry-write regpath "InitialDirectory" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\XrefFileDialog"))
(if (vl-registry-read regpath "InitialDirectory")
(vl-registry-write regpath "InitialDirectory" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\Sheet Set Wizard"))
(if (vl-registry-read regpath "BrowseForLayoutsPath")
(vl-registry-write regpath "BrowseForLayoutsPath" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\Sheet Set Wizard"))
(if (vl-registry-read regpath "SheetSetCreatePath")
(vl-registry-write regpath "SheetSetCreatePath" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\eTransAddFile"))
(if (vl-registry-read regpath "InitialDirectory")
(vl-registry-write regpath "InitialDirectory" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\SSMNavigator"))
(if (vl-registry-read regpath "OpenSheetSetPath")
(vl-registry-write regpath "OpenSheetSetPath" dwgpath)
)
(setq regpath (strcat hkey version "\\ACAD-301:409\\Profiles\\" profile "\\Dialogs\\SSMNavigator"))
(if (vl-registry-read regpath "ImportLayoutsAsSheetsPath")
(vl-registry-write regpath "ImportLayoutsAsSheetsPath" dwgpath)
)
)
)
)
(writereg)
;;;;____________________________________________________________________________________________
;;;;SETS XREF ATTACH DIALOG, ETRANSMIT, AND SHEET MANAGER START FOLDER TO CURRENT DRAWING PATH
;;;;____________________________________________________________________________________________
(defun writereg (/ DP HKCU key regpath)
(if (= (getvar 'dwgtitled) 1)
(progn
(setq DP (getvar 'dwgprefix)
HKCU (strcat "HKEY_CURRENT_USER\\" (vlax-product-key))
key (strcat HKCU
"\\Profiles\\"
(getvar 'cprofile)
"\\Dialogs\\"
)
)
(setq regpath (strcat HKCU "\\ETransmit\\Setups\\Standard\\"))
(vl-registry-write regpath "DestFolder" DP)
(setq regpath (strcat key "XattachFileDialog"))
(vl-registry-write regpath "InitialDirectory" DP)
(setq regpath (strcat key "XrefFileDialog"))
(vl-registry-write regpath "InitialDirectory" DP)
(setq regpath (strcat key "Sheet Set Wizard"))
(vl-registry-write regpath "BrowseForLayoutsPath" DP)
(setq regpath (strcat key "Sheet Set Wizard"))
(vl-registry-write regpath "SheetSetCreatePath" DP)
(setq regpath (strcat key "eTransAddFile"))
(vl-registry-write regpath "InitialDirectory" DP)
(setq regpath (strcat key "SSMNavigator"))
(vl-registry-write regpath "OpenSheetSetPath" DP)
(setq regpath (strcat key "SSMNavigator"))
(vl-registry-write regpath "ImportLayoutsAsSheetsPath" DP)
)
)
)
(writereg)
(vlr-command-reactor nil '((:vlr-commandWillStart . startCommand)))
(defun startCommand
(calling-reactor startcommandInfo / thecommandstart)
(setq thecommandstart (nth 0 startcommandInfo))
(cond
((= thecommandstart "XREF") (writereg))
((= thecommandstart "ETRANSMIT") (writereg))
((= thecommandstart "NEWSHEETSET") (writereg))
)
)
Hypo,
Give the following code a try .. it appears to be working in AutoCAD 2014 :).Code: [Select];; <08.09.2013> RJP updated code and tested on AutoCAD 2014
;; Obviously this writes to the registry so use at your own risk
;; Sets current drawing directory for XREF, ETRANSMIT, SHEETSET, SAVEAS, OPEN and PUBLISH commands
(defun writereg (/ dp hkcu id key)
(if (= (getvar 'dwgtitled) 1)
(progn (setq dp (getvar 'dwgprefix)
hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key))
key (strcat hkcu "\\Profiles\\" (getvar 'cprofile) "\\Dialogs\\")
id "InitialDirectory"
)
(vl-registry-write (strcat hkcu "\\ETransmit\\Setups\\Standard\\") "Destfolder" dp)
(vl-registry-write (strcat key "acad-131") id dp)
(vl-registry-write (strcat key "BrowseropenDialog") id dp)
(vl-registry-write (strcat key "OUTPUTFOLDERDLG") id dp)
(vl-registry-write (strcat key "Save Drawing As") id dp)
(vl-registry-write (strcat key "OpenSaveAnavDialogs") id dp)
(vl-registry-write (strcat key "AcPublishDlg") "Location" dp)
(vl-registry-write (strcat key "Sheet Set Wizard") "BrowseForLayoutsPath" dp)
(vl-registry-write (strcat key "Sheet Set Wizard") "SheetSetCreatePath" dp)
(vl-registry-write (strcat key "SSMNavigator") "OpenSheetSetPath" dp)
(vl-registry-write (strcat key "SSMNavigator") "ImportLayoutsAsSheetsPath" dp)
)
)
(princ)
)
(writereg)
(or *current-path-reactor*
(setq *current-path-reactor* (vlr-command-reactor nil '((:vlr-commandwillstart . startcommand))))
)
(defun startcommand (calling-reactor startcommandinfo)
(and (wcmatch (car startcommandinfo) "*XREF,XATTACH,ETRANSMIT,*SHEET*,PUBLISH,*SAVEAS*,OPEN")
(writereg)
)
)
Hypo,
Give the following code a try .. it appears to be working in AutoCAD 2014 :).Code: [Select];; <08.09.2013> RJP updated code and tested on AutoCAD 2014
;; Obviously this writes to the registry so use at your own risk
;; Sets current drawing directory for XREF, ETRANSMIT, SHEETSET, SAVEAS, OPEN and PUBLISH commands
(defun writereg (/ dp hkcu id key)
(if (= (getvar 'dwgtitled) 1)
(progn (setq dp (getvar 'dwgprefix)
hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key))
key (strcat hkcu "\\Profiles\\" (getvar 'cprofile) "\\Dialogs\\")
id "InitialDirectory"
)
(vl-registry-write (strcat hkcu "\\ETransmit\\Setups\\Standard\\") "Destfolder" dp)
(vl-registry-write (strcat key "acad-131") id dp)
(vl-registry-write (strcat key "BrowseropenDialog") id dp)
(vl-registry-write (strcat key "OUTPUTFOLDERDLG") id dp)
(vl-registry-write (strcat key "Save Drawing As") id dp)
(vl-registry-write (strcat key "OpenSaveAnavDialogs") id dp)
(vl-registry-write (strcat key "AcPublishDlg") "Location" dp)
(vl-registry-write (strcat key "Sheet Set Wizard") "BrowseForLayoutsPath" dp)
(vl-registry-write (strcat key "Sheet Set Wizard") "SheetSetCreatePath" dp)
(vl-registry-write (strcat key "SSMNavigator") "OpenSheetSetPath" dp)
(vl-registry-write (strcat key "SSMNavigator") "ImportLayoutsAsSheetsPath" dp)
)
)
(princ)
)
(writereg)
(or *current-path-reactor*
(setq *current-path-reactor* (vlr-command-reactor nil '((:vlr-commandwillstart . startcommand))))
)
(defun startcommand (calling-reactor startcommandinfo)
(and (wcmatch (car startcommandinfo) "*XREF,XATTACH,ETRANSMIT,*SHEET*,PUBLISH,*SAVEAS*,OPEN")
(writereg)
)
)
Ronjop that routine seems to work!! Thanks you very much! :-)
Give the following code a try .. it appears to be working in AutoCAD 2014 :).
As I understand it, newer products (2013+) use vlax-User-Product-Key... More info at the bottom of this post (http://www.theswamp.org/index.php?topic=42257.msg474024#msg474024).
Accessing the product key was changed in .NET API as well, as shown here (http://forums.autodesk.com/t5/NET/productkey-replacement-in-dot-net-4/td-p/3532628).
Cheers
Give the following code a try .. it appears to be working in AutoCAD 2014 :) .
FWIW -As I understand it, newer products (2013+) use vlax-User-Product-Key... More info at the bottom of this post (http://www.theswamp.org/index.php?topic=42257.msg474024#msg474024).
Accessing the product key was changed in .NET API as well, as shown here (http://forums.autodesk.com/t5/NET/productkey-replacement-in-dot-net-4/td-p/3532628).
Cheers
Cheers
Give the following code a try .. it appears to be working in AutoCAD 2014 :) .
FWIW -As I understand it, newer products (2013+) use vlax-User-Product-Key... More info at the bottom of this post (http://www.theswamp.org/index.php?topic=42257.msg474024#msg474024).
Accessing the product key was changed in .NET API as well, as shown here (http://forums.autodesk.com/t5/NET/productkey-replacement-in-dot-net-4/td-p/3532628).
Cheers
Cheers
So does this mean that vlax-product-key is going to be retired at some point?
New Functions:
<snip>
VLAX-MACHINE-PRODUCT-KEY - Returns the AutoCAD product key from the Machine hive in the Windows Registry. (ie. "Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B001:409")
VLAX-USER-PRODUCT-KEY - Returns the AutoCAD product keyfrom the User hive in the Windows Registry. (ie. "Software\\Autodesk\\AutoCAD\\R19.0\\ACAD-B001:409")
Obsolete Functions:
VLAX-PRODUCT-KEY - While still supported, it is recommended to use the new function VLAX-MACHINE-PRODUCT-KEY instead which returns the same value.
Cool .. thanks. :)