How to run .lxt file in AutoCAD object?

Posted on 2005-04-28
Last Modified: 2012-08-14
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
Question by:stephenlecomptejr
    LVL 17

    Expert Comment

    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
    LVL 1

    Author Comment

    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?
    LVL 10

    Expert Comment

    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.

    LVL 1

    Author Comment

    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.
    LVL 10

    Accepted Solution

    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.

    LVL 1

    Author Comment

    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
    LVL 1

    Author Comment

    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.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Our company has proprietary drawing files that we do not give to our customers for final documentation. Our customers now require that we give them these drawings. They understand that they are proprietary and do not require them to be in AutoCAD bu…
    The following article will describe how to add/edit a dimension style through AutoCAD VBA. AutoCAD VBA has its quirks and when it comes to dimensions and controlling how they look through VBA.  This is where AutoCAD can be vividly confusing. The…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now