×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help required on AutoLISP

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?

RE: Help required on AutoLISP

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

RE: Help required on AutoLISP

(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)
)

RE: Help required on AutoLISP

Convert value to string
Then compare the strings

RE: Help required on AutoLISP

(OP)
Thanks guys. The problem was exactly what CarlB pointed. Thanks very much for the help.

RE: Help required on AutoLISP

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.

RE: Help required on AutoLISP

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources