+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2010
    Posts
    86

    Default C3D Alignment Length Report

    Registered forum members do not see this ad.

    Hi

    I am trying to use this report:

    http://blog.civil3dreminders.com/2012/03/alignment​-length-report.html

    But these files seem to be for C3D 2011, and will not work with 2012. There is something at the end explaining what to do if you are using a diff version of C3D. I am just wondering if there is anyone that could adjust the files so it works in 2012? I am really not any good at VBA. Too confusing.

    Cheers
    Martin

  2. #2
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x86
    CPU:
    Pentium(R) Dual-Core CPU E5500 @ 2.80GHz
    RAM:
    4 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    ThinkVision 22"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2011
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    9,134
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  3. #3
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2010
    Posts
    86

    Default

    Yes, I downloaded and installed it.

  4. #4
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Guys,

    The author originally wrote the code in VBA.

    The blog post linked above demonstrates how to accomplish a similar plug-in using VB.NET (hence the Visual Studio screenshots). The VBA module is not needed.

    Quote Originally Posted by bigmaz View Post
    But these files seem to be for C3D 2011, and will not work with 2012. There is something at the end explaining what to do if you are using a diff version of C3D. I am just wondering if there is anyone that could adjust the files so it works in 2012? I am really not any good at VBA. Too confusing.
    Actually, the plug-in works exactly as advertised... Just tested using Civil 3D 2012... I personally think it's more work than is necessary (using the Microsoft.Office.Interop.Excel Library, when writing to a simple CSV would work), but still, it works.
    Last edited by BlackBox; 29th Aug 2012 at 07:37 pm.
    "Potential has a shelf life." - Margaret Atwood

  5. #5
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    ... Also, FWIW - I *believe* that since this was done via ActiveX COM API originally, that there's still a means to do this with Visual LISP (which also uses ActiveX COM API).

    Look into the AeccXUiLand.AeccApplication Object:

    Code:
    (vl-load-com)
    
    (defun c:C3dComApi (/ file)
      (if
        (setq
            file (findfile
                   (strcat
                     (vl-registry-read
                       (strcat "HKEY_LOCAL_MACHINE\\"
                               (if vlax-user-product-key                    ; If 2013
                                 (vlax-user-product-key)                    ; Use 2013 function
                                 (vlax-product-key)                         ; Use legacy function
                               )
                       )
                       "ACADLOCATION"
                     )
                     "\\help\\civil_api_activex_reference.chm"
                   )
                 )
          )
        (startapp "explorer" file)
        (prompt "\n** File not found ** ")
      )
      (princ)
    )
    "Potential has a shelf life." - Margaret Atwood

  6. #6
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Here's a recent (albeit unrelated) example, see post #4:

    http://www.theswamp.org/index.php?topic=42585.0
    "Potential has a shelf life." - Margaret Atwood

  7. #7
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2010
    Posts
    86

    Default

    When I try and run the program, it gives me this error:

    alignerror.PNG

  8. #8
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    ct_net.cannot.find.file.png

    ... That's because the plug-in has a reference to the Microsoft.Office.Interop.Excel Library, and it (the dependent reference) cannot be found on your system. I'll see what I can do to provide an adaptation that does not have this dependency, and instead uses basic .CSV instead.
    "Potential has a shelf life." - Margaret Atwood

  9. #9
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2010
    Posts
    86

    Default

    Quote Originally Posted by RenderMan View Post
    Attachment 36852

    ... That's because the plug-in has a reference to the Microsoft.Office.Interop.Excel Library, and it (the dependent reference) cannot be found on your system. I'll see what I can do to provide an adaptation that does not have this dependency, and instead uses basic .CSV instead.
    That would be fantastic, thank you very much for your help

  10. #10
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,951

    Default

    Registered forum members do not see this ad.

    I love it when something is simpler than I thought it would be... It seems that Autodesk was kind enough to expose the Alignment Object Properties to Visual LISP; no AeccXUiLand.AeccApplication Interface Object required for this task.

    Enjoy!

    Code:
    (vl-load-com)
    
    (defun c:ALR () (c:AlignmentsLengthReport))
    (defun c:AlignmentsLengthReport (/ *error*)
      (princ "\rALIGNMENTSLENGTHREPORT ")
    
      (defun *error* (msg)
        (if file
          (close file)
        )
        (if oShell
          (vlax-release-object oShell)
        )
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** " msg " ** ")))                         ; Fatal error, display it
        )
        (princ)
      )
    
      ((lambda (acApp / ss oShell filePath file alignmentName alignmentLength)
         (if (and (setq ss (ssget "_x" '((0 . "AECC_ALIGNMENT"))))
                  (setq oShell (vla-getinterfaceobject
                                 acApp
                                 "Shell.Application"
                               )
                  )
                  (setq filePath
                         (strcat
                           (vl-filename-directory
                             (vl-filename-mktemp)
                           )
                           "\\Alignments Length Report_"
                           (menucmd
                             "M=$(edtime,$(getvar,date),YYYY-MO-DD)"
                           )
                           ".csv"
                         )
                  )
                  (princ "\nWorking, please wait... ")
                  (princ)
             )
           (progn
             (setq file (open filePath "w"))
             (write-line "Civil 3D Drawing:" file)
             (write-line
               (strcat (getvar 'dwgprefix) (getvar 'dwgname))
               file
             )
             (write-line "" file)
             (write-line "Alignment Name:,Length:" file)
             (vlax-for x (setq ss (vla-get-activeselectionset (vla-get-activedocument acApp)))
               (if (and (setq alignmentName (vlax-get x 'name))
                        (setq alignmentLength (rtos (vlax-get x 'length)))
                   )
                 (write-line (strcat alignmentName "," alignmentLength) file)
               )
             )
             (vla-delete ss)
             (princ "Done.")
             (setq file (close file))
             (vlax-invoke oShell 'open filePath)
             (*error* nil)
           )
           (cond
             (ss
              (*error*
                "Error: Unable to create \"Shell.Application\" Object"
              )
             )
             ((*error* "No alignments found"))
           )
    
         )
       )
        (vlax-get-acad-object)
      )
    )
    Last edited by BlackBox; 1st Sep 2012 at 09:21 pm.
    "Potential has a shelf life." - Margaret Atwood

Similar Threads

  1. Replies: 6
    Last Post: 11th Sep 2012, 08:20 pm
  2. Replies: 2
    Last Post: 11th Oct 2011, 12:41 pm
  3. Need Lisp to create stock length with Lap length
    By rajeshmuthu in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 2nd Oct 2011, 06:10 pm
  4. Replies: 0
    Last Post: 27th Jul 2011, 10:30 am
  5. Simulation report
    By joes in forum SolidWorks
    Replies: 9
    Last Post: 12th May 2009, 03:29 pm

Bookmarks

Posting Permissions

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