对不起我的英语。
我也有类似的问题。
2007年在俄罗斯CAD论坛上找到了部分解决方案。
当线条被修改时,尺寸会发生反应,但它不是真正的关联。
- (defun EditDimassoc (ent_list dict_id / length_list i el el1 ent_list_new)
- (setq ent_list_new '())
- (setq length_list (length ent_list))
- (setq i 0 )
- (while (< i length_list)
- (setq el (nth i ent_list))
- (if (= i 2)
- (progn
- (setq el1 (list '(102 . "{ACAD_REACTORS") (cons 330 dict_id) '(102 . "}") (cons 330 dict_id)))
- (setq ent_list_new (append ent_list_new el1))
- ); end progn
- (setq ent_list_new (append ent_list_new (list el)))
- ); end if
- (setq i (1+ i))
- ); end while
- ent_list_new
- ); end defun
- ;--------------------------------------------------------------------------------------------
- (defun EditDimension (ent_list dict_id dimassoc_id / length_list i el el1 ent_list_new)
- (setq ent_list_new '())
- (setq length_list (length ent_list))
- (setq i 0 )
- (while (< i length_list)
- (setq el (nth i ent_list))
- (if (= i 2)
- (progn
- (setq el1 (list '(102 . "{ACAD_XDICTIONARY") (cons 330 dict_id) '(102 . "}")
- '(102 . "{ACAD_REACTORS") (cons 330 dimassoc_id) '(102 . "}")
- el))
- (setq ent_list_new (append ent_list_new el1))
- ); end progn
- (setq ent_list_new (append ent_list_new (list el)))
- ); end if
- (setq i (1+ i))
- ); end while
- ent_list_new
- ); end defun
- ;--------------------------------------------------------------------------------------------
- (defun SetDimAssoc (obj1 obj2 / dim_id dim_list dimassoc_id dimassoc_list dict_id dict_list )
- (setq dim_id dim_obj)
- (setq dim_list (entget dim_id))
- (setq dimassoc_id (entmakex (list '(0 . "DIMASSOC")
- '(100 . "AcDbDimAssoc") (cons 330 dim_id)
- '(90 . 3) '(70 . 0) '(71 . 0)
- '(1 . "AcDbOsnapPointRef") (cons 331 obj1)
- '(72 . 13) '(40 . 1.0) (cons 10 (cdr (assoc 10 (entget obj1))))
- '(1 . "AcDbOsnapPointRef") (cons 331 obj2)
- '(72 . 1) '(40 . 1.0) (cons 11 (cdr (assoc 10 (entget obj2))))
- );list
- );entmake
- );setq
- (setq dimassoc_list (entget dimassoc_id))
- (entmod dimassoc_list)
- (setq dict_id (entmakex (list '(0 . "DICTIONARY")
- (cons 330 dim_id)
- '(100 . "AcDbDictionary")
- '(280 . 1) '(281 . 1)
- '(3 . "ACAD_DIMASSOC")
- (cons 360 dimassoc_id)
- );list
- );entmake
- )
- (setq dict_list (entget dict_id))
- (entmod dict_list)
- (setq dict_list (EditDimassoc dimassoc_list dict_id))
- (entmod dict_list)
- (setq dim_list (EditDimension dim_list dict_id dimassoc_id))
- (entmod dim_list)
- (entupd dim_id)
- ); end defun
- (defun Test_DimAssoc ( / line1 line2 line3 ang doc mspace obj dim_obj)
- (command "_line" '(0 0) '(0 100) "")
- (setq line1 (entlast))
- (command "_line" '(0 100) '(100 100) "")
- (setq line2 (entlast))
- (command "_line" '(100 100) '(150 0) "")
- (setq line3 (entlast))
- (setq ang 0)
- (setq doc (vla-get-activeDocument (vlax-get-acad-object)))
- (setq mspace (vla-get-modelSpace doc))
- (setq obj (vla-addDimRotated mspace (vlax-3d-point (cdr (assoc 10 (entget line2))))
- (vlax-3d-point (cdr (assoc 11 (entget line3))))
- (vlax-3d-point '(100 150))
- ang))
- (setq dim_obj (vlax-vla-object->ename obj))
- (vlax-release-object obj)
- (SetDimAssoc line2 line3)
- (princ)
- ); end defun
- (Test_DimAssoc)
|