See the top rated post in this thread. Click here

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

Thread: Get Layout Name of Blocks?

  1. #21
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    You are getting that automation error due to recreating the same layout name since that it is already existed , so to work around this and to work around the order of numbering layouts as long as them are numbers ONLY .

    Code:
    (setq i   0
          n   1
          doc (vla-get-activedocument (vlax-get-acad-object))
    )
    (foreach x (layoutlist)
      (while (member (itoa (setq i (1+ i))) (layoutlist)))
      (vla-put-name
        (vla-item (vla-get-layouts doc) x)
        i
      )
    )
    
    (foreach lay
             (vl-sort (layoutlist) '(lambda (j k) (< (atoi j) (atoi k))))
      (vla-put-taborder (vla-item (vla-get-layouts doc) lay) n)
      (setq n (1+ n))
    )

  2. #22
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Trying something like this, but I get all sorts of errors. It would probably help if I knew a little VL...

    Code:
    (setq  i   0
            n   1
          doc (vla-get-activedocument (vlax-get-acad-object))
    )
    (foreach x (layoutlist)
      (vla-put-name
        (vla-item (vl-sort '(vla-get-layouts doc) '<) x)
        (itoa (setq i (1+ i)))
      )
    )

  3. #23
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Quote Originally Posted by Tharwat View Post
    You are getting that automation error due to recreating the same layout name since that it is already existed , so to work around this and to work around the order of numbering layouts as long as them are numbers ONLY .

    Code:
    (setq i   0
          n   1
          doc (vla-get-activedocument (vlax-get-acad-object))
    )
    (foreach x (layoutlist)
      (while (member (itoa (setq i (1+ i))) (layoutlist)))
      (vla-put-name
        (vla-item (vla-get-layouts doc) x)
        i
      )
    )
    
    (foreach lay
             (vl-sort (layoutlist) '(lambda (j k) (< (atoi j) (atoi k))))
      (vla-put-taborder (vla-item (vla-get-layouts doc) lay) n)
      (setq n (1+ n))
    )
    This continues the numbering, so layouts 1-10 become 11-20. And it reorders the sheets - the old sheet "10" (the last sheet) became sheet "12" in the second layout position...

    On an up note, I have been messing with vl-sort, so I don't think I'm too far off base

  4. #24
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Read about functions to know what each function returns , so you would know how to deal with them.

    VLA-GET-LAYOUTS
    VL-SORT

  5. #25
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Would it make sense programatically to overwrite the layouts with placeholder names (a, b, c, d, etc.) to prevent "Layout exists" errors, then sort the layoutlist, then rename with the numbers? We would never have more than 26 sheets in a drawing.

  6. #26
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,515
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Quote Originally Posted by Tharwat View Post
    Read about functions to know what each function returns , so you would know how to deal with them.

    VLA-GET-LAYOUTS
    VL-SORT
    I can't find any documentation for VLA-GET-LAYOUTS

  7. #27
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Get Layout Name of Blocks?

    Quote Originally Posted by stusic View Post
    I can't find any documentation for VLA-GET-LAYOUTS
    Few different ways....

    Highlight the function in VLIDE and hit Help button, which should launch the ActiveX Help.

    Go here, and click on Layouts.

    Or one of my favorites for some years (before the new Help system included such), was to go here, and click on Layouts.



    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Sheet layout editor, and dimension lines layout
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2014-01-13, 12:51 PM
  2. Layout tabs names change when layout renamed in SSM
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-01-20, 05:07 AM
  3. Blocks in current layout
    By timlane in forum VBA/COM Interop
    Replies: 3
    Last Post: 2009-03-26, 07:37 PM
  4. Replies: 3
    Last Post: 2008-01-17, 01:08 PM
  5. Annotative Blocks - Match block orientation to layout
    By verns in forum AutoCAD Annotation
    Replies: 8
    Last Post: 2007-04-19, 09:51 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
  •