Try:
Code:
(foreach com (xins:massoc "compressor" lst) ;; For the contents of every <compressor> tag in the <rack>
;; Insert Block at insertion point 'ins'
(setq ss (ssadd)
tmp ;; VLA Block Reference object
(vla-insertblock
spc ;; Modelspace object
(vlax-3d-point ins) ;; Insertion point Safearray Variant
"M-GROUP-CSC-XML" ;; Block name (exists in drawing as tested earlier)
1.0 1.0 1.0 0.0 ;; (Scale=1:1, Rotation=0.0)
) ;; end vla-insertblock
) ;; end setq
(cond
;;----------------------------------------------------------------------;;
;; Condition
( (null (setq mod (xins:assoc "model" com))) ;; Contents of <model> tag
;; Notify user of such:
(princ
(strcat
"\nModel Number not found for Compressor located at "
(xins:lst->str (mapcar 'rtos ins) ",") ;; Include insertion point of Compressor for clarity
) ;; end strcat
) ;; end princ
) ;; end condition
;;----------------------------------------------------------------------;;
;; Condition
( (and
(setq csg (xins:assoc "suction_group" com)) ;; Finds suction group of compressor
(< (atoi (cadr (assoc csg rsg))) 0) ;; Sees if suction group is LT ot MT
(or (= (setq csf (xins:assoc "suction_shell" com)) "NONE") ;; Determines suction filter per comp
(= (setq csf (xins:assoc "suction_shell" com)) nil)
)
)
;; Set visibility state of block accordingly:
(vla-put-activelayer
(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-item (vla-get-layers acdoc) "M-PIPING-INS-1-0")
)
(xins:setvisibilitystate tmp "DIP TUBE") ;; Sets the visibility state
) ;; end condition
;;----------------------------------------------------------------------;;
) ;; end cond
(setq tmp (vlax-vla-object->ename tmp)) ;; to entity
(ssadd tmp ss) ;; add to selection set
(sssetfirst nil ss)
(c:burst)
(setq ins (mapcar '+ ins '(12.3933 0.0 0.0))) ;; Shift the insertion point by a given vector
)