Jump to content
dimka

Ignore empty DCL input boxes when performing extrude multiple objects.

Recommended Posts

dimka

I have multiple objects that are closed polylines and need to enter the extrude value through the DCL interface. Some of the input boxes are left empty/blank, meaning some of object I don’t want to extrude.
When I want to extrude, the script will stop when it encounters a blank or 0 value. How can I write a script to skip the blank input box?

Due to limited skill, I am very basic lisp experience and DCL to complete this lisp. I hope everyone can help, thank you

 

this is the lisp

(defun c:3dext1 ()

(setq AR "arlayer")	;AR	
(setq CO "colayer") 	;CO
(setq FR "frlayer")	;FR 
    (dcl_3dextr)
    (princ)
)

(defun dcl_3dextr ( )
    (setq dcl_id_PARA (load_dialog "3Dextr.dcl"))
  (if (not (new_dialog "dextr" dcl_id_PARA))
  (exit)
  )

    (set_tile "arval" "")
    (set_tile "coval" "")
    (set_tile "frval" "")	

    (action_tile "accept-ht" "(get_1ht) (done_dialog 1)")
	(action_tile "cancel" "(done_dialog)")

    (setq dd (start_dialog))
    (cond 
	((= dd 1) (main-extru))
    )

	  (unload_dialog dcl_id_PARA)	
)

(defun get_1ht ()
    (setq arh (atof (get_tile "arval")))
    (setq coh (atof (get_tile "coval")))
    (setq frh (atof (get_tile "frval")))
)

(defun main-extru (/)
 	(command "_.view" "_swiso" )		
	(command "_.zoom" "_extents")	

       (command "_.LAYER" "_T" AR "_S" AR "_F" "*" "")				
       (command "_.extrude" "all" "" arh )			
       (command "_.LAYER" "_T" CO "_S" CO "_F" "*" "")	
       (command "_.extrude" "all" "" coh )											
		(command "_.LAYER" "_T" FR "_S" FR "_F" "*" "")
       (command "_.extrude" "all" "" frh )	

 (princ)
) ;_ defun

DCL here

 dextr : dialog { label = "extrude by val" ;
 
		:row {
		: edit_box {key = "arval"; label = "a"; edit_width = 3; value = "000";}		
		: edit_box {key = "coval"; label = "c"; edit_width = 3; value = "000";}		
		: edit_box {key = "frval"; label = "f"; edit_width = 3; value = "000";}	

	: button {
	label = "OK";
	key = "accept-ht";
	width = 12;
	fixed_width = true;
	mnemonic = "O";
	}
 
	: button {
	label = "Cancel";
	key = "cancel";
	width = 12;
	fixed_width = true;
	mnemonic = "C";
	is_cancel = true;
  	}

	
				  }
}

 

 

Share this post


Link to post
Share on other sites
Lee Mac

You'll need to use a conditional statement, such as an if or cond statement to test whether the supplied extrusion height is present and numerical prior to performing the extrude operation. I would suggest using the distof function in place of atof to perform the conversion from a string to a float, as this function will return nil if the supplied string is not numerical.

 

You can then implement a test such as the following:

(if arh
    (progn
        (command "_.-layer" ...)
        (command "_.extrude" ...)
        ...
    )
)
(if coh
    (progn
        (command "_.-layer" ...)
        (command "_.extrude" ...)
        ...
    )
)
...

 

Edited by Lee Mac

Share this post


Link to post
Share on other sites
dimka

Ok, i will give those a try. thank you very much!

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...