Cond help

#1
Having trouble setting a cond statement.
When the value of 'eit' is anything above '0' I want to create the insulation entities. [within the (progn....)]
If 'eit' is zero I want to skip this step and go to (INS_MB)
The following code does not work & I can't see my error(s)

Code: Select all

(defun DRAW_INS () 
;----------
; Draw Insulation recangle
	(cond (/= eit 0)
	(progn	
	(command "_Rectangle";
						  (strcat (rtos EIXOO#) "," (rtos EIYOO#) ",0" )
						  (strcat "@" (rtos eitx#) "," (rtos eity#) ",0" ) "")
	(command "_fillet" "R" eit# "")
	(command "_fillet" "P" "L" "")
		(setq ENTZ1 (entlast))
;Extrude Insulation Shell	
	(command "_extrude" ENTZ1 "" dis "")
		(setq ENTZ3 (entlast))
	(command "_extrude" ENTZ2 "" dis "")
		(setq ENTZ4 (entlast))	
	(command "_subtract" ENTZ3 "" ENTZ4 "")
		(setq ENTZ5 (entlast))
	(command "_change" ENTZ5 "" "P"	"la" "Insulation" "")	
		(ssadd ENTZ5 SS)							; ADD TO SELECTION SET
	);end progn
	);END COND
	(INS_MB)
) ;end DRAW_INS	
CMS INTELLICAD 12.1.243.153262.PE+.VC16.x64.CMS121

i9-12900k / 64gb-3200 - NVIDIA GeForce TRX 3060 Ti 8Gb Windows 11 Pro
www.stylemarkdesigns.co.uk

Re: Cond help

#2
Hi Steve,
The "(cond (/= eit 0)" should be "(cond ( (/= eit 0)"

Please refer this :

Code: Select all

(defun DRAW_INS () 
;----------
; Draw Insulation recangle
 (cond
   ((/= eit 0)
    (progn	
          ; do something
      ) ;end progn
    ) ; end (/= eit 0)
   );END COND

  (INS_MB)
) ;end DRAW_INS	

Re: Cond help

#4
Sorry Quan, but your change has not improved things :(

I'm trying to create a section of Rectangular ductwork, complete with flanges at both ends.
In some cases the user will require insulation and in others they will not.
So by filtering via the External Insulation Thickness (eit), I want to either create the insulation or skip that section
I've attached the full code below.
rduct.zip
(3.31 KiB) Downloaded 41 times
CMS INTELLICAD 12.1.243.153262.PE+.VC16.x64.CMS121

i9-12900k / 64gb-3200 - NVIDIA GeForce TRX 3060 Ti 8Gb Windows 11 Pro
www.stylemarkdesigns.co.uk