(defun INSERT_BLOCK_VIEW ()
(if (= NEWTILE "rb31")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb32")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb33")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb34")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb35")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb36")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb37")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb41")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb42")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb43")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb44")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if (= NEWTILE "rb45")
(SET_BLOCK) ;GOTO SET BLOCK
) ;_ end of if
(if
(and (= NEWTILE "rb46")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
(SET_BLOCK)
) ;_ end of if
; (if (= NEWTILE "rb46")
; (SET_BLOCK) ;GOTO SET BLOCK
; ) ;_ end of if
(if
(and
(= NEWTILE "rb47")
(= sel "pipe_")
) ;end and
(DRAW_PIPE_SHAPE)
(SET_BLOCK)
) ;_ end of if
; (if (= NEWTILE "rb47")
; (SET_BLOCK) ;GOTO SET BLOCK
; ) ;_ end of if
(if
(and
(= NEWTILE "rb48")
(= sel "pipe_")
) ;end and
(DRAW_PIPE_SHAPE)
(SET_BLOCK)
) ;_ end of if
; (if (= NEWTILE "rb48")
; (SET_BLOCK) ;GOTO SET BLOCK
; ) ;_ end of if
(if
(and
(= NEWTILE "rb49")
(= sel "pipe_")
) ;end and
(DRAW_PIPE_SHAPE)
(SET_BLOCK)
) ;_ end of if
) ;end INSERT_BLOCK_VIEW
(defun SET_BLOCK ()
(setq D (nth 1 SIZE_DIMS)
) ;end setq
(INSERT_BLOCK) ;GOTO INSERT BLOCK
) ;End SET_BLOCK
;-----------------------------------------------------------------------;
(defun INSERT_BLOCK ()
;(princ D) ; print the content of D variable to the command line.
(if (tblsearch "block" D)
(progn
(command "_.-insert" D pause "" "" ""))
(progn
(setq dwg (strcat D ".dwg"))
(if (setq fullPath (findfile dwg))
(command "_.-insert" fullPath pause "" "" "")
(Princ (strcat "\nNot found drawing name <" dwg "> in support file search path.")) )) )
(princ))
;-----------------------------------------------------------------------;
;for ICAD 9.0 ONLY
(defun DRAW_PIPE_SHAPE ( / spt1 spt2 ENT1 ENT2 PIPOD PIPID)
(setq PIPOD N1)
(setq PIPID N6)
(if (and (setq spt1 (getpoint "\nSpecify Start point of Pipe"))
(setq spt2 (getpoint "\nSpecify End point of Pipe"))
) ;end of AND
(progn
(command "ucs" "ZA" spt1 spt2)
(command "circle" "0,0,0" "d" pipod) ;take OD from dim file
(setq ENT1 (entlast))
(command "circle" "0,0,0" "d" pipid) ;take ID from dim file
(setq ENT2 (entlast))
(command "extrude" ENT1 "" "D" spt1 spt2)
(setq ENT1 (entlast))
(command "extrude" ENT2 "" "D" spt1 spt2)
(setq ENT2 (entlast))
(command "subtract" ENT1 "" ENT2 "")
(command "ucs" "_P")
) ;_ end of progn
) ;_ end of IF
) ;end DRAW_PIPE_SHAPE
;for ICAD 9.0 ONLY
Can anyone see where I'm going wrong?
(= NEWTILE "rb48")
and also:(and
(= NEWTILE "rb48")
(= sel "pipe_")
) ;end and
(DRAW_PIPE_SHAPE)
(SET_BLOCK)
LISP:
(vl-some '(lambda) (list))
C#:
<Array class>.FirstOrDefault()
<List class>.Any()
JavaScript:
<array>.some()
for(i = 0; i < arr.length ; i++)
{
if (condition_for arr[i])
{
// do stuff...
break;
}
}
(cond
((and (= NEWTILE "rb41")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb42")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb43")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb44")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb45")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb46")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb47")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb48")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE)
)
;
((and (= NEWTILE "rb49")(= sel "pipe_")) ;end and
(DRAW_PIPE_SHAPE) ;goto draw pipe shape
)
(t (SET_BLOCK)) ;goto set block
) ;_ end of cond
;
; (cond
; ((<IF this is true>)
; (<THEN do this>)
; )
; (t (<ELSE do this>)
; )
;
;
) ;end INSERT_BLOCK_VIEW
it also stops evaluating once a non-nil condition is met so it's often "cleaner".Huh, are you saying that this does not apply to the if function?
it also stops evaluating once a non-nil condition is met so it's often "cleaner".Huh, are you saying that this does not apply to the if function?
Oh, what have I done :opps:, those last comments were so far above my head I only heard them pass over!! :uglystupid2: :2funny:No! You made a good leap; you have the basics now. The comments so far have been about mythology (programming). Stick with what you understand, do not worry about optimization yet (use what works; there is more then enough expertise here to help optimize methods once you grasp concepts).
More reading I think.
A series of IF statements will be run (each).Of course the same goes for a series of cond statements... From what you are saying here inexperienced users may get the idea that there is something wrong with the if function.
(cond
((= ans 1)(princ ans))
((= ans 2)(princ ans))
((Alert "The value entered is to large\nwill exit now")(exit))
)
A series of IF statements will be run (each).Of course the same goes for a series of cond statements... From what you are saying here inexperienced users may get the idea that there is something wrong with the if function.
Oh, what have I done :opps:, those last comments were so far above my head I only heard them pass over!! :uglystupid2: :2funny:No! You made a good leap; you have the basics now. The comments so far have been about mythology (programming). Stick with what you understand, do not worry about optimization yet (use what works; there is more then enough expertise here to help optimize methods once you grasp concepts).
More reading I think.
Recap of the thread:
You will have this same scenario constantly and you have a few methods you can use. You can combat this with a couple of methods. One being a conditional evaluation (check, check, check--do!) or a look-up table (which is similar). Each have their ups-and-downs.
For example, you can do the check, check, check--do (where the checking stops after the first pass) or the look up table method and risk running checks for items past the first passed check.
Stick with what you understand, do not worry about optimization yet
Grrr1337's suggestions does look more 'compact' but for me, a novice (what comes before a novice??) I find it difficult to see what is happening.
As an aside, you guys have been soo helpful. Thanks