(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)
)
)
)
)
)
(defun c:as3 (/ ent val cfm) ; Define function, declare local variables
(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)
)
)
(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))
)
)
)
)
)
(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
(progn ; <---<<<
(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
)
) ; end progn
)
)