+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23
  1. #1
    Junior Member
    Computer Details
    mjavy7's Computer Details
    Operating System:
    Win7 Pro 64-bit
    Computer:
    HP-Z200
    Motherboard:
    HP
    CPU:
    3GHz
    RAM:
    4.00GB
    Monitor:
    HD LE2201w
    Using
    AutoCAD 2011
    Join Date
    Dec 2007
    Location
    Palm River Point, Florida
    Posts
    20

    Default Print Tabs Names (or export)

    Registered forum members do not see this ad.

    Hello All.
    I need help with AutoCAD 2013
    I have multiple drawings with 100's of tabs inside, I would like to either export or print out all of the tab names.

    If anyone knows a way to do this, I would love to hear about it.

    Thank you in advanced,
    Javier

  2. #2
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    Here's a simple example for the active document:

    Code:
    (defun c:Tabs ()
      (prompt "\nTab Names: ")
      (foreach layout (layoutlist)
        (print layout)
      )
      (princ)
    )
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    Junior Member
    Computer Details
    mjavy7's Computer Details
    Operating System:
    Win7 Pro 64-bit
    Computer:
    HP-Z200
    Motherboard:
    HP
    CPU:
    3GHz
    RAM:
    4.00GB
    Monitor:
    HD LE2201w
    Using
    AutoCAD 2011
    Join Date
    Dec 2007
    Location
    Palm River Point, Florida
    Posts
    20

    Default

    now how do I use this? LOL
    Sorry man, this is a bit over my head.
    If you could please explain how to use this code, I would highly appreciate it.
    If there is already a place in here were it is explained let me know and I will go there to learn.

  4. #4
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    No worries; we all start somewhere.

    First, to use LISP code posted on forums, simply copy + paste the code into an empty text file, and save with a .LSP file extension. See this tutorial for loading LISP routines.



    After posting that quick sample above, I re-read your post, and saw that you said you're needing to process multiple drawings, so I thought I'd provide a 'Batch Report' routine... Once you've created the LISP file, and loaded the code into your drawing, simply invoke by entering BFINDTABS EXPORTLAYOUT Command.



    [Edit :: 2013-04-19]

    Modified code to allow for Active (current drawing), or Browse (single/multiple drawing) selection.

    I have added a DOSLIB dependency specifically to gain access to multiple file selection offered by DOS_GETFILEM function. Please download DOSLIB here, and use ARXLOAD to load your version's ARX file.

    This modification also provides a LISP callable function BBOX:ExportLayout.

    Multiple miscellaneous items corrected as well, such as non-localized variable, and non-essential code included by mistake when pulling from another routine.

    Additional handling needed for open / read-only Documents.



    Code:
    (vl-load-com)
    
    (defun BBOX:ExportLayout (dwgs / *error* BBOX:GetDate BBOX:GetTime
                                   BBOX:WriteData acApp oDocuments oShell path
                                   filePath dbxDoc file openDoc oLayouts layoutName
                                  )
    
      (defun *error* (msg)
        (if file
          (close file)
        )
        (if oShell
          (vlax-release-object oShell)
        )
        (if dbxDoc
          (vlax-release-object dbxDoc)
        )
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (defun BBOX:GetDate (date)
        (setq date (mapcar '(lambda (x) (itoa x)) date))
        (strcat (nth 0 date) "-" (nth 1 date) "-" (nth 3 date))
      )
    
      (defun BBOX:GetTime (date / hr mn)
        (setq hr (nth 4 date))
        (setq mn (itoa (nth 5 date)))
        (if (= 1 (strlen mn))
          (setq mn (strcat "0" mn))
        )
        (cond ((> 12 hr) (strcat (itoa hr) ":" mn " AM"))
              ((strcat (itoa (- hr 12)) ":" mn " PM"))
        )
      )
    
      (defun BBOX:WriteData (path dwg layoutName file / filePath date)
        (write-line
          (vl-string-right-trim
            ","
            (apply
              'strcat
              (mapcar
                '(lambda (x) (strcat x ","))
                (list (setq filePath (strcat path dwg))
                      (if (setq date (vl-file-systime filePath))
                        (BBOX:GetDate date)
                        "{ Read-Only }"
                      )
                      (if date
                        (BBOX:GetTime date)
                        "{ Read-Only }"
                      )
                      layoutName
                )
              )
            )
          )
          file
        )
      )
    
      (if (and (setq acApp (vlax-get-acad-object))
               (setq oDocuments (vla-get-documents acApp))
               (setq oShell (vla-getinterfaceobject
                              acApp
                              "Shell.Application"
                            )
               )
               (setq path (car dwgs))
               (setq filePath
                      (strcat
                        (vl-filename-directory
                          (vl-filename-mktemp)
                        )
                        "\\Export Layout Report_"
                        (menucmd
                          "M=$(edtime,$(getvar,date),YYYY-MO-DD)"
                        )
                        ".csv"
                      )
               )
               (princ "\nWorking, please wait...")
               (princ)
               (setq dbxDoc (vla-getinterfaceobject
                              acApp
                              (strcat "ObjectDBX.AxDbDocument."
                                      (substr (getvar 'acadver) 1 2)
                              )
                            )
               )
          )
        (progn
          (setq file (open filePath "w"))
          (write-line "Directory Searched:" file)
          (write-line path file)
          (write-line "" file)
          (write-line "Drawing:,Date:,Time:,Layout Name:" file)
          (foreach dwg (cdr dwgs)
            (if (not (vl-catch-all-error-p
                       (setq openDoc (vl-catch-all-apply
                                       'vla-item
                                       (list oDocuments dwg)
                                     )
                       )
                     )
                )
              (setq oLayouts (vla-get-layouts openDoc))
              (progn
                (vl-catch-all-apply
                  'vla-open
                  (list dbxDoc (strcat path dwg))
                )
                (setq oLayouts (vla-get-layouts dbxDoc))
              )
            )
            (vlax-for oLayout oLayouts
              (if (/= "Model" (setq layoutName (vla-get-name oLayout)))
                (BBOX:WriteData path dwg layoutName file)
              )
            )
          )
          (princ "Done.")
          (princ)
          (setq file (close file))
          (vlax-invoke oShell 'open filePath)
          (*error* nil)
        )
        (cond
          (filePath
           (*error*
             "Unable to create \"ObjectDBX.AxDbDocument\" Object"
           )
          )
          (acApp
           (*error* "Unable to create \"Shell.Application\" Object")
          )
        )
      )
    )
    
    (defun c:ExportLayout (/ opt dwgs)
    
      (initget "Active Browse")
      (if
        (not
          (setq opt
                 (getkword
                   "\nWhat drawing would you like to process [Active/Browse]<Active>: "
                 )
          )
        )
         (setq opt "Active")
      )
    
      (cond ((= "Active" opt)
             (if (= 1 (getvar 'dwgtitled))
               (BBOX:ExportLayout
                 (list (getvar 'dwgprefix) (getvar 'dwgname))
               )
               (prompt "\n** Drawing not saved ** ")
             )
            )
            ((= "Browse" opt)
             (if (setq dwgs
                        (dos_getfilem
                          "Select Drawings"
                          (getvar 'dwgprefix)                               ;<-- default path here
                          "Drawing files (*.dwg)|*.dwg"
                        )
                 )
               (BBOX:ExportLayout dwgs)
             )
            )
      )
      (princ)
    )
    Inspired by a favorite routine of mine, BFIND, from Lee.
    Last edited by BlackBox; 19th Apr 2013 at 09:02 pm.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  5. #5
    Junior Member
    Computer Details
    mjavy7's Computer Details
    Operating System:
    Win7 Pro 64-bit
    Computer:
    HP-Z200
    Motherboard:
    HP
    CPU:
    3GHz
    RAM:
    4.00GB
    Monitor:
    HD LE2201w
    Using
    AutoCAD 2011
    Join Date
    Dec 2007
    Location
    Palm River Point, Florida
    Posts
    20

    Default


    You are the man!!
    They both work great but I must say the second one is very impressive!!!
    This is exactly what I need!!!

  6. #6
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    That is kind of you to say; I'm happy to help ... I've had a lot of help along the way.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  7. #7
    Junior Member
    Computer Details
    mjavy7's Computer Details
    Operating System:
    Win7 Pro 64-bit
    Computer:
    HP-Z200
    Motherboard:
    HP
    CPU:
    3GHz
    RAM:
    4.00GB
    Monitor:
    HD LE2201w
    Using
    AutoCAD 2011
    Join Date
    Dec 2007
    Location
    Palm River Point, Florida
    Posts
    20

    Default

    Quote Originally Posted by BlackBox View Post
    Here's a simple example for the active document:

    Code:
    (defun c:Tabs ()
      (prompt "\nTab Names: ")
      (foreach layout (layoutlist)
        (print layout)
      )
      (princ)
    )
    How hard is to make this code export the list to excel like the second code?

  8. #8
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    Quote Originally Posted by mjavy7 View Post
    How hard is to make this code export the list to excel like the second code?
    You mean, where it only prompts for a single drawing, rather than a directory of?

    Or do you mean no prompt at all; as in it only works on the drawing open when invoked?
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  9. #9
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,723

    Default

    A very simplified version

    Code:
    (defun c:Tabs ()
    (setq fname "C:\acadtemp\mytabs")
    (setq fo (open fname "w")) 
     (prompt "\nTab Names: ")
      (foreach layout (layoutlist)
        (print layout)
    (write-line layout fo) 
      )
    (close fo)
      (princ)
    )
    ;just open file mytabs in excel
    A man who never made mistakes never made anything

  10. #10
    Junior Member
    Computer Details
    mjavy7's Computer Details
    Operating System:
    Win7 Pro 64-bit
    Computer:
    HP-Z200
    Motherboard:
    HP
    CPU:
    3GHz
    RAM:
    4.00GB
    Monitor:
    HD LE2201w
    Using
    AutoCAD 2011
    Join Date
    Dec 2007
    Location
    Palm River Point, Florida
    Posts
    20

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by BlackBox View Post
    You mean, where it only prompts for a single drawing, rather than a directory of?

    Or do you mean no prompt at all; as in it only works on the drawing open when invoked?
    Either way it works for me, what ever is easier for you. I can work with either.

Similar Threads

  1. Replies: 21
    Last Post: 14th Jul 2014, 07:04 am
  2. Replies: 7
    Last Post: 28th May 2013, 07:36 am
  3. Replies: 1
    Last Post: 27th Apr 2012, 06:38 am
  4. Lisp routine to print layout tabs and exclude model tab
    By jason_a in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 11th Nov 2010, 08:28 pm
  5. Print Tab Names When Publishing
    By Seann in forum AutoCAD General
    Replies: 12
    Last Post: 11th Sep 2009, 03:39 pm

Tags for this Thread

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