Tharwat Posted July 15, 2010 Posted July 15, 2010 Hi why there are Lisp functions working in a specific Autocad versions and in other versions do not work with ...... ????? regards Tharwat Quote
The Buzzard Posted July 15, 2010 Posted July 15, 2010 Hi why there are Lisp functions working in a specific Autocad versions and in other versions do not work with ...... ????? regards Tharwat This is because in the newer versions of AutoCAD the addition of new commands, sub-commands and system variables not found in the older versions. This is why it is better to use entmake for example instead of using command calls. Another example is the Purge command which has the sub-command REGAPP which is not in the older versions. Trying to do a careful study when making programs for various versions sometimes is not easy. Quote
alanjt Posted July 16, 2010 Posted July 16, 2010 I think Fillet was another example where the options changed. In a situation where you do use command, it is best to always account for language and re/undefined commands and always spell out the entire option. eg. (command "_.fillet" "_radius" 3.) Quote
BIGAL Posted July 16, 2010 Posted July 16, 2010 Are you writing for only Autocad had some problems with Intellicad it did not like the way I did some things had to very subtly change the code. Same with lisp on a mac real old. Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 I think Fillet was another example where the options changed.In a situation where you do use command, it is best to always account for language and re/undefined commands and always spell out the entire option. eg. (command "_.fillet" "_radius" 3.) You could of done this: (setvar "filletrad" 3.0) (command "._fillet" pause) Here is an example of what I meant: AutoCAD 2004 Command: -purge Enter type of unused objects to purge [blocks/Dimstyles/LAyers/LTypes/Plotstyles/SHapes/textSTyles/Mlinestyles/All]: AutoCAD 2009 Command: -purge Enter type of unused objects to purge [blocks/Dimstyles/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/ textSTyles/Mlinestyles/Tablestyles/Visualstyles/Regapps/All]: See the difference in the options available. AutoCAD 2009 has MAterials, MUltileaderstyles, Tablestyles, Visualstyles & Regapps where AutoCAD 2004 does not. When I make codes, It pays to indicate the versions the code was tested on and also indicate it may or maynot work on previous or future versions to cover yourself from embarassment. In some instances a command or variable could be obsolete in future versions or a new command or variable made available that was not in an earlier version. There is not much you can do about it, But it does pay to try and reseach as much as you can before implementing your code. If you are unsure, Then use the statement above in your code header. I have the two mentioned versions above and this still may not cover me. Quote
hunszab Posted July 16, 2010 Posted July 16, 2010 Hi everyone! Here is my problem: I want to write a lisp program that loads automatically a menu file (mns) and runs 2 macros. Could anyone help my out, please! Thanks for any answers! Best regards Quote
Tharwat Posted July 16, 2010 Author Posted July 16, 2010 Hi everyone! Here is my problem: I want to write a lisp program that loads automatically a menu file (mns) and runs 2 macros. Could anyone help my out, please! Thanks for any answers! Best regards You'd better to start with new thread in the forum, so that would give the chance to all members to read your request and could help you better. Welcome to CadTutor Tharwat Quote
Tharwat Posted July 16, 2010 Author Posted July 16, 2010 Hi How can I follow up the changes of Sys Vars in Cad versions, beside that,the old Cad's versions commands behaviour ..... ? So how can I guarrantee that the codes I gonna write will perform as it should be ? Best regards, Tharwat Quote
manirpg Posted July 16, 2010 Posted July 16, 2010 Hi Hunszab, Welcome to our forum......... Its very easy....just u find your mns file and place your lisp.. for macros u can create Toolbar buttons and save it there...... Now both lisp and macros working automatically always......... find your mns file path..........steps Options file search file path (see here) Regards Mani Quote
hunszab Posted July 16, 2010 Posted July 16, 2010 Hi! Thanks your answer. But I still have the problem,because: I know how to load menufile and lisp file BUT the users who have to use the menu, and load the menu dont So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros desabled, the macros wont run automatically I've allready opened a new topic: Menus and macros Thanks your answer! Hi Hunszab,Welcome to our forum......... Its very easy....just u find your mns file and place your lisp.. for macros u can create Toolbar buttons and save it there...... Now both lisp and macros working automatically always......... find your mns file path..........steps Options file search file path (see here) Regards Mani Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 Hi How can I follow up the changes of Sys Vars in Cad versions, beside that,the old Cad's versions commands behaviour ..... ? So how can I guarrantee that the codes I gonna write will perform as it should be ? Best regards, Tharwat You really cannot garantee anything when you write codes for AutoCAD. There is no telling what the future holds. Do the best you can with the version you got or inquire from someone who has a newer version. As I mentioned before: When I make codes, It pays to indicate the versions the code was tested on and also indicate it may or maynot work on previous or future versions to cover yourself from embarassment. In some instances a command or variable could be obsolete in future versions or a new command or variable made available that was not in an earlier version. Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 Hi!Thanks your answer. But I still have the problem,because: I know how to load menufile and lisp file BUT the users who have to use the menu, and load the menu dont So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros desabled, the macros wont run automatically I've allready opened a new topic: Menus and macros Thanks your answer! Folks, please start a new thread. This thread is with regard to a different subject than yours. Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 I am not sure, But you may be able to get a PDF copy of future releases from Autodesk or purchase second & third party books. The internet is another great source. Quote
Tharwat Posted July 16, 2010 Author Posted July 16, 2010 I am not sure, But you may be able to get a PDF copy of future releases from Autodesk or purchase second & third party books. The internet is another great source. Yahha that's what I had in mind. In future versions we may could follow up with them, but the problem with the previous versions commands and Sys Vars . Any other direct solutions .....? Thank you Buzzard. Tharwat Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 Yahha that's what I had in mind. In future versions we may could follow up with them, but the problem with the previous versions commands and Sys Vars . Any other direct solutions .....? Thank you Buzzard. Tharwat When it comes to making objects or creating layers linetypes and so on you can use entmake instead of a command call. Where entmake does not apply the previous rule of thumb I mentioned may have to apply unless someone has a better answer. You can always change versions every so many years, But I feel it is overkill updating every year. I kept my old version of 2004 which I like very much. Since I got my new CAD system, I am using 2009 alot more than before. You will probably find where commands are concerned, It is the sub-commands that seem to be changed or added in future releases more often. Of course the system variable changes are hard to keep track of. I would say that Visual Lisp would be another way, But I have seen codes made with it that are affected as well. One sure way is to learn C++, But I am not ready to go there yet. Quote
Tharwat Posted July 16, 2010 Author Posted July 16, 2010 I would say that Visual Lisp would be another way, But I have seen codes made with it that are affected as well. One sure way is to learn C++, But I am not ready to go there yet. I have read a post before says, it's a powerful knowledge to know c++ with Lisp together in writing codes for Autocad. Any small hint about the relationship between c++ and Lisp ? Thanking you Tharwat Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 I have read a post before says, it's a powerful knowledge to know c++ with Lisp together in writing codes for Autocad. Any small hint about the relationship between c++ and Lisp ? Thanking you Tharwat AutoCAD itself is written in C++, But please bear in mind that there is not much you can do about AutoCAD structure changes with the elimination or adding of commands and variables. You cannot make a code do something with command calls if it does not exist in one version or the other. I believe there are methods in C++ that could make AutoCAD from various versions work somewhat more uniform, But there could be small issues with things that do or do not exist in these versions or the way they were designed to work. Nothing is foolproof. Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 Here is an explanation of the various APIs that work with AutoCAD. See this link:http://www.afralisp.net/archive/vba/api.htm Quote
Tharwat Posted July 16, 2010 Author Posted July 16, 2010 please bear in mind that there is not much you can do about AutoCAD structure changes with the elimination or adding of commands and variables. You cannot make a code do something with command calls if it does not exist in one version or the other. :D Nothing is foolproof. I do not have plans to change the structures of Autocad, I just want to be well known with Lisp with no traps or mistakes of codes that might perform or understand codes according to its version . Shouldn't we take our precautions and tools to keep on running in the right a rail with programming ? Thanks. Tharwat Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 I do not have plans to change the structures of Autocad, I just want to be well known with Lisp with no traps or mistakes of codes that might perform or understand codes according to its version . Shouldn't we take our precautions and tools to keep on running in the right a rail with programming ? Thanks. Tharwat What is it that you are trying to do? Its seems most codes written will work in many versions. Like it or not, You will run into those few exceptions where it will work in one and not the other. You cannot change this fact. Its just the way AutoCAD was written for the version. Software evolves over time adding new features you will not find in older versions. Just get use to idea. Quote
Recommended Posts
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.