See the top rated post in this thread. Click here

Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Assigning Layer +Line/Curve Style with .net API

  1. #21
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,440
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Quote Originally Posted by Opie View Post
    BTW, BB, the code you posted above for version checking of C3D could be automated to detect the active version of Civil 3D.
    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
    Last edited by BlackBox; 2015-10-13 at 05:31 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  2. #22
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    265
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Quote Originally Posted by Opie View Post
    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 View Post
    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. 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

  3. #23
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    8,405
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Quote Originally Posted by BlackBox View Post
    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.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  4. #24
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,440
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Quote Originally Posted by Opie View Post
    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 View Post
    ... 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 View Post
    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
    Last edited by BlackBox; 2015-10-14 at 05:44 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  5. #25
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,440
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Quote Originally Posted by Opie View Post
    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
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  6. #26
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    265
    Login to Give a bone
    0

    Default Re: Assigning Layer +Line/Curve Style with .net API

    Is there any update on this?

    Thanks

  7. #27
    I could stop if I wanted to
    Join Date
    2015-05
    Location
    West Des Moines
    Posts
    265
    Login to Give a bone
    0

    Default 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 View Post
    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

  8. #28
    Woo! Hoo! my 1st post
    Join Date
    2002-05
    Posts
    1
    Login to Give a bone
    0

    Default 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!

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 3
    Last Post: 2012-12-19, 03:00 PM
  2. Replies: 0
    Last Post: 2008-01-09, 09:21 PM
  3. Assigning Elevation to a Layer
    By ljupadhyay in forum ACA General
    Replies: 6
    Last Post: 2007-04-24, 07:28 PM
  4. Assigning Elevation to a Layer
    By ljupadhyay in forum ACA Wish List
    Replies: 1
    Last Post: 2007-04-24, 05:03 PM
  5. assigning layer key to new all style?
    By vanderloo5 in forum ACA General
    Replies: 0
    Last Post: 2005-06-28, 03:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •