Jump to content

Recommended Posts

Posted

(layoutlist) is an external Object ARX function I think - so you never know...

  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

  • Watson

    21

  • Lee Mac

    14

  • Freerefill

    11

  • Hardeight

    1

Posted

Very good point, Lee.

 

Watson, try typing "ARX" to the command line and seeing if that gives you some options. If it does, then there should be a way to get (layoutlist) loaded onto AutoCAD LT, if it's not already. If "ARX" works, try typing "(layoutlist)". If that works...

 

I don't think there's a script-version way of sorting the (layoutlist) alphabetically, like there is with VLA. Which means, even if it does work, it would be all but impossible to pick and choose what tabs you want.. the only way to guarantee fluid success is to apply it to all tabs, which may or may not be possible (then again, perhaps a check could be built into the script.. that's certainly an option..).

 

So if (layoutlist) does work, then it follows, we need a way to extract each bit of data individually. If (nth) is not allowed in LT, the only other option I can think of would be to somehow manipulate the data and send each bit to a text file.. if that can be done, preferably where each layout name is on a new line, then it can easily be read with a .bat file, and incorporated using "CTAB" into the existing script-creation .bat.

 

But that's the tricky part.. getting the data from (layoutlist) into a form readable, manipulatable using a .bat file. I don't know if you can (write-line) using LT, but I believe AutoCAD has external commands, like "TYPE" and "START" that basically send information to the Windows command prompt. You'd have to modify the acad.pgp file, I think, to include "ECHO". If you can do that, you can write from AutoCAD to the command line and directly there to a text file, which means you can send the output from (layoutlist) to a text file...

Posted

Some good ideas there - but it does seem like a lot of effort and faffing around for very little gain...

 

I doubt that (layoutlist) will work tbh, even if it is an ARX function, I would think it is using LISP to invoke it - but I could be wrong.

 

And even if it does work, as you point out, trying to get the data in a manageable form is task and a half without LISP as the (layoutlist) function will return in LISP format.

 

Just my thoughts on this.

 

Lee

Posted

You're absolutely right, Lee.. and I do agree, the ever-present debate between, "How much time is this going to save?" and "How much time is this going to take?" is certainly leaning toward the latter now.

 

Ultimately though, I consider it a personal challenge, mainly since I've yet to see it done. Even if he came back today and said, "Nevermind, we're just going to get the full version of AutoCAD", I'd still desire to see this accomplished.

 

Searching for an answer and finding one are two of my greatest joys in life. Having that answer be useful is always nice but, meh. ^^'

Posted

I can see your point - but with LT, I just can't be bothered with it tbh :geek:

Posted

Here is the code that ended up working:

@echo Enter your template information into the fields below:
@echo off
set /p input1=01AREA 1 
set /p input2=01REP 1 
set /p input3=01DEALER 1 
set /p input4=01BY 1 
set /p input5=01DATE 1 
set /p input6=01PC 1 
set /p input7=01DWG 1 
echo [b]CTAB[/b]> C:\SORT.SCR
echo [b]F-1[/b]>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01AREA ^1>> C:\SORT.SCR
echo 01AREA ^1>> C:\SORT.SCR
echo %input1%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01REP ^1>> C:\SORT.SCR
echo 01REP ^1>> C:\SORT.SCR
echo %input2%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01DEALER ^1>> C:\SORT.SCR
echo 01DEALER ^1>> C:\SORT.SCR
echo %input3%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01BY ^1>> C:\SORT.SCR
echo 01BY ^1>> C:\SORT.SCR
echo %input4%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01DATE ^1>> C:\SORT.SCR
echo 01DATE ^1>> C:\SORT.SCR
echo %input5%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01PC ^1>> C:\SORT.SCR
echo 01PC ^1>> C:\SORT.SCR
echo %input6%>> C:\SORT.SCR
echo -ATTEDIT>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo N>> C:\SORT.SCR
echo A$C49561ED3>> C:\SORT.SCR
echo AAAA>> C:\SORT.SCR
echo 01DWG ^1>> C:\SORT.SCR
echo 01DWG ^1>> C:\SORT.SCR
echo %input7%>> C:\SORT.SCR
echo [b]CTAB[/b]>> C:\SORT.SCR
echo [b]F-2[/b]>> C:\SORT.SCR

 

etc, etc...

 

There are (10) tabs in our template, F-1 through F-10, so it was just a matter of writing the code to cycle through them all, which happens pretty quickly. Waaaaay faster than using find\replace for all the fields like we were doinf.

 

Now I need to research adding the .BAT to my PGP file...

Posted

haha, I'm very glad it worked for you. Just goes to show that I'm not completely useless after all. ^.^

 

But wow, what a chunk of code. All that for one tab out of ten.. Well, at least no one has to look at it again, the just have to run it. ^^ That's the nice thing about code. Once it's done and it's working, you can close your editor, take a deep, cleansing breath, and actually use that which you've spent hours, days, or even weeks slaving over. ^^

 

I'm afraid I don't know anything about PGP so this is where we part ways, but I wish you the best of luck. ^^

 

Oh, I should mention one thing. If you can find a way to pause a script file, then you can create a script file to run the .bat, then run the script. It might be more trouble than it's worth, but it would make it so that you only have to open and run one thing.

 

You can run .bat files in AutoCAD using "RUN", so long as it's recognized as an external command. Check the acad.pgp section for external commands, you should see something like this:

 

DEL, DEL, 8,File to delete: ,

DIR, DIR, 8,File specification: ,

SH, , 1,*OS Command: ,

SHELL, , 1,*OS Command: ,

START, START, 1,*Application to start: ,

TYPE, TYPE, 8,File to list: ,

 

Just add the line:

 

RUN, RUN, 8,File to run: ,

 

to the end. Either restart AutoCAD or run "REINIT" to refresh it, then you can use "RUN". You can then put that into a script as:

 

RUN "C:\\file.filetype"

 

and it'll do exactly as you'd think. If you made a script like:

 

RUN "C:\\batfile.bat"

SCRIPT "C:\\scriptfile.scr"

 

Then you just run the script. I just don't know how to pause it, that's the only thing. Well, enough to get you thinking, at least.

 

Cheers, and congrats on making your life a little easier. ^^

Posted

Yeah, I already figured out the PGP file. I had to copy the batch file to C:\... I set it up the PGP so you just enter "SORT" into the command line and *BAM* the window pops up for you to enter all the fields.

 

The only thing I'd like to change in the application of the file now is the disconnect between the batch file and the script.... so you type in "SORT", enter your info, the box goes away, then you have to type "Script" and select the .SCR. If there was a way to have the batch file launch the script immediately after you entered your fields, that would be sweet... regardless, what I have now is working way better than what we had before.

 

Thanks for all your help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...