Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help required on AutoLISP

Status
Not open for further replies.

rakes

Aerospace
Jul 6, 2001
25
0
0
IN
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?
 
Replies continue below

Recommended for you

Rakes,
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
 
(defun C:testAngtos()
(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)
)
 
I am writing a Autolisp program to insert hydraulic symbols by using the insert command. The code will bring up the insert box but it will not read where the file is to be inserted from. I am running AutoCAD 2000 and the code reads as follows:
^C INSERT c:\schem\fixed\;\;;

Thanks for any help you can provide.
 
You should be able to suppress the dialogue box, and use the command line form of the command by using "-insert" instead of "insert".
Carl
 
Status
Not open for further replies.
Back
Top