Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need to insert blocks, but first I need to check if there are blocks with the same attributes and, if so, I need to copy one of the attributes.
Attributes:
ID
COMP
GAUGE
QTY
If the COMP and BITOLA are the same as those of another previously inserted block, then I need to copy the ID, otherwise ID + 1.
;contar blocos
(setq block_list
(list
"Negativo"
)
)
(setq ss (ssget "X" (list (cons 0 "INSERT") (cons 410 "Model"))))
(foreach block_name block_list
(setq i -1 cnt 0)
(while (< (setq i (1+ i)) (sslength ss))
(setq bo (vlax-ename->vla-object (ssname ss i)))
(if (= block_name (vlax-get bo 'EffectiveName)) (setq cnt (1+ cnt)))
)
(setq env_name (strcat "BLOCK_COUNT_" block_name))
(setenv env_name (itoa cnt))
)
(princ "\n")
(command "_REGEN")
(princ)
Solved! Go to Solution.