Re: Assigning Layer +Line/Curve Style with .net API
Quote:
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. http://www.theswamp.org/Smileys/other/tongue.gif Haha
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
I had not actually looked for that specific property when commenting and, unfortunately, have found that specific property is not exposed (at least in 2013) to LISP. Sorry.
Well at least that means, on some level, I was aware of that haha. I stared as Blackbox's code for a bit, and I just couldn't see how I was supposed to alter it.
Quote:
Originally Posted by
BlackBox
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.
... 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.
http://www.theswamp.org/Smileys/other/tongue.gif Haha
Uh-oh. Opie and Blackbox are about to get into a code fight. Taking bets now.
Anyways, whenever this can get resolved (cause it sounds like it can?) is good enough for me. I wish I could do this on my own instead of pester for updates, but as of now I just lack the ability to do so. I swear someday I'm going to actually learn this coding beyond my meager understanding now.
Thanks
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
BlackBox
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.
Irregardless of speed, you contradict yourself in the same paragraph. The link was suggesting the string can be derived from the software possibly without further programmer intervention when the next release comes out. Of course, it is up to the programmer to utilize the best solution for the program at hand.
Naturally, if one must determine this value often enough in the current drawing session, it will be a drag on performance. However, even in the execution of one routine, one should not be reading this value repeatedly during the time of execution.
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
Regardless of speed....
There are only two reasons why I invest time and effort to write code - Do more work in less time (read speed), or to do something that is not otherwise already possible (read new functionality) - So I'm a bit biased. Haha
Quote:
Originally Posted by
Opie
... you contradict yourself in the same paragraph.
I've always appreciated your keeping others (me) in check - Kindly identify where I've contradicted myself in that paragraph, and I'll gladly clarify/correct my statement accordingly.
Quote:
Originally Posted by
Opie
The link was suggesting the string can be derived from the software possibly without further programmer intervention when the next release comes out.
I prefer clarity to agreement, just as I prefer reliability to speculation... The CONDitional statement shall work for all included versions, regardless of any changes Autodesk makes to Registry, exposed API Properties, etc. in newer versions... To boot, I can spare the few extra lines of code. Haha
For the purposes of clarity, the code posited in the aforementioned link actually derives the string from the Registry, and not the Application instance (what most refer to as 'the Software').
That said, I'm not here to win anyone over - I learn from others' experience and insight, I do what I want with that knowledge, and offer that work for others to cull what they like.
Cheers
Re: Assigning Layer +Line/Curve Style with .net API
Quote:
Originally Posted by
Opie
Naturally, if one must determine this value often enough in the current drawing session, it will be a drag on performance. However, even in the execution of one routine, one should not be reading this value repeatedly during the time of execution.
Completely agreed; it is unfortunate that LISP does not benefit from Fields, and other .NET aspects across a given Namespace or within scope (rather than being natively Synchronous), as that would greatly reduce the number of Transactions required to iterate a selection set, instances of external Interface Objects, etc., and increase performance in kind.
Hooray .NET API! Haha
Re: Assigning Layer +Line/Curve Style with .net API
Is there any update on this?
Thanks
Re: Assigning Layer +Line/Curve Style with .net API
So I've been away from this thread for a while, but finally got fired up with this issue on a recent drawing, and discovered Object Layers nestled deep within the Drawing Settings under toolspace. From what I gather this is the property Opie and BB were talking about not being available to manipulate?
This does still lead me to what BB said earlier, which seems to be saying that there is/was a possible workaround?
Quote:
Originally Posted by
BlackBox
I'll check newer versions here to see if they've exposed the subsequent property being requested.
If not, the two options are to either port the earlier code to .NET in entirety, or to write a custom LispFunction Method thereby 'exposing' same.
For reference:
http://docs.autodesk.com/CIV3D/2016/...fdba465699.htm
Thanks
Re: Assigning Layer +Line/Curve Style with .net API
Any chance you can share some info on how to do the same with pipe network layer?
Thanks!