sherby88 Posted November 10, 2011 Share Posted November 10, 2011 Hi, I want to learn autocad programming, and started looking into autolisp and visual lisp.I want to create objects so i can use them for work. Is it posible to create objects that have custom properties like for example walls, reinforcement bars etc. that have unique attributes/properties that can be used to create a table or even edit them? And also to be able to double click or select them and bring a custom dialog up (objectdcl or opendcl) with those properties so i can modifie them? (this is not absolutly necesary) Or this kind of programming can only be achieved using objectARX, VBA, NET? thx Quote Link to comment Share on other sites More sharing options...
sherby88 Posted November 10, 2011 Author Share Posted November 10, 2011 The objects i had in mind for the beggining are not complex, i was thinking in a polyline with leaders and dimensions atached to them and with extra attributes for the info i need from them for tables and after i learn them good enough to make some 3d objects using them or if its easier to create blocks and modify them using lisp and link them using reactors. The reasons i ask these questions are because: i have a good idea of what i want but i dont know what is the best way to go or if its posible with every language. thx Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 10, 2011 Share Posted November 10, 2011 Sounds like you could do this with a dynamic block. Quote Link to comment Share on other sites More sharing options...
JohnM Posted November 10, 2011 Share Posted November 10, 2011 You cannot create a custom complex object with lisp or vlisp. Depending on what you want to accomplish you can attach data to objects using block attributes, xdata, xrecord or writing the info to a file. If you just want to read and write data that’s is typically no problem but if you want to change the geometry of an object then it all depends on the type of change and how good you are writing code. I would suggest writing out the whole thing in pseudo code first. Pseudo code is just plain words on paper like an outline. Write down a step by step in as much detail as possible and also sketch out any dialog boxes. This will help you understand the flow of the project and you will be able to see problem areas and then find answers for the issues. Example of pseudo code The user starts my program Ask the user to pick 2 points Create a line using users 2 points Display a dialog box so user can enter data Dialog box has 2 text boxes for questions (name and date) Get dialog box data Use data to attach xdata to line End program. Now go back through the pseudo code and make it more detailed if needed and make notes on any questions you might have to research. Good programming starts with good planning It is better to spend hours on planning that to spend hours trying to find mistakes in thousands of lines of code. Quote Link to comment Share on other sites More sharing options...
sherby88 Posted November 10, 2011 Author Share Posted November 10, 2011 thx for the answer I dont want to create something complex, because i dont have the time for something too complex and time consumming. I'm am structural engineer, not a programmer by profession, but at my company we use generic autocad, not software design for structural detailing, and we dont have interest and money for buying dedicated software because they cost too much. I only want to speed up the drawings and automate tables process. At first i wanted to use blocks and using lisp to edit the blocks and the attributes in them. The only thing i want to know is if i can use lisp to link objects togheter si for example the most important thing i want is: - I have 3 diffrent objects with their custom properties and if i change one of them they change in other places and in the tables ( for example I number my lines, and these numbers are in 3 to 10 diffrent palces on the drawings). Can I use reactors for this or something? Quote Link to comment Share on other sites More sharing options...
LibertyOne Posted November 15, 2011 Share Posted November 15, 2011 If you want to stay with AutoLisp there are many ways to "tag" objects with XDATA. About 13-14 years ago, I worked with someone who did this for steel framing plans. Of course that was back in the day with R14 and with his routines we were able to get a lot of information out of a "2D building model" which acted like a "3D model" when multiple floors were involved. (column schedules, truss and joist schedules, etc.) My personal opinion is if you use Xdata you need to know exactly what data you would like to save to accomplish your task. I know this statement may seem odd, but knowing what data you want to save with each element is important due to the amount of data you can save with each entity. Secondly, if you know what your output needs to be and how it needs to be displayed, this helps with knowing what types of data to save. No need to save the length of an object when you can extract that information out of the entity list. Abstract thinking helps a bit here. Let's say you draw a line that is to represent a beam. AutoCAD only knows it's a line object. In adding Xdata you could say this line is a "W8x31" and add this text to your line. You could get as fancy as making a function "TagBeam" which uses a dialog with a dropdown list of wide flange beams for selecting and tagging the line. No ARX required. Quote Link to comment Share on other sites More sharing options...
LibertyOne Posted November 15, 2011 Share Posted November 15, 2011 a good starting tutorial for xdata: http://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php from this link you will be able to find part2 Quote Link to comment Share on other sites More sharing options...
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.