Greetings,
I've been trying to debug my program that detects the cfm attribute in my dynamic block and based on the cfm range it picks the sort value from it's property table. so far it keeps returning an integer and does nothing to the block. any ideas on how to correct it? Im sure it may be the way I had set up my loop if not my condition statement, just not certain if it is the root cause. any advice will be greatly appreciated.
here is the code i have so far and I have attached my block:
(defun c:AS3 (/ ent val cfm)
;; Define function, declare local variables
(if ;; If the following expression returns a non-nil value
(setq ent ;; Assign the value returned by the following expression to the symbol 'sel'
(ssget ;; Prompt the user to make a selection and return the selection set if successful
'
((0 . "INSERT"))
;; Filter the selection to block references only (INSERTs)
)
;; end ssget
)
;; end setq
(Setq I -1)
(While (setq ent (ssname val (setq I (1+ I))))
(setq val (LM:Tag_Val (vlax-ename->vla-object ent) "CFM"))
(Cond
;If
((>= val 51)
(<= val 0)
(LM:reprop "sort" "01" ent)
)
;Else
((>= val 76)
(<= val 52)
(LM:reprop "sort" "02" ent)
)
;Else
((>= val 121)
(<= val 77)
(LM:reprop "sort" "03" ent)
)
((>= val 176)
(<= val 122)
(LM:reprop "sort" "04" ent)
)
((>= val 177)
(LM:reprop "sort" "05" ent)
)
) ;End cond
(defun LM:reprop (blk lst / itm)
(setq
lst (mapcar '(lambda (x) (cons (strcase (car x)) (cdr x)))
lst
)
)
(foreach x (vlax-invoke blk 'getdynamicblockproperties)
(if (setq itm (assoc (strcase (vla-get-propertyname x)) lst))
(vla-put-value
x
(vlax-make-variant
(cdr itm)
(vlax-variant-type (vla-get-value x))
)
)
)
)
)
(defun LM:Tag_Val (blk tag)
(setq tag (strcase tag))
(vl-some '(lambda (att)
(if (= tag (strcase (vla-get-tagstring att)))
(atoi (vla-get-TextString att))
)
)
(vlax-invoke blk 'getattributes)
)
)
)
)
)