How to run .lxt file in AutoCAD object?

I've got the following code to run a script file - How can I run a .lxt file in AutoCAD with the same procedure?

            Set acDocument = acadapp.Documents.Open(myItem)
            acadapp.Visible = True
            Set acDocument = acadapp.ActiveDocument
            acDocument.SetVariable "filedia", 0
            acDocument.SendCommand "script" & vbCr & txtScript1 & vbCr
            Set acDocument = Nothing
Who is Participating?
norrin_raddConnect With a Mentor Commented:
this is all going to be way off topic unless you figure out a way to import your layer settings/dimstyles from the template files, but here is a basic overview. well, a template file is basically just a drawing the you create with the standard things that you want for all your dwgs. There is another file typ to called a drawing standard file (dws) that you can use to set up a standardized set of conditions in your dwgs.
All you have to do is set the dwg up one time ie correct layers w/ linetypes, colors etc.. correct dims, layouts and even blocks if you want.(I keep my blocks seperated though). Then save it as a dwt or even a dws. You may want to investigate the `CAD standard commands' in the help files for a better explanation of the way you can set that up, your cad manager may be interested in checking those out too, autocad will give you little pop ups that warn of standard violations. All that may reduce the need to set up your dwgs programically and make it easier to implement standards revisions.

As far as dimscales, the way people use dims is as unique as the nose on there face, in my experiences anyway.
I set up a dimstyle that looked the way I wanted for a dwg of 1:1 scale then I just copied it and changed the dimscale to some standard sizes. I try to keep my drawings to scales that I can in find on a typical engineer scale ex 10,20,...or 100,200 and I give them simple names that fit the scale 100_Eng.. Using this method I've been able to keep my dims looking consistant on all my prints.
I can also drag and drop them from my template file in the design center with ease if I have to.
 Then some block insertion routines that I created insert blocks with the scales based on the current dimscale, so having the correct dimscale is the base for alot of things the way I'm set up now.

hope that helps because right now I really dont know anything about .lxt files.

dhsindyRetired considering supplemental income.Commented:
AutoCAD script files have extension '.scr' and can be used in variety of ways.  It can be run as the file is opened, while in the file is open, and can run in a loop as a slide show, etc. - what does your script do or what programing language is it written it.

It seem to be valid.  I put the script in an ASCII file with Notepad and renamed the extension to '.scr'.  I opened an AutoCAD file and ran your script.  It gave an error it couldn't find the file - it was looking for a file with the same name as my open file with a '.scr' extension - which is typical.  Your program seems to assume there is a script file that matches your file name.

The program may be written in Diesel (like the fuel) which is a newer AutoCAD programming language.

Hope this helps, dhs
stephenlecomptejrAuthor Commented:
Thanks for trying to answer my post, but the question highlighted is How to run a .lxt file?  I know the above coding is to run a .scr script but my question was how I could do the same running a .lxt file?  I haven't even seen too much info on the AutoDesk discussion website on them.  .lxt files are what store layer settings and usually a script file runs through and looks through the .lxt file to convert layers on a drawing.  Any vba coding to show how to convert layers in a drawing?
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

hey stephen,
this is not an attempt to get you to change the way you are doing things.
 But have you looked at using template files that are set up the way you want them? Just curious, I noticed your other question about the dimscales in the lsp, seems like alot to set up a file. But I know you are doing some things through access and you may feel comfortable doing things like that, I just had to ask, I'm not trying to be arrogant or anything.
wish I could help you on that lisp thing.

stephenlecomptejrAuthor Commented:
Well, actually I really do agree with you about getting it all in AutoCAD.
I will get a chance to do that in the near future.
Could you give me a more detailed explanation as to how template files are setup?
Like what would be a best practice to set your dim scales?

Just an FYI - The lisp thing is purely AutoCAD has nothing to do with running anything in VBA or Access.
The lisp routine was a question from my CAD manager.
stephenlecomptejrAuthor Commented:
thank you always for your replies, Norrin.  I appreciate it.

When you get a chance, check this thread out.

I think .lxt files are used similiar to a layering template from which to change layers.
It's a real old method.

This is the only search I could find in Autodesk groups just merely searching .lxt
stephenlecomptejrAuthor Commented:
Just an FYI from my Cad Manager:

the reason why we have to use lxt file is because we are still on
2000i. Once we go to 2006 we don't have to use it, but until then we
stuck because the dws file don't exist in 2000i. Some of the people in
group are assuming that we are on the latest and greatest AutoCAD.
for looking for an answer though.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.