monkey7 Posted July 22, 2010 Posted July 22, 2010 I'm currently working on a script to (semi) automise drawing rail constructions. This is going fine, except for one very odd issue. I'm quite a beginner, so please bear with me. I have to insert a block with an attribute. Since I want to avoid using ent* commands, I wrote the script using (command "INSERT" blockname coordinates "" "" "" attributevalue). At home this worked, yet at work the lisp engine treats the 'attributevalue' as a new command. Is there an AutoCAD variable or something else that determines the definition of attributes in the insert command? Both AutoCAD versions are 2010 vanilla, except for some heavy third party scripts and programs for work, which I can't and don't want to disable. Quote
dbroada Posted July 22, 2010 Posted July 22, 2010 there are several things that can throw a script. Is it definitely the same block being used at home and work with exactly the same number of attributes? Is the "uniform scale" set the same on both blocks? I normally have ATTREQ = 0 so that my blocks arre inserted without attributes and I have to correct them later. Although not ideal if you know the attribute value it does make the script easier Quote
monkey7 Posted July 22, 2010 Author Posted July 22, 2010 ATTREQ was the one. It's default at 0, setting it at 1 enabled the script to set the attribute. Will have to set ATTREQ to 1 just before inserting and set it back to 0 just after insertion. Don't want a dialog popping up during normal usage. The attribute defines a unique number assigned to every power line masts, so filling them in later was not really an option. It would require the user to find out which one it was, possible point of confusion when you have a lot of masts. The block does vary depending on the drawing, different clients require different drawing styles. Thanks a lot for the replies. Quote
dbroada Posted July 22, 2010 Posted July 22, 2010 ATTREQ turns off the asking for attribute values, I would have thought ATTDIA (shame I forgot about it) which is the command line version would have been what you wanted. Never mind, if it works all is good. Quote
monkey7 Posted July 22, 2010 Author Posted July 22, 2010 Doesn't seem to work with ATTDIA 1 and ATTREQ 0. Anyway, it does work with ATTREQ 1, so like you said it's all good If you don't mind me moving onto the next issue, I have encountered the following: Whenever I want to get string input I am only able to get a single word. As soon as the spacebar is pressed the script moves on and I end up with a one word comment being inserted. I tried using (getstring "") and pausing the script at input moments. Is there a workaround allowing multiple words to be used as input? Quote
dbroada Posted July 22, 2010 Posted July 22, 2010 you are moving into the LISP area that is not a strong point of mine (I prefer VBA or scripts) however try (getstring T "Input") the should allow spaces 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.