­

More Free AutoLISP and Visual LISP code snippets for AutoCAD


 Click here to download the code as a file.

 

;;; Read and write the settings that AecExportToAutoCAD and the like command uses
;;; The effect of writing this settings is directly affecting the commands.
;;; By Jimmy Bergmark
;;; www.jtbworld.com
;;; For ADT 2004

;;; Reads the settings that AecExportToAutoCAD and the like command uses
;;; Bind xrefs or not when exporting
;;; (0 = no bind, 1 = bind)
;;;   (readAecGuiBase40 "ExportExplodedToAutoCADBindXrefs")
;;; Bind method when xrefs are bound when exporting
;;; (0 = Bind method, 1 = Insert method)
;;;   (readAecGuiBase40 "ExportExplodedToAutoCADInsertWhenBinding")
;;; File prefix used when exporting
;;;   (readAecGuiBase40 "ExportExplodedToAutoCADFilePrefix")
;;; File suffix used when exporting
;;;   (readAecGuiBase40 "ExportExplodedToAutoCADFileSuffix")
(vl-load-com)
(defun readAecGuiBase40 (keyname)
  (vl-registry-read
    (strcat
      "HKEY_CURRENT_USER\\"
      (vlax-product-key)
      "\\Profiles\\"
      (vla-get-activeprofile
	(vla-get-profiles
	  (vla-get-preferences (vlax-get-acad-object))
	)
      )
      "\\Preferences\\AecGuiBase40"
    )
    keyname
  )
)


;;; Writes the settings that AecExportToAutoCAD and the like command uses
;;; Bind xrefs or not when exporting
;;; (0 = no bind, 1 = bind)
;;;   (writeAecGuiBase40 "ExportExplodedToAutoCADBindXrefs" 1)
;;; Bind method when xrefs are bound when exporting
;;; (0 = Bind method, 1 = Insert method)
;;;   (writeAecGuiBase40 "ExportExplodedToAutoCADInsertWhenBinding" 1)
;;; Set the file prefix used when exporting
;;;   (writeAecGuiBase40 "ExportExplodedToAutoCADFilePrefix" "")
;;; Set the file suffix used when exporting
;;;   (writeAecGuiBase40 "ExportExplodedToAutoCADFileSuffix" "-ACAD-EXPORT")


(defun writeAecGuiBase40 (keyname n)
  (vl-registry-write
    (strcat
      "HKEY_CURRENT_USER\\"
      (vlax-product-key)
      "\\Profiles\\"
      (vla-get-activeprofile
	(vla-get-profiles
	  (vla-get-preferences (vlax-get-acad-object))
	)
      )
      "\\Preferences\\AecGuiBase40"
    )
    keyname
    n
  )
)
­