manddarran 发表于 2022-7-6 11:25:59

无法修改MacAlign Mtex

我正在尝试创建一个路由,该路由将根据传递给它的变量标记管道。我希望通过选择可以一次执行多行/多行。我必须使用多行文字,因为我使用的是叠加分数。
 
我有一个a编写的例程,可以处理规则线,现在我需要它来处理多边形线。我想我会尝试将macalign多行文字修改为循环,但不管我做了什么,它都会给我一个语法错误。
 
这是我写的lisp,我知道它很有效,但很实用。
 


(defun c:pipesize (); / sset item ctr check)

(if (= pipesize "1/2")
(setq pipesize (strcat "\\A;{\\H0.7x;\\S1#2;}" (chr 34)))
)
(if (= pipesize "3/4")
(setq pipesize (strcat "\\A;{\\H0.7x;\\S3#4;}" (chr 34)))
)
(if (= pipesize "1/2")
(setq pipesize (strcat "\\A;{\\H0.7x;\\S1#2;}" (chr 34)))
)
(if (= pipesize "1")
(setq pipesize (strcat "1" (chr 34)))
)
(if (= pipesize "1 1/4")
(setq pipesize (strcat "\\A1;1{\\H0.7x;\\S1#4;}" (chr 34)))
)
(if (= pipesize "1 1/2")
(setq pipesize (strcat "\\A1;1{\\H0.7x;\\S1#2;}" (chr 34)))
)
(if (= pipesize "2")
(setq pipesize (strcat "2" (chr 34)))
)
(if (= pipesize "2 1/2")
(setq pipesize (strcat "\\A2;1{\\H0.7x;\\S1#2;}" (chr 34)))
)
(if (= pipesize "3")
(setq pipesize (strcat "3" (chr 34)))
)
(if (= pipesize "2")
(setq pipesize (strcat "4" (chr 34)))
)
;(setq pipesize "\\A;{\\H0.7x;\\S3#4;}")
;(setq pipesize "1")

;load the visual lisp extensions
(vl-load-com)
;check for selection
;make the remove layers if they don't exist
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(setq newLayer (vla-add theLayers "f-text"))
;done makeing new layers
(princ)

;get the selection set
(setq pt (osnap (getpoint "Select Pipe and Text location") "near"))
(while (NOT (NULL PT))
(setq sset (ssget pt))
;set up the counter
(setq ctr 0)
;count the number of entities and loop
(setq item (ssname sset ctr))
;convert to vl object
(setq item (vlax-ename->vla-object item))
;check to see what type of entity it is.
(if (= "AcDbLine" (vla-get-ObjectName item))
;change the lines layer
(setq ang (vlax-get-property item 'Angle))
);if
(if (= "AcDbLine" (vla-get-ObjectName item))
;change the lines layer
(setq ang (vlax-get-property item 'Angle))
);if
;increment the counter
(setq dist (* 1 scalem))

(setq ang2 (+ ang (/ pi 2)))
(setq pt2 (polar pt ang2 dist))
(setq ang (rtd ang))
(princ "\n")
(princ ang)
(cond
((and (>= ang 45) (< ang 135))
(setq ang 90))
((and (>= ang 135) (< ang 225))
(setq ang 0))
((and (>= ang 225) (< ang 315))
(setq ang 90))
((or (>= ang 315) (< ang 45))
(setq ang 0))
)
(setq ang2 (dtr ang))
(setq ang2 (+ ang2 (/ pi 2)))

(setq pt2 (polar pt ang2 dist))






(command "-mtext" pt2 "j" "mc" "R" ang "w""90" pipesize "")
(princ)
(setq pt (osnap (getpoint "Select Pipe and Text location") "near"))
)
);defun

sroberts 发表于 2022-7-6 11:29:33

你好
我不知道这是否是你想要的,但它确实帮了我很多。它会用你的图层名称来标记这条线,所以我用管道的大小来命名我的图层。
非常感谢在这个网站上帮助我的每一个人。
雪莉
 
http://www.cadtutor.net/forum/showthread.php?p=288453#post288453

manddarran 发表于 2022-7-6 11:34:15

是的,我把它们都看了一遍,没有一个看起来很正常。我只需要把一些多行文字放在一条直线上,并重复多次。所有漂亮的例程都只放在文本上,或者默认放在行的中点。
 
谢谢!

Lee Mac 发表于 2022-7-6 11:37:59

你到底想找什么?用户会选择管道尺寸,然后选择多条管线吗?
 
我能看到我能做什么

Lee Mac 发表于 2022-7-6 11:41:40

您可能还想使用对象扩展数据检查这个更高级的选项

manddarran 发表于 2022-7-6 11:42:04

这正是我想要做的。我选择一个“按钮”,然后你可以选择多行,它将其放置在行的上方或左侧。我写的套路很好,除了台词之外什么都没有。我的日常工作还很初级,当我复制、粘贴和修改时,评论就被删除了。。。。它还使用一些自定义变量,但如果我可以通过选择行来多次将多行文字放置在直线或pline等上方,我可以使其与我们的系统一起工作。我们必须使用多行文字,因为我们在叠加分数。lisp的第一部分设置要放置的多行文字,并将其移除。
 
另一方面,我一直在使用/修改你的许多例程,非常感谢你在所有这些工作中投入的时间和精力。
 
再次感谢,
 
马特

manddarran 发表于 2022-7-6 11:47:23

 
我也搞砸了。我喜欢它的连接方式,但当我试图“循环”该程序时,它会移动文本,而不是添加另一个实例。如果这可以循环并动态移动,那将是猫的喵喵叫声。我也不确定这是不是mtext,我看了这么多我的大脑是一片模糊。

Lee Mac 发表于 2022-7-6 11:50:49

谢谢你的夸奖,我很感激
 
最后一个例程可以同时完成这两个任务,但我并不特别想修改它,我将看看我能用MacAlign做些什么

manddarran 发表于 2022-7-6 11:52:04

 
我再看一次。。。。
 
你有一个捐赠按钮,这样我可以给你买一杯啤酒?

Lee Mac 发表于 2022-7-6 11:56:53

 
我以前是这样的,但他们不久前就被删除了-我会给你发邮件的
页: [1] 2
查看完整版本: 无法修改MacAlign Mtex