本帖最后由 highflybir 于 2021-4-17 08:28 编辑
两个相同的动态块,将其中一个属性,赋值给另一个
- (defun c:copypps (/ obj ppts)
- (setq obj (vlax-ename->vla-object (car (entsel)))
- AllowedValues nil
- ppts nil
- )
- (if (setq obj (vlax-invoke obj 'GetDynamicBlockProperties)
- ent obj)
- (progn
- (repeat (length obj)
- (if (= (vlax-get (car obj) 'show) -1)
- (setq ppts (append ppts (list (vlax-get (car obj) 'Value))))
- )
- (setq obj (cdr obj))
- )
- (setq obj (vlax-invoke
- (vlax-ename->vla-object (car (entsel)))
- 'GetDynamicBlockProperties
- )
- i obj
- )
- (while ppts
- (if (= (vlax-get (car obj) 'show) -1)
- (progn
- (vlax-put (car obj) 'Value (car ppts))
- (setq obj (cdr obj)
- ppts (cdr ppts)
- )
- )
- (setq obj (cdr obj))
- )
- )
- )
- )
- (princ)
- )
对于长度、可见性等属性都可以正常赋值,但如果是翻转属性,就会报错说参数错误,请教高老师,这种情况,怎么处理,谢谢。
|