本帖最后由 sfzyr 于 2021-9-29 22:26 编辑
- (if (setq ss (ssget "x" '((0 . "ACMPARTREF"))))
- (progn
- (setq i -1
- ent_list '()
- )
- (repeat (sslength ss)
- (setq ent_list (cons (ssname ss (setq i (1+ i))) ent_list))
- )
- (setq datas
- (mapcar
- '(lambda (x)
- (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property (vlax-ename->vla-object x) 'Data)
- )
- )
- )
- ent_list
- )
- )
- )
- )
以上可以获得“零件参照”的数据,但是并不能得到“块零件参照”的数据。
以下可以建立一个二维数组,并赋值,增加到相关的零件参照特性中。- (setq point (vlax-make-safearray vlax-vbString '(0 . 1) '(0 . 1)))
- (vlax-make-variant point)
- (vlax-safearray-put-element point 0 0 "DESCR")
- (vlax-safearray-put-element point 0 1 “aa”)
- (vlax-safearray-put-element point 1 0 "MATERIAL")
- (vlax-safearray-put-element point 1 1 "Q235")
- (vlax-put-property (vlax-ename->vla-object (car (entsel))) 'Data point)
参照我这个帖子中我的回复关于 Autodesk Mechanical 零件参照属性的 Lisp 写入 http://bbs.mjtd.com/forum.php?mo ... 3%BC%FE%B2%CE%D5%D5
|