Results 1 to 3 of 3

Thread: Iterate through all layout and rename them from left to right

  1. #1
    Member
    Join Date
    2021-11
    Posts
    3
    Login to Give a bone
    0

    Default Iterate through all layout and rename them from left to right

    Hello everyone, I'm using Autocad api and C# to create an addin on autocad. I want to list all layout name to listbox then rename them begin 01 (ex. 01, 02, 03...) from left to right but when I create new layout (layout1) and move it to top, the list box show all layouts names no change by oder from left to right. Anyone give me an idea please? Thanks!
    Attached Images Attached Images

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

    Default Re: Iterate through all layout and rename them from left to right

    When populating your Form's 'Layout list' pane, you're likely getting the Layout names from the ACAD_LAYOUT Dictionary, without first sorting by Layout.TabOrder (Int).

    If your Form's modeless and want it to update dynamically, then you'll need to hook the LayoutManager.LayoutsReordered Event.

    Cheers
    "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

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

    Default Re: Iterate through all layout and rename them from left to right

    Duplicate thread:

    https://forums.autodesk.com/t5/net/i.../td-p/10757309


    Perhaps OrderBy() will help:

    Code:
    layoutList.OrderBy(x => x.TabOrder).ToList();
    "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

Similar Threads

  1. Replies: 0
    Last Post: 2014-11-30, 01:16 PM
  2. Replies: 0
    Last Post: 2012-03-02, 09:18 PM
  3. how to iterate groups not in projectbrowser
    By hr.193732 in forum Revit - API
    Replies: 3
    Last Post: 2008-09-05, 01:48 PM
  4. AutoCAD 2008 - Iterate through an entity list
    By cgerhardt in forum AutoLISP
    Replies: 1
    Last Post: 2007-04-30, 06:21 AM
  5. How can I Iterate the AcadLine object
    By avinash00002002 in forum VBA/COM Interop
    Replies: 4
    Last Post: 2006-06-20, 03:18 AM

Tags for this Thread

Posting Permissions

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