See the top rated post in this thread. Click here

Results 1 to 10 of 28

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,538
    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 3630, Core i9-9900K 5.0GHz, 128GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

Similar Threads

  1. Replies: 3
    Last Post: 2012-12-19, 03:00 PM
  2. Custom Line Style Manager to Simplify Line Style Creation
    By autocad.wishlist1734 in forum AutoCAD Wish List
    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
  •