Vismut65 Posted April 17, 2012 Posted April 17, 2012 Hi, I have made an IF function. But it doesn't work. The code is below. If the value of "l_kyl" is larger or smaller than "7" I want two different blocks to be inserted. It only takes the first block independent of the value of "l_kyl". Someone who knows and can help me?. /Dan (if (= feet "1") (progn (if (< l_kyl "7") (command "_.insert" "P:\\CAD\\r18G\\Drives\\DUE\\Dimritning\\L3\\Fot\\L3_fot_H_W.dwg" "0,0" "1" "1" "0")) (if (> l_kyl "7") (command "_.insert" "P:\\CAD\\r18G\\Drives\\DUE\\Dimritning\\L3\\Fot\\L3_fot_H_A.dwg" "0,0" "1" "1" "0")) )) Quote
MSasu Posted April 17, 2012 Posted April 17, 2012 Try to make the comparison using numbers instead: (< (atof l_kyl) 7) Quote
Vismut65 Posted April 17, 2012 Author Posted April 17, 2012 Thank you MSasu very much it works. /Dan Quote
MSasu Posted April 17, 2012 Posted April 17, 2012 Use cond function instead of if function . Since there are only two cases for l_kyl variable, then IF statement is an apropriate solution. However, I will format the code like: (setq pathBlock "P:\\CAD\\r18G\\Drives\\DUE\\Dimritning\\L3\\Fot\\") (if (= feet "1") (if (< (atof l_kyl) 7) (setq nameBlock "L3_fot_H_W.dwg") (setq nameBlock "L3_fot_H_A.dwg") ) ) (command "_.INSERT" (strcat pathBlock nameBlock) '(0.0 0.0) "1" "1" "0") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.