(defun C:TEST (/)
(cond (((getvar "ROAMABLEROOTPREFIX")="*C3D*") (princ "\nTHIS IS CIVIL 3D!!!!"))
(((getvar "ROAMABLEROOTPREFIX")="*MEP*") (princ "\nTHIS IS AutoCAD MEP!!!!"))
(t (princ "\nTHIS IS AutoCAD!!!!"))
)
)
(vlax-product-key)
;;--> "Software\\Autodesk\\AutoCAD\\R20.0\\ACAD-E001:409"
You'll need to run a conditional test based on this data :
http://adndevblog.typepad.com/autocad/2013/08/registry-values-for-productid-and-localeid-for-autocad.html
added:
the function has been cloned as (VLAX-MACHINE-PRODUCT-KEY) recently.
the (vlax-product-key) may become deprecated.
Could you not use:Lee,Code - Auto/Visual Lisp: [Select]
Or have I overlooked something?
Could you not use:Lee,Code - Auto/Visual Lisp: [Select]
Or have I overlooked something?
From my quick test, (getvar 'product) displays "AutoCAD" for both C3D 2014 and AutoCAD 2015.
I was thinking the same thing, but you'd have to check (getenv "ShowFullPathInTitle") too because a drawing name could throw off the test :)
(vl-load-com)
;; This sets a reference to the install path of your product
(setq acadloc
(vl-registry-read
(strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
"ACADLOCATION")
)
;; This sets a reference to the files portion of the acad preferences
(setq *files*
(vla-get-files
(vla-get-preferences (vlax-get-acad-object))
))
;; This builds the string of Support File Search Paths depending of the version of AutoCAD product
(cond ((wcmatch (getvar "ROAMABLEROOTPREFIX") "*C3D*")
(setq sfsp
(strcat
(getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
"K:\\CAD\\2_Configurations\\AutoCAD\\StartupLisp\\2015;"
acadloc "\\SUPPORT;"
acadloc "\\SUPPORT\\en-us;"
;;acadloc "\\FONTS;"
acadloc "\\HELP;"
acadloc "\\EXPRESS;"
acadloc "\\SUPPORT\\COLOR;"
acadloc "\\CIVIL;"
acadloc "\\bin\\fdo;"
"C:\\programdata\\autodesk\\c3d 2015\\enu\\data\\symbols\\mvblocks;"
"C:\\program files\\autodesk\\applicationplugins\\acworkflow.bundle\\contents\\win64;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport;"
"K:\\CAD\\2_Configurations\\AutoCAD\\Fonts;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Pats;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Lisp;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Lisp\\SteelShapes;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\Help;"
)
)
)
((wcmatch (getvar "ROAMABLEROOTPREFIX") "*MEP*")
(setq sfsp
(strcat
"K:\\CAD\\2_Configurations\\AutoCAD\\StartupLisp\\2015;"
(getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
(getvar "ROAMABLEROOTPREFIX") "SUPPORT\\PATS;"
acadloc "\\SUPPORT;"
acadloc "\\SUPPORT\\en-US;"
;;acadloc "\\FONTS;"
acadloc "\\HELP;"
acadloc "\\EXPRESS;"
acadloc "\\SUPPORT\\COLOR;"
acadloc "\\ACA;"
acadloc "\\MEP;"
"C:\\ProgramData\\Autodesk\\MEP 2015\\enu\\Layers\\;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Pats;"
"K:\\CAD\\2_Configurations\\AutoCAD\\Fonts;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Lisp;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\Help;"
)
)
)
(t
(setq sfsp
(strcat
"K:\\CAD\\2_Configurations\\AutoCAD\\StartupLisp\\2015;"
(getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
acadloc "\\SUPPORT;" ;acadloc "\\FONTS;"
acadloc "\\HELP;"
acadloc "\\EXPRESS;"
acadloc "\\SUPPORT\\COLOR;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\;"
"C:\\Program Files\\Autodesk\\AutoCAD Raster Design 2015\\Help;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport;"
"K:\\CAD\\2_Configurations\\AutoCAD\\Fonts;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Pats;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Lisp;"
"K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\Lisp\\SteelShapes;"
)
)
)
)
;; This applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
;; Other File paths
(vla-put-EnterpriseMenuFile *files* "K:\\CAD\\2_Configurations\\AutoCAD\\BASupport\\BA_custom")
(vla-put-TemplateDwgPath *files* "S:\\CAD\\1_BA Standards\\AutoCAD\\2013 Format\\Templates")
(vla-put-PrinterConfigPath *files* "K:\\CAD\\2_Configurations\\AutoCAD\\Plotters")
(vla-put-PrinterDescPath *files* "K:\\CAD\\2_Configurations\\AutoCAD\\Plotters\\PMP Files")
(vla-put-PrinterStyleSheetPath *files* "K:\\CAD\\2_Configurations\\AutoCAD\\Plot Styles")
; Release the object
(vlax-release-object *files*)