Bgaddis 发表于 2022-7-6 02:30:21

更改标注文字移动

在放置连续标注以使用标注文字移动尺寸线后,我试图更改文字移动。我假设需要将维度的变量dimtmove设置为0,但我不确定这是否是正确的方法。我想我记得看到过类似的东西,但唉,我可以再次找到链接。任何帮助都将不胜感激。
 
(defun c:cdim ( / pt1 pt2)
;This function allows the user to dimension continuously and then after they are done insert the overall distance

(command "dimlinear" pause pause pause);start the first dimension
(setq pt1 (cdr (assoc 13(entget (entlast)))));get the start point
(command "dimcontinue");dimension everything in between start and end

(while (/= (getvar "CMDACTIVE") 0);keep the dimcontinue going until user exits

(command pause)
(setq obj (vlax-ename->vla-object (car (entsel (entlast)))));start here to try and change dimtmove
(vlax-put obj 'Dimtmove 0)
)
(setq pt2 (cdr (assoc 14(entget (entlast)))));get end point from last dimcontinue inserted
(command "dimlinear" pt1 pt2 pause);place the overall dimension
)

Bgaddis 发表于 2022-7-6 02:56:52

谢谢
 
它非常接近,但由于某些原因,在选择下一个点后,将删除除最后一个维度外的所有连续维度。我想我可以在while循环中获得实体名称,然后在退出while循环后启动另一个循环来更改它们,但肯定有更直接的方法。

Tharwat 发表于 2022-7-6 03:15:02

欢迎来到cadTutor
 
试试这个,希望你喜欢。。。
 

(defun c:cdim (/ pt1 pt2 e p pt obj)
(command "_.dimlinear" pause pause pause)
(if (eq (cdr (assoc 0 (setq e (entget (entlast))))) "DIMENSION")
   (setq pt1 (cdr (assoc 13 e))
         pt(cdr (assoc 14 e))
   )
)
(while (setq p (getpoint pt "\n Specify next point :"))
   (command "_.dimlinear"
            "_none"
            pt
            "_none"
            p
            (cdr (assoc 10 e))
   )
   (vlax-put (vlax-ename->vla-object (setq obj (entlast)))
             'textmovement
             0
   )
   (setq pt (cdr (assoc 14 (entget obj))))
)
(setq pt2 (cdr (assoc 14 (entget obj))))
(command "_.dimlinear" "_none" pt1 "_none" pt2 pause)
)

Bgaddis 发表于 2022-7-6 03:17:05

实际上,我也想过这样做,只使用dimlinear命令,然后使用第一个文字偏移点偏移尺寸,但不能继续使用第一个文字点,因为尺寸将以最短的距离延伸到该点,因此可以得到如下所示的结果。我不知道我会经常遇到这种情况,但为了它的多功能性,我想防止这种情况。

Bgaddis 发表于 2022-7-6 03:33:14

好吧,我基本上都明白了。最后只需要一个摄政王。我希望在放置每个continue维度后重新生成,但我现在会接受它,直到我有几天以上的自动/视觉lisp经验为止
 
(defun c:cdim (/ pt1 pt2 doc )
;This function allows the user to dimension continuously and then after they are done insert the overall distance
(vl-load-com);load visual lisp


(setq doc (vla-get-ActiveDocument(vlax-get-acad-object)))
   (vla-put-ActiveUCS doc(vla-add (vla-get-usercoordinatesystems doc) (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point '(1. 0. 0.))
         (vlax-3D-point '(0. 1. 0.)) "TempWorld_UCS"))
(command "_UCS" "NA" "r" "TempWorld_UCS")
;change the UCS to world so the final dimension will insert correctly




(command "dimlinear" pause pause pause);start the first dimension
(setq pt1 (cdr (assoc 13(entget (entlast)))));get the start point
(command "dimcontinue");dimension everything in between start and end

(while (/= (getvar "CMDACTIVE") 0);keep the dimcontinue going until user exits
(command pause)
(vlax-put (vlax-ename->vla-object (setq obj (entlast))) 'textmovement 0)


)
        (command "regen")
        (setq pt2 (cdr (assoc 14(entget (entlast)))));get end point from last dimcontinue inserted
        (command "dimlinear" pt1 pt2 pause);place the overall dimension       

   

)
页: [1]
查看完整版本: 更改标注文字移动