I have some AutoLISP code for AutoCAD on my
website to preset the Path type in the xref attach dialog box. I got this question.
I am wondering how to use the sample lisp you have for presetting the path type in the xref attach dialog box. I don't have much experience with lisps, and have only worked with ones that are run from the command line. How do I work with the sample code you provide?
So here I've added 3 commands and for the one that wants to learn how to do it just take a look at the code. By using c: before the function a command is created. The commands are SXA, SXR and SXN. Select the code below, copy it into Notepad and save it to something with the .LSP extension. Then use APPLOAD within AutoCAD to load the file or just drag and drop it into AutoCAD from Explorer. Another way is to enter for example (SetPathType 0) on the command line.
;;;
;;; Sets the Xref Path type used in the xref attach dialog box
;;; Absolute Path: (SetPathType 0)
;;; Relative Path: (SetPathType 1)
;;; No Path: (SetPathType 2)
;;;
;;; By Jimmy Bergmark www.jtbworld.com
;;;
(defun SetPathType (v)
(vl-load-com)
(vl-registry-write
(strcat
"HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(vla-get-activeprofile
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
)
"\\Dialogs\\XattachDialog"
)
"PathType"
v
)
)
;;; Gets the Xref Path type used in the xref attach dialog box
;;; 0 = Absolute Path
;;; 1 = Relative Path
;;; 2 = No Path
(defun GetPathType ()
(vl-load-com)
(vl-registry-read
(strcat
"HKEY_CURRENT_USER\\"
(vlax-product-key)
"\\Profiles\\"
(vla-get-activeprofile
(vla-get-profiles
(vla-get-preferences (vlax-get-acad-object))
)
)
"\\Dialogs\\XattachDialog"
)
"PathType"
)
)
;;; Set Xref Absolute path
(defun c:SXA ()
(SetPathType 0)
(princ)
)
;;; Set Xref Relative path
(defun c:SXR ()
(SetPathType 1)
(princ)
)
;;; Set Xref No path
(defun c:SXN ()
(SetPathType 2)
(princ)
)
(princ)
No comments:
Post a Comment