Author Topic: Issue with Layout - Copy Command  (Read 421 times)

0 Members and 1 Guest are viewing this topic.

jnelson

  • Mosquito
  • Posts: 4
Issue with Layout - Copy Command
« on: May 15, 2024, 04:25:52 PM »
I have an existing lisp routine that makes copies of an existing "template" layout one by one using an alphabetized list of layout names.  For example, the "template" layout is named "TEMPLATE" and (to keep things simple) the list of names might be "A", "B", "C", etc.  The "Template" layout name is assigned to the TBLAYOUT variable, and the desired name of the copy is assigned to a variable named MAP.  The code looks like:

(command "layout" "copy" TBLAYOUT MAP)

This works fine, and the new layouts have previously all been arranged together at the bottom of the drawing editor in alphabetical order:

Model/A/B/C/D/E/TEMPLATE

However, beginning with AutoCAD 2019 and now AutoCAD 2024 (we skipped the versions in between) the new layouts do not stay in alphabetical order.  Instead, they may be arranged such as:

Model/C/D/E/TEMPLATE/A/B

This is not a big deal if there are a dozen or so layouts, but sometimes we have over a hundred and they can be annoying to put in order.  We do use Lee Mac's TabSort routine to fix it, but I'd like to get it right the first time, since the list is already in alphabetical order.

Any ideas why this is happening, and is there a simple solution that I'm overlooking?  Thank you.

BIGAL

  • Swamp Rat
  • Posts: 1434
  • 40 + years of using Autocad
Re: Issue with Layout - Copy Command
« Reply #1 on: May 15, 2024, 08:15:24 PM »
Are you copying "Template" each time or last layout name created, may cause odd order.
A man who never made a mistake never made anything

jnelson

  • Mosquito
  • Posts: 4
Re: Issue with Layout - Copy Command
« Reply #2 on: May 16, 2024, 09:16:07 AM »
I'm copying the "Template" layout each time.

BIGAL

  • Swamp Rat
  • Posts: 1434
  • 40 + years of using Autocad
Re: Issue with Layout - Copy Command
« Reply #3 on: May 16, 2024, 09:33:25 PM »
No idea use copy layout a lot, but I am not on 2025, maybe (setvar 'ctab "Template") 1st then do copy layout.
A man who never made a mistake never made anything

jnelson

  • Mosquito
  • Posts: 4
Re: Issue with Layout - Copy Command
« Reply #4 on: May 17, 2024, 10:10:45 AM »
Thank you for the suggestions BIGAL.  Using the code below, I get different results in AutoCAD 2019 vs AutoCAD 2024.

Code: [Select]
(defun laytest (/ LAYLIST TBLAYOUT)
  (setq LAYLIST (list "A" "B" "C" "D" "E" "F" "G"))
  (setq TBLAYOUT "TEMPLATE")
  (foreach MAP laylist (command "LAYOUT" "C" TBLAYOUT MAP))
)

This isn't the code I'm using in my program, but it demonstrates the issue in case anyone wants to try it.  Open a new drawing, rename one of the layouts to be "TEMPLATE", and give it a try (or change the "TEMPLATE" assignment to be "Layout1", etc.).  I've gotten consistently correct results in AutoCAD 2019, and consistently odd results in AutoCAD 2024.  I'm assuming Autodesk changed something along the way that is causing this effect.


ribarm

  • Gator
  • Posts: 3310
  • Marko Ribar, architect
Re: Issue with Layout - Copy Command
« Reply #5 on: May 17, 2024, 10:55:15 AM »
I deleted all Layouts and left Model and Layout1 as CAD could not remove Layout1, then I renamed it to "TEMPLATE" and then I run your sub routine...
I am using AutoCAD 2022 and I got this results shown in picture...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

jnelson

  • Mosquito
  • Posts: 4
Re: Issue with Layout - Copy Command
« Reply #6 on: May 17, 2024, 02:00:31 PM »
Thank you for testing on another version of AutoCAD.  I get the same results as you with ACAD2019, but not ACAD2024.