stuck on new lisp

CEIDave

Usenet Archive
Joined
Dec 23, 2003
Messages
20
Reaction score
0
Ok... I'm trying to write a lisp that will allow me to change the rotation of attributes in relation to the block they are in by just picking the attribute. I'm planning on using the "cal" function within the -attedit command to do this. Only I'm stuck on how to make the "cal" part work. There is obviously alot more to do with this, but I'm just wanting help on this for now (not wanting you guys to write the code for me, just give me a bit of a kick in the hind to get moving again). Any ideas? If using this command from the command prompt, I just have to put " 'cal " in when the angle prompt pops up, but everything I've tried in this partial lisp brings back "Requires valid numeric angle or second point. ; error: Function cancelled" or " ; error: bad argument value: AutoCAD command: CAL"

Thanks in advance for any help or suggestions!

(defun C:RAT
(SETQ A1 (GETANGLE "\nWhat is the angle of the block?") A2 (/(* A1 180.0)PI) ) (COMMAND "-ATTEDIT" "" "" "" "" Pause "" "A" "'cal "A2 + 180"") (PRINC)
)
 
I dont believe that it is possible to call "cal" from lisp. Just do your calculations in lisp directly, & store them as a symbol.

CEIDave said:
Ok... I'm trying to write a lisp that will allow me to change the rotation
of attributes in relation to the block they are in by just picking the attribute. I'm planning on using the "cal" function within the -attedit command to do this. Only I'm stuck on how to make the "cal" part work. There is obviously alot more to do with this, but I'm just wanting help on this for now (not wanting you guys to write the code for me, just give me a bit of a kick in the hind to get moving again). Any ideas? If using this command from the command prompt, I just have to put " 'cal " in when the angle prompt pops up, but everything I've tried in this partial lisp brings back "Requires valid numeric angle or second point.
 
I don't understand why you want to use 'cal.

what you have written could also be done like this;
(defun C:RAT
(SETQ A1 (GETANGLE "\nWhat is the angle of the block?") A2 (/(* A1 180.0)PI) A3 (+ A2 180) ) (COMMAND "-ATTEDIT" "" "" "" "" Pause "" "A" A3 "") (PRINC)
)

CEIDave said:
Ok... I'm trying to write a lisp that will allow me to change the rotation
of attributes in relation to the block they are in by just picking the attribute. I'm planning on using the "cal" function within the -attedit command to do this.
 
Thanks Mark, I had kinda thought that way at first, but I guess I got locked into the mindset of using the cal command.
 
You're welcome
:-)
also, can't you get the rotation of the block just by reading it's rotation after picking the attribute, instead of having to enter the angle manually - or does that not apply in your situation?

CEIDave said:
Thanks Mark, I had kinda thought that way at first, but I guess I got
locked into the mindset of using the cal command.
 
Also--rather than asking the user to tell you the angle of the block, why not just extract it yourself?

(princ "Select the attribute: ")
(setq ent(entsel))
(if ent
(setq a1(cdr (assoc 50 (entget (cdr ent)))))
(setq A2 (/(* A1 180.0)PI))
(setq A3 (+ A2 180))
;(car ent) will return the coordinate the user chose. Hopefully ;attedit will use this coordinate to get the attribute (COMMAND "-ATTEDIT" "" "" "" "" (car ent) "" "A" A3 "")
)
 
at this point, why not use entmod with subst on the attribute rotation?

Jamie
 

Latest threads

Back
Top