CompuServe Thread

#Attribute Insert

6 messages in this thread
#33542From: JERRY GRAGGFeb 18, 1992 10:15 AM
Hello All, A few messages back, I asked for some help on attribute's. I might not have been clear enough in explaining the problem. Here goes!! When a wblock containing multiple attributes is inserted into an existing drawing, I would like a lisp routine to answer the attribute questions. I use a very simple lisp program, which includes the (setq filename (open "somefile.dat" "r")) and (read-line filename) routine now to answer these questions. Works great! "If it's not broke, don't fix it" may be the real answer. However, I would prefer a looping routine to replace the (read-line filename). I have tried the "IF-THEN-ELSE" and "WHILE" and "REPEAT" commands but apparently dont understand how to use them. Maybe the real question is "Can a lisp routine answer attribute prompts?" Anyway, can someone at least tell me if its possible to use a function that includes a looping (read-line) to answer attribure prompts? Will be most appreciative!!!!!!!!!!!!!!!!!!!! Thanks,,,gragg
#33594From: Dennis StrieterFeb 18, 1992 5:29 PM
Jerry-I don't claim to be a lisp expert, but I blew the dust of an old routine that I use quite frequently. It sounds like it accomplishes the same things you're try to do, just a different application. The routine takes user input and reads a file until there is a match, it then assigns the valve to a variable which it uses as an attribute value in a block insertion. Note the attdia is on for editing before final block insertion. I think the core of the program could be used for what you're trying to do. I've uploaded the routine to you on Email, if you have any questions feel free. Dennis
#33676From: Tony Tanzillo [LISP TM]Feb 19, 1992 10:18 AM
Gragg – I think your question seems to be more one of how to do conditional looping in AutoLISP. In your case, the problem is that you must know *how many* times to repeat the loop, and if this number of iterations is determined by the number of attribute prompts that appear after inserting the block, then it will get rather tricky. What I would suggest is that you turn attribute prompting off (via a call to (setvar "attreq" 0)), and then go back and replace the values of the variable attributes using AutoLISP's (entmod) and (entnext) functions. If you need help with these, then just hollar. -TonyT.
#33870From: – Mike JacksonFeb 20, 1992 5:18 PM
Tony – Why would you suggest that he turn of attreq to do his filling in of attributes. I'm not questioning your integrity or ability or anything like that. I just want to learn. Mike J.
#33881From: Tony Tanzillo [LISP TM]Feb 20, 1992 6:26 PM
Mike – Feel free to question my suggestions, integrity, or ability anytime you wish…. I can hack it…<g> If you re-read my comment to him, I suggested that he insert the block first, and then modify the new attributes using (ENTMOD), meaning that he doesn't need to respond to any attribute prompts, and since it is difficult for any program to *predict* how many attributes values will be prompted for, that is why Autodesk invented ATTREQ to begin with, and that's why I suggested that he use that approach. If I'm not clear on this, then please tell me and I'll try to explain further. -TonyT.
#33888From: – Mike JacksonFeb 20, 1992 8:08 PM
Tony – Thanks. I see. I was thinking that you would always know the numberof atts. There's that "always" word. That should have clued me that I was in error. With your method you would not necessarily have to modify the code if the number of attributes in the block changed. Good idea. Mike J.