Help required on AutoLISP
Help required on AutoLISP
(OP)
I am writing a program in AutoLISP which reads geometry created in AutoCAD and processes information regarding start point of line etc, for output to a file. my problem is in using "=" function. I read start angle of an arc using "entget" and "assoc" functions. But when I compare this angle with another got using "angle" function,
(= theta st_ang) ,I am getting nil output. But the values are numerically equal! Can anyone help with tips?
(= theta st_ang) ,I am getting nil output. But the values are numerically equal! Can anyone help with tips?





RE: Help required on AutoLISP
When you compare a calculated to a queried value problems can arise because of very small differences (10-12 or less). May have to use "equal" instead of "=". For example:
(equal theta st_and .00000001)
Hope this does it.
Carl
RE: Help required on AutoLISP
(setq EDDY (entget (car (entsel))))
;pick a block inserted at 45 degrees
(setq myAngel (cdr (assoc 50 EDDY)))
(print EDDY)
(print myAngel) ;prints 0.785398
(print (angtos myAngel));prints "45"
(if (= "45" myAngel)
(Print "= 45 myAngle TRUE")
(Print "= 45 myAngle FALSE"))
;prints "= 45 myAngle FALSE"
(if (= "45" (angtos myAngel))
(Print "= 45 (angtos myAngel) TRUE")
(Print "= 45 (angtos myAngel) FALSE")
)
;prints "= 45 (angtos myAngel) TRUE"
(princ)
)
RE: Help required on AutoLISP
Then compare the strings
RE: Help required on AutoLISP
RE: Help required on AutoLISP
^C INSERT c:\schem\fixed\;\;;
Thanks for any help you can provide.
RE: Help required on AutoLISP
Carl