Originally Posted by
Opie
No, it cannot... As the code you reference, while succinct, is performing the exact same string concatenation as the code which I posted earlier... Just at a substantial decrease in performance.
Here's a quick speed test to demonstrate, where I've intentionally commented out the calls to interface with the 'AeccXUiLand.AeccApplication' Object, so this test merely compares the time taken to yield the required string result in order to obtain same.
Code:
_$ (_FOO1)
"10.4"
_$ (_FOO2)
"10.4"
_$
Sample sub-functions:
Code:
(vl-load-com)
(defun _FOO1 (/ vrsn aeccApp)
(setq vrsn (getvar 'acadver))
(setq vrsn
(cond
((vl-string-search "20.1" vrsn) "10.5") ; 2016
((vl-string-search "20.0" vrsn) "10.4") ; 2015
((vl-string-search "19.1" vrsn) "10.3") ; 2014
((vl-string-search "19.0" vrsn) "10.0") ; 2013
((vl-string-search "18.2" vrsn) "9.0") ; 2012
((vl-string-search "18.1" vrsn) "8.0") ; 2011
((vl-string-search "18.0" vrsn) "7.0") ; 2010
((vl-string-search "17.2" vrsn) "6.0") ; 2009
((vl-string-search "17.1" vrsn) "5.0") ; 2008
)
)
;;; (setq aeccApp (vla-getinterfaceobject
;;; (vlax-get-acad-object)
;;; (strcat
;;; "AeccXUiLand.AeccApplication."
;;; vrsn
;;; )
;;; )
;;; )
)
(defun _FOO2 (/ c3d)
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
)
(setq C3D (vl-registry-read C3D "Release"))
(setq C3D
(substr
C3D
1
(vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
)
)
;;; (setq C3D (vla-getinterfaceobject
;;; *acad*
;;; (strcat "AeccXUiLand.AeccApplication." C3D)
;;; )
;;; )
)
Results from VLIDE console:
Code:
_$ (bench '(_FOO1 _FOO2) '() 10000)
_FOO1
Elapsed: 46
Average: 0.0046
_FOO2
Elapsed: 203
Average: 0.0203
_$
... I think I'll stick with my CONDitional statement, and put in the arduous time needed to update the nested list of decending test expressions once a year. Haha