Jump to content

Recommended Posts

Posted

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

Posted

Try to make the comparison using numbers instead:

(< (atof l_kyl) 7)

Posted

Thank you MSasu very much it works.:D

 

/Dan

Posted
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")

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...