Ingore Empty Edit Boxes

Ingore Empty Edit Boxes

Anonymous
Not applicable
674 Views
4 Replies
Message 1 of 5

Ingore Empty Edit Boxes

Anonymous
Not applicable

I've had some success but this is not working.

I have a few edit boxes and with the default set to "" like below.

 

 : edit_box {key = "fnct1"; label = "Function 1 "; edit_width = 10; value = "";}

 

I want to ingore the boxes that have no value and if they do have value run the program.

I've tried IF and COND but not having success it seams to pass over the check. and run the program

 

(setq fnt1(get_tile "fnct1"))

 

 

(if (/= fnct1 "")
 (progn
     (command "_.Rename" "_Layer" "FUNCTION01" fnt1)
     (command "_.Layer" "_Color" "BLUE" fnt1 "")
  );end progn
 );end if

 

I tried

 

  (cond
   ((= fnct1 t)
     (command "_.Rename" "_Layer" "FUNCTION01" fnt1)
     (command "_.Layer" "_Color" "BLUE" fnt1 "")
    );end 1st cond

   ((= fnct1 f) nil)
    (princ)

   );end Cond

 

 

 

0 Likes
Accepted solutions (2)
675 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor
Accepted solution

Not sure if this is a typo but you have this code:

(setq fnt1(get_tile "fnct1"))

 

But you are testing:

if (/= fnct1 "")

 

You should be testing:

if (/= fnt1 "")

 

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 5

Anonymous
Not applicable

Not a typo I thought I need to look at the edit box value of fnct1 not the set value of fnt1.

0 Likes
Message 4 of 5

Anonymous
Not applicable

Paul,

 

I want to run a check for a layer and if that layer is missing I want the whole program to end.

I have this to run before the main program starts, it works but it still runs the program after clicking ok at the alert.

 

 

(defun lchk()

  (if (not (tblsearch "layer" "FUNCTION01"))

  (progn
    (alert (princ "You cannot proceed because function layers are not loaded."))
    (done_dialog)
   ); progn

  ); if

); end defun

0 Likes
Message 5 of 5

paullimapa
Mentor
Mentor
Accepted solution

I'm not sure where exactly you are incorporating this code.  If it's done before the dialog box is called, you also would not need this line: (done_dialog).

 

Also the rest of the code should be incorporated in the else part of the if code test for example:

(defun lchk()

  (if (not (tblsearch "layer" "FUNCTION01"))

  (progn
    (alert (princ "You cannot proceed because function layers are not loaded."))
   ); progn

  (progn  ; run rest of code here

  )

  ); if

); end defun

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos