乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 14|回复: 5

[编程交流] 帮助创建多行文字与文字

[复制链接]

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:06:07 | 显示全部楼层 |阅读模式
大家好,
 
我有一个lisp,除了它如何生成文本外,它工作得很好。目前,它创建的标签是普通文字和当前图层上的红色,但我们的公司标准要求多行文字。此外,对于黄色的多行文字和图层上的M_文字(使用此lisp时应已定义)
 
我需要一些帮助来理解这一点。我已经能够创建一些简单的Lisp程序,但理解这一个,我在一个有点超过我的头。lisp将创建管网并在直线段中放置标签。
 
我最大的目标是让它生成多行文字,然后颜色会很好,然后图层将是最后一个优先级,因为它很容易选择相似的内容并移动它。
 
你们能帮帮我吗?
 
  1. (defun bd( dpipepwd dpipeert)
  2. (if (not (tblsearch "LAYER" "axes"))
  3. (command "_.-layer"  "_m"  "axes" "_c" "1" "" "_lt" "center" "" "")
  4. )
  5. ;centerline properties format '("layer" "color" "ltype" "lweight")
  6. (setq dpropcln '("axes" "Bylayer" "Bylayer" ""))
  7. (if (not (tblsearch "LAYER" "patt"))
  8. (command "_.-layer"  "_m"  "patt" "_c" "8" "" "_lt" "continuous" "" "")
  9. )
  10. ;dproppat = hatching properties format '("name" "scale" "layer" "color" "ltype" "lweight")
  11. (setq dproppat '("ANSI32" 50.0 "patt" "Bylayer" "Bylayer" ""))
  12. (if (not (tblsearch "LAYER" "1"))
  13. (command "_.-layer"  "_m"  "1" "_c" "7" "" "_lt" "continuous" "" "")
  14. )
  15. ;dpropobj = objectline properties format '("layer" "color" "ltype" "lweight")
  16. (setq dpropobj '("1" "Bylayer" "Bylayer" ""))
  17. (ductmain "Radius" dpipeert (/ pi 12) "None" 3 dpipepwd dpipesuf nil)
  18. )
  19. ;dproptxt = text/label properties format '("style" "textsize" "layer" "color" "ltype" "lweight")
  20. ;(setq dproptxt '("Label" 0.1 "text" "Bylayer" "Bylayer" ""))
  21. ;(if (not (tblsearch "STYLE" "Label"))
  22. ;        (command "_.-style"  "Label"  "romans" 0.0 1.0 0.0 "_N" "_N" "_N")
  23. ;        )
  24. ;
  25. ;(ductmain "Mitered" 6 (/ pi 12) "None" 3 12 "x12" nil)
  26. ;(ductmain "Radius" "1.5" (/ pi 12) "All" 3 12 "%%c" nil)
  27. ;(defun c:tray( / LAY)
  28. ;;dproppat = hatching properties format '("name" "scale" "layer" "color" "ltype" "lweight")
  29. ;(setq dproppat '("MUDST" 4.0 "" "8" "Bylayer" ""))
  30. ;(ductmain "Chamfered" 6 (/ pi 12) "All" 2 nil " " nil)
  31. ;(defun c:pipe()
  32. ;(ductmain "Radius" "1.5" (/ pi 12) "None" 3 nil (strcat (if (= (getvar "MEASUREMENT") 0) """ "") "%%C") nil)
  33. ;(defun c:duct()
  34. ;(ductmain nil nil (/ pi 12) "None" nil nil nil nil)
  35. (defun ductmain ( dpipeelb dpipeert dpipetrn dpipepat dpipecln dpipepwd dpipesuf dpipefpt /
  36.       actDoc ang1 ang2 ang3 ptLst enDist
  37.        dlastfpt
  38.        dpipetan
  39.       dpiperad ; = specified radius
  40.       fPt lEnt lObj lPln oldVars oldWd
  41.        plEnd plStart1 plStart2 pwd
  42.        prDir dlp txEnt
  43.        OldLineType NewLineType
  44.        segLst Start stDist stLst tAng
  45.        vlaPln cFlg *error*
  46.       ;dpipewd
  47.       
  48.        )
  49. (vl-load-com)
  50. (defun GetPlineVer(plObj)
  51.    (mapcar 'cdr
  52.     (vl-remove-if-not
  53.      '(lambda(x)(=(car x)10))
  54.      (entget plObj)))
  55.    ); end of GetPLineVer
  56. (defun asmi-PlineSegmentDataList(plObj / cLst outLst)
  57.   (setq cLst
  58.    (vl-remove-if-not
  59.      '(lambda(x)(member(car x) '(10 40 41 42)))
  60.      (entget plObj))
  61.            outLst '()
  62.    ); end setq
  63. (while cLst
  64.    (if(assoc 40 cLst)
  65.      (progn
  66.       (setq outLst
  67.      (append outLst
  68.       (list
  69.         (list
  70.           (cdr(assoc 10 cLst))
  71.           (cdr(assoc 40 cLst))
  72.           (cdr(assoc 41 cLst))
  73.           (cdr(assoc 42 cLst))
  74.          ); end list
  75. ); end list
  76.      ); end if
  77. ); end setq
  78.       (repeat 4
  79. (setq cLst(cdr cLst))
  80. ); end repeat
  81.       ); end progn
  82.      (setq outLst
  83.      (append outLst
  84.      (list
  85.        (list
  86.         (cdr(assoc 10 cLst))
  87.         ); end list
  88.        ); end list
  89.     ); end append
  90.    cLst nil
  91.    ); end setq
  92.      ); end if
  93.    ); end while
  94. outLst
  95.    ); end of asmi-GetPlineSegmentData
  96. (defun asmi-LayersUnlock(/ restLst)
  97. (setq restLst '())
  98. (vlax-for lay
  99.    (vla-get-Layers
  100.             (vla-get-ActiveDocument
  101.               (vlax-get-acad-object)))
  102.    (setq restLst
  103.     (append restLst
  104.       (list
  105.         (list
  106.          lay
  107.           (vla-get-Lock lay)
  108.   (vla-get-Freeze lay)
  109.          ); end list
  110.         ); end list
  111.       ); end append
  112.    ); end setq
  113.    (vla-put-Lock lay :vlax-false)
  114.    (if
  115.      (vl-catch-all-error-p
  116. (vl-catch-all-apply
  117. 'vla-put-Freeze(list lay :vlax-false)))
  118.      t)
  119.    ); end vlax-for
  120. restLst
  121. ); end of asmi-LayersUnlock
  122. (defun asmi-LayersStateRestore(StateList)
  123. (foreach lay StateList
  124.    (vla-put-Lock(car lay)(cadr lay))
  125.     (if
  126.      (vl-catch-all-error-p
  127. (vl-catch-all-apply
  128. 'vla-put-Freeze(list(car lay)(nth 2 lay))))
  129.      t)
  130.    ); end foreach
  131. (princ)
  132.     ); end of asmi-LayersStateRestore
  133. (defun PipeMLineStyle(/ dxfLst mlDict)
  134. (setq dxfLst
  135.   (list'(0 . "MLINESTYLE")'(102 . "{ACAD_REACTORS")'(102 . "}")
  136.    '(100 . "AcDbMlineStyle") '(2 . "DUCT_PIPE")
  137.    '(70 . 274)'(3 . "")'(62 . 256)'(51 . 1.5708)'(52 . 1.5708)
  138.    '(71 . 2)'(49 . 0.5)'(62 . 256)'(6 . "BYBLOCK")
  139.    '(49 . -0.5)'(62 . 256)'(6 . "BYBLOCK"))); end setq
  140.    (if
  141.     (null
  142.      (member
  143.       (assoc 2 dxfLst)
  144.         (dictsearch
  145.   (namedobjdict)
  146.   "ACAD_MLINESTYLE")))
  147.    (progn
  148.      (setq mlDict
  149.       (cdr
  150.         (assoc -1
  151.   (dictsearch
  152.     (namedobjdict)
  153.     "ACAD_MLINESTYLE"))))
  154.      (dictadd mlDict
  155.         (cdr(assoc 2 dxfLst))(entmakex dxfLst))
  156.      ); end progn
  157.    ); end if
  158. ); end of PipeMLineStyle
  159. (defun SideCalculate(Wdth Ang / Rad)
  160. (setq Ang(- pi Ang))
  161. (setq Rad(+ (* 0.5 Wdth)(if (/= "Segmented" dpipeelb "Radius") 0.0 (if (numberp
  162. dpiperad) dpiperad (* (- (distof dpiperad) 0.5) Wdth))))
  163. )
  164. (+ (if (/= "Chamfered" dpipeelb "Mitered")
  165.      0
  166.      (if (= dpipeelb "Mitered")
  167.       dpipetan
  168.       (+ (* dpipetan 0.5) (/ dpipetan 2.0 (cos (/ Ang 2.0))))
  169.       )
  170.     )
  171.   (*
  172.    (/
  173.      (sqrt(-(* 2(expt Rad 2))(* 2(expt Rad 2)(cos Ang))))
  174.      (sin(- pi Ang)))(sin(/(- pi(- pi Ang))2.0)
  175.     )
  176.    )
  177.   )
  178. ); end of SideCalculate
  179. (defun BodyFunction()
  180. (if
  181.    (not
  182.      (equal lObj(entlast)))
  183. (progn
  184. (setq lEnt(entlast)
  185.        stLst(asmi-LayersUnlock)
  186.         segLst(asmi-PlineSegmentDataList lEnt)
  187.         vlaPln(vlax-ename->vla-object lEnt)
  188. ); end setq
  189. (setvar "OSMODE" 0)
  190. (setvar "CMDECHO" 0)
  191. (if (/= 1 (length segLst))
  192.     (progn
  193. (if (or (/= (type dpropcln) 'LIST) (not (equal (mapcar 'type dpropcln) '(STR STR STR STR))))
  194.           (setq dpropcln '("" "7" "Center2" ""));centerline properties format '("layer" "color" "ltype" "lweight")
  195.           )
  196.        (if (and (= (logand dpipecln 1) 1) (read (caddr dpropcln)) (not (member (strcase (caddr dpropcln)) '("BYBLOCK" "BYLAYER" "CONTINUOUS"))) (not (tblsearch "LTYPE" (caddr dpropcln))))
  197.           (command "_.linetype" "_l" (caddr dpropcln) (findfile (nth (getvar "MEASUREMENT") '("acad.lin" "acadiso.lin"))) "")
  198.           )
  199. (if (or (/= (type dproppat) 'LIST) (not (equal (mapcar 'type dproppat) '(STR REAL STR STR STR STR))))
  200.           (setq dproppat '("ANSI32" 50.0 "" "8" "" ""));hatching properties format '("name" "scale" "layer" "color" "ltype" "lweight")
  201.           )
  202.        (if (and (/= dpipepat "None") (read (nth 4 dproppat)) (not (member (strcase (nth 4 dproppat)) '("BYBLOCK" "BYLAYER" "CONTINUOUS"))) (not (tblsearch "LTYPE" (nth 4 dproppat))))
  203.           (command "_.linetype" "_l" (nth 4 dproppat) (findfile (nth (getvar "MEASUREMENT") '("acad.lin" "acadiso.lin"))) "")
  204.           )
  205. (if (or (/= (type dproptxt) 'LIST) (not (equal (mapcar 'type dproptxt) '(STR REAL STR STR STR STR))))
  206.           (setq dproptxt (list (getvar "TEXTSTYLE") (getvar "TEXTSIZE") "" "1" "" ""));text label properties format '("style" "textsize" "layer" "color" "ltype" "lweight")
  207.           )
  208.        );end progn
  209.     );end if
  210. (while (/= 1(length segLst))
  211.       (setq stDist
  212.       (vlax-curve-getDistAtPoint vlaPln
  213.         (caar segLst))
  214.      enDist
  215.       (vlax-curve-getDistAtPoint vlaPln
  216.         (caadr segLst))
  217.      ); end setq
  218.    (if(< 2(length segLst))
  219.      (progn
  220.       (setq ang1
  221.       (+(/ pi 2)(angle(caar segLst)(caadr segLst)))
  222.      ang2
  223.       (+(/ pi 2)(angle(caadr segLst)(car(nth 2 segLst))))
  224.      ); end setq
  225.       ); end progn
  226.      ); end if
  227.    (if
  228.      (or
  229. (not Start)
  230. prDir
  231. );end or
  232.       (setq plStart1
  233.        (vlax-curve-getPointAtDist vlaPln
  234.          stDist)
  235.      Start T); end setq
  236.       (setq plStart1
  237.        (vlax-curve-getPointAtDist vlaPln
  238.          (+ stDist(SideCalculate(cadar segLst)ang3)))); end setq
  239.      ); end if
  240.    (if(and ang1 ang2)
  241.      (progn
  242.      (if(> ang1 ang2)
  243. (setq ang3(- ang1 ang2))
  244. (setq ang3(- ang2 ang1))
  245. ); end if
  246.       (setq ang3(- pi ang3)
  247.      tAng ang3)
  248.       (if(minusp ang3)(setq ang3(- ang3)))
  249.       ); end progn
  250.      ); end if
  251.    (if
  252.      (or
  253.        (equal ang1 ang2 0.000001)
  254. (= 2(length segLst))
  255.       ); end or
  256.                (setq plEnd
  257.            (vlax-curve-getPointAtDist vlaPln
  258.            enDist)
  259.         prDir T); end setq
  260.          (setq plEnd
  261.            (vlax-curve-getPointAtDist vlaPln
  262.             (- enDist(SideCalculate(cadar segLst)ang3)))
  263.         prDir nil); end setq
  264.      ); end if
  265.    (if
  266.      (< 2(length segLst))
  267.       (setq plStart2
  268.        (vlax-curve-getPointAtDist vlaPln
  269.          (+ enDist(SideCalculate(cadar segLst)ang3)))); end setq
  270.      ); end if
  271.       (if(< 2(length segLst))
  272.        (if
  273.          (=(cadar segLst)(nth 2(car segLst)))
  274.           (setq ptLst
  275.                     (mapcar
  276.               '(lambda(x)(trans x 0 1)); end lambda
  277.                          (append
  278.                             (if (/= dpipeelb "Radius")
  279.                               (progn
  280.                                  (setq ang4 (apply '(lambda(x)(atan x (sqrt (abs (1- (* x x))))))
  281.                                    (list (sin (- ang1 (/ pi 2.0) (angle plEnd plStart2)))))
  282.                                    )
  283.                                  (setq SegNum (cond ((or (/= dpipeelb "Segmented") (< (abs ang4)
  284.                                    (* (/ 35 360.0) pi))) 2) ((< (abs ang4) (* (/ 55 360.0) pi)) 3)
  285.                                    ((< (abs ang4) (* (/ 75 360.0) pi)) 4) (T 5))
  286.                                    )
  287.                                  (setq tan4 (+ (if (= dpipeelb "Segmented") 0
  288.                             (if (= dpipeelb "Mitered")
  289.                                    dpipetan (+ (* dpipetan 0.5) (/ dpipetan 2.0 (cos ang4)))))
  290.                             (* (+ (* 0.5 (cadar segLst))
  291.                             (if (/= dpipeelb "Segmented") 0.0 (if (numberp
  292.                             dpiperad) dpiperad (* (- (distof dpiperad) 0.5) (cadar segLst)))))
  293.                                    (abs (apply '(lambda(x) (/ (sin x) (cos x))) (list (/ ang4
  294.                                    0.5 (1- SegNum) 2.0))))))
  295.                                    )
  296.                                  (setq mllst (list plEnd (polar plEnd (- ang1 (/ pi 2.0)) tan4)))
  297.                                  (setq SegCnt 0)
  298.                                  (while (< (+ SegCnt 2) SegNum)
  299.                                    (setq mllst (append mllst (list (polar (last mllst)
  300.                                                (+ (angle (cadr (reverse mllst)) (last mllst))
  301.                                                (/ ang4 -0.5 (1- SegNum))) (* tan4 2.0)))
  302.                                                )
  303.                                          SegCnt (1+ SegCnt)
  304.                                          )
  305.                                       )
  306.                                  (setq mllst (append mllst (list PlStart2)))
  307.                                  (setq SegCnt (- (length mllst) 2))
  308.                                  (setq pllst nil)
  309.                                  (if (and (= dpipeelb "Chamfered")
  310.                             (< (distance (polar plStart2 ang2 (/(cadar segLst)2)) (polar plEnd ang1 (/(cadar segLst)2)))
  311.                             (distance (polar plStart2 (+ pi ang2) (/(cadar segLst)2)) (polar plEnd (+ pi ang1) (/(cadar segLst)2)))))
  312.                             (setq pllst (list(polar (polar plStart2 ang2 (/(cadar segLst)2)) (+ ang2 (/ pi 2)) (* dpipetan 0.5))
  313.                                 (polar (polar plEnd ang1 (/(cadar segLst)2)) (- ang1 (/ pi 2)) (* dpipetan 0.5)))
  314.                                 )
  315.                                    (while (> SegCnt 0)
  316.                                      (setq pllst (append pllst (list (polar (nth SegCnt mllst)
  317.                                                  (+ (angle (nth (1- SegCnt) mllst) (nth SegCnt mllst))
  318.                                                  (/ pi 2.0) (/ ang4 0.5 (1- SegNum) -2.0))
  319.                                                  (/(cadar segLst)2(cos (/ ang4 0.5 (1- SegNum) 2.0)))))
  320.                                                  )
  321.                                            SegCnt (1- SegCnt)
  322.                                     )
  323.                                          )
  324.                                       )
  325. ;                                    )
  326.                                  pllst
  327.                                  )
  328.                                )
  329.                      (list(polar plEnd ang1 (/(cadar segLst)2)))
  330.                      (list(polar plEnd (+ pi ang1)(/(cadar segLst)2)))
  331.                             (if (/= dpipeelb "Radius")
  332.                               (progn
  333.                                  (setq SegCnt 1)
  334.                                  (setq pllst nil)
  335.                                  (if (and (= dpipeelb "Chamfered")
  336.                             (< (distance (polar plStart2 (+ pi ang2) (/(cadar segLst)2)) (polar plEnd (+ pi ang1) (/(cadar segLst)2)))
  337.                             (distance (polar plStart2 ang2 (/(cadar segLst)2)) (polar plEnd ang1 (/(cadar segLst)2)))))
  338.                             (setq pllst (list(polar (polar plEnd (+ pi ang1) (/(cadar segLst)2)) (- ang1 (/ pi 2)) (* dpipetan 0.5))
  339.                                 (polar (polar plStart2 (+ pi ang2) (/(cadar segLst)2)) (+ ang2 (/ pi 2)) (* dpipetan 0.5)))
  340.                                 )
  341.                                    (while (< SegCnt (1- (length mllst)))
  342.                                      (setq pllst (append pllst (list (polar (nth SegCnt mllst)
  343.                                                  (+ (angle (nth (1- SegCnt) mllst) (nth SegCnt mllst))
  344.                                                  (* pi 1.5) (/ ang4 0.5 (1- SegNum) -2.0))
  345.                                                  (/(cadar segLst)2(cos (/ ang4 0.5 (1- SegNum) 2.0)))))
  346.                                                  )
  347.                                            SegCnt (1+ SegCnt)
  348.                                     )
  349.                                          )
  350.                                       )
  351.                                 (setq mllst (mapcar '(lambda(x)(trans x 0 1)) mllst))
  352.                                 pllst
  353.                                 )
  354.                               )
  355.                      (list(polar plStart2 (+ pi ang2)(/(cadar segLst)2)))
  356.                      (list(polar plStart2 ang2 (/(cadar segLst)2)))
  357.                       ); end append
  358.                   ); end mapcar
  359.                 ); end setq
  360.          (setq ptLst
  361.            (mapcar
  362.             '(lambda(x)(trans x 0 1)); end lambda
  363.                (list (polar plStart1 ang1 (/(cadar segLst)2))
  364.                      (polar plStart1 (+ pi ang1)(/(cadar segLst)2))
  365.                      (polar(caadr segLst)(+ pi ang2)(/(nth 2(car segLst))2))
  366.                      (polar(caadr segLst)ang2(/(nth 2(car segLst))2))
  367.                      ); end list
  368.                   ); end mapcar
  369.                 ); end setq
  370.        ); end if
  371. ); end if
  372.      (setq plStart1(trans plStart1 0 1)
  373.       plEnd(trans plEnd 0 1)
  374.   ); end setq
  375.            (if plStart2
  376.                      (setq plStart2(trans plStart1 0 1))
  377.              ); end if
  378.       (if (< 2(length segLst))
  379.   (if (or (/=(cadar segLst)(nth 2(car segLst)))
  380.         (and (/= "Segmented" dpipeelb) (not(equal ang1 ang2 0.000001))
  381.                ); end and
  382.               ); end or
  383.             (progn
  384.                (setvar "PLINEWID" 0.0)
  385.                (command "_.pline")
  386.         (mapcar 'command ptLst)(command "_c")
  387.                (setvar "PLINEWID" dpipepWd)
  388.         (if (and (/= dpipepat "None") (or (/= (cadar segLst) (nth 2(car segLst))) (and (not (equal ang1 ang2 0.000001)) (= dpipepat "All") (/= "Radius" dpipeelb))))
  389.                    (command "_.hatch" (nth 0 dproppat) (nth 1 dproppat) (if (< (sin (* PI 0.125)) (abs (sin ang1)) (sin (* PI 0.375))) 45 0) "_l" "" "_.change" "_l" "" "_p" "_la" (nth 2 dproppat) "_c" (nth 3 dproppat) "_lt" (nth 4 dproppat) "_lw" (nth 5 dproppat) "")
  390.             )
  391.                (if (and (= (logand dpipecln 1) 1) (or (equal ang1 ang2 0.000001) (/= "Radius" dpipeelb)))
  392.                    (progn
  393.                       (setvar "PLINEWID" 0.0)
  394.                       (command "_.pline")
  395.                       (mapcar 'command (if (/= (cadar segLst) (nth 2(car segLst))) (list plStart1 plEnd) mlLst))
  396.                       (command "")
  397.                       (setvar "PLINEWID" dpipepWd)
  398.                       (command "_.change" "_l" "" "_p" "_la" (nth 0 dpropcln) "_c" (nth 1 dpropcln) "_lt" (nth 2 dpropcln) "_lw" (nth 3 dpropcln) "")
  399.                       ); end progn
  400.                    )
  401.         ); end progn
  402.      (if (and (= "Segmented" dpipeelb) (not(equal ang1 ang2 0.000001)))
  403.                (progn
  404. ;                   (command "_.mline" "_st" "DUCT_PIPE" "_S" (cadar segLst) "_J" "_Z")
  405. ;                   (mapcar 'command mlLst)
  406. ;                   (command "")
  407.                    (setvar "PLINEWID" 0.0)
  408.                    (setq SegCnt 0)
  409.                    (while (< SegCnt (1- SegNum))
  410.                       (command "_.line" (nth SegCnt ptlst)
  411.                          (nth (- (length ptlst) 3 SegCnt) ptlst)
  412.                          ""
  413.                          )
  414.                       (setq SegCnt (1+ SegCnt))
  415.                       )
  416.                    (command "_.pline")
  417.                    (mapcar 'command ptLst)(command "_c")
  418.                    (setvar "PLINEWID" dpipepWd)
  419.             (if (= dpipepat "All")
  420.                 (command "_.hatch" (nth 0 dproppat) (nth 1 dproppat) (if (< (sin (* PI 0.125)) (abs (sin ang1)) (sin (* PI 0.375))) 45 0) "_l" "" "_.change" "_l" "" "_p" "_la" (nth 2 dproppat) "_c" (nth 3 dproppat) "_lt" (nth 4 dproppat) "_lw" (nth 5 dproppat) "")
  421.                 )
  422.                    (if (= (logand dpipecln 1) 1)
  423.                        (progn
  424.                          (setvar "PLINEWID" 0.0)
  425.                          (command "_.pline")
  426.                          (mapcar 'command (if (= (logand dpipecln 3) 3) mlLst (list (car mlLst) (trans (caadr segLst) 0 1)  (last mlLst))))
  427.                          (command "")
  428.                          (setvar "PLINEWID" dpipepWd)
  429.                          (command "_.change" "_l" "" "_p" "_la" (nth 0 dpropcln) "_c" (nth 1 dpropcln) "_lt" (nth 2 dpropcln) "_lw" (nth 3 dpropcln) "")
  430.                          ); end progn
  431.                        ); end if
  432.                    ); end progn
  433.                 ); end if
  434.      ); end if
  435. ); end if
  436.    (if
  437.      (and (= dpipeelb "Radius")
  438.        (not(equal ang1 ang2 0.000001))
  439.        (< 2(length segLst))
  440.      ); end and
  441.      (progn
  442.               (setq lPln
  443.       (vlax-ename->vla-object(entlast))
  444.       tAng (abs (- ang2 ang1))
  445.      ); end setq
  446. (if (> tAng pi)
  447.    (if(< ang1 ang2)
  448.      (setq ang1(+ ang1 pi)
  449.            ang2(- ang2 pi)); end setq
  450.      (setq ang1(- ang1 pi)
  451.            ang2(+ ang2 pi)); end setq
  452.      ); end if
  453.           ); end if
  454. (setq Bulge(/(sin(/(rem(- ang2 ang1)pi)4.0))(cos(/(rem(- ang2 ang1)pi)4.0))))
  455. (vla-SetBulge lPln 1 Bulge)
  456. (vla-SetBulge lPln 3 (- Bulge))
  457. (if
  458.   (= dpipepat "All")
  459.     (progn
  460.         (command "_.hatch" (nth 0 dproppat) (nth 1 dproppat) (if (< (sin (* PI 0.125)) (abs (sin ang1)) (sin (* PI 0.375))) 45 0) "_l" "" "_.change" "_l" "" "_p" "_la" (nth 2 dproppat) "_c" (nth 3 dproppat) "_lt" (nth 4 dproppat) "_lw" (nth 5 dproppat) "")
  461.         )
  462.   )
  463.        (if (= (logand dpipecln 1) 1)
  464.          (progn
  465.            (setvar "PLINEWID" 0.0)
  466.            (command "_.pline")
  467.            (mapcar 'command (append (list (mapcar '/ (mapcar '+ (car ptLst) (cadr ptLst)) '(2.0 2.0 2.0))) (if (/= (logand dpipecln 3) 3) (list (trans (caadr segLst) 0 1))) (list (mapcar '/ (mapcar '+ (caddr ptLst) (last ptLst)) '(2.0 2.0 2.0)))))
  468.            (command "")
  469.            (if (= (logand dpipecln 3) 3) (vla-SetBulge (vlax-ename->vla-object(entlast)) 0 Bulge))
  470.            (setvar "PLINEWID" dpipepWd)
  471.            (command "_.change" "_l" "" "_p" "_la" (nth 0 dpropcln) "_c" (nth 1 dpropcln) "_lt" (nth 2 dpropcln) "_lw" (nth 3 dpropcln) "")
  472.            ); end progn
  473.          ); end if
  474.       ); end progn
  475. ); end if
  476. (if (or (=(cadar segLst)(nth 2(car segLst)))(= 2(length segLst)))
  477.       (progn
  478. ;                (if (=(cadar segLst)(nth 2(car segLst)))
  479. ;                        (command "_.mline" "_st" "DUCT_PIPE" "_S" (cadar segLst) "_J" "_Z" plStart1 plEnd "")
  480.                 (progn
  481.                         (setq ptLst
  482.                                 (list (polar plStart1 (+ (angle plStart1 plEnd) (/ pi 2.0)) (/(cadar segLst)2))
  483.                                      (polar plStart1 (- (angle plStart1 plEnd) (/ pi 2.0)) (/(cadar segLst)2))
  484.                                      (polar plEnd (- (angle plStart1 plEnd) (/ pi 2.0)) (/(nth 2(car segLst))2))
  485.                                      (polar plEnd (+ (angle plStart1 plEnd) (/ pi 2.0)) (/(nth 2(car segLst))2))
  486.                                      )
  487.                                 )
  488.                         (setvar "PLINEWID" 0.0)
  489.                                (command "_.pline")
  490.                         (mapcar 'command ptLst)(command "_c")
  491.                                (setvar "PLINEWID" dpipepWd)
  492.                         (if (/= dpipepat "None")
  493.                            (command "_.hatch" (nth 0 dproppat) (nth 1 dproppat) (if (< (sin (* PI 0.125)) (abs (sin ang1)) (sin (* PI 0.375))) 45 0) "_l" "" "_.change" "_l" "" "_p" "_la" (nth 2 dproppat) "_c" (nth 3 dproppat) "_lt" (nth 4 dproppat) "_lw" (nth 5 dproppat) "")
  494.                            )
  495.                         )
  496. ;                        )
  497.                (if (= (logand dpipecln 1) 1)
  498.                   (progn
  499.                      (setvar "PLINEWID" 0.0)
  500.                      (command "_.pline" plStart1 plEnd "")
  501.                      (setvar "PLINEWID" dpipepWd)
  502.                      (command "_.change" "_l" "" "_p" "_la" (nth 0 dpropcln) "_c" (nth 1 dpropcln) "_lt" (nth 2 dpropcln) "_lw" (nth 3 dpropcln) "")
  503.                      ); end progn
  504.                   )
  505.                (if (and (/= " " dpipesuf) (=(cadar segLst)(nth 2(car segLst))))
  506.                   (progn
  507.                 (command "_.text" "_s" (nth 0 dproptxt) "_j" "_mc" (mapcar '/ (mapcar '+ plStart1 plEnd) '(2.0 2.0 2.0)))
  508.                 (if (= (cdr (assoc 40 (tblsearch "style" (getvar "TEXTSTYLE")))) 0)
  509.                    (command (nth 1 dproptxt))
  510.                    )
  511.                 (command (if (and (> (setq tAng (/ (* 180 (angle plStart1 plEnd)) PI)) 112.5)(<= tAng 292.5)) (+ tAng 180) tAng) (strcat (rtos (cadar segLst)  (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) dpipesuf))
  512.                 (if (>= (atof (getvar "ACADVER")) 16.1)
  513.                   (progn
  514.                       (setq txEnt (entget (entlast)))
  515.                       (setq ptLst (textbox txEnt))
  516.                       (entdel (cdr (assoc -1 txEnt)))
  517.                       (setq txEnt (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (assoc 7 txEnt) (assoc 8 txEnt) (assoc 40 txEnt) (cons 1 (if (/= nil (cdr (assoc 51 txEnt)) 0)
  518.                           (strcat "{\\Q" (dectos (deg (cdr (assoc 51 txEnt)))) ";" (cdr (assoc 1 txEnt)) "}") (cdr (assoc 1 txEnt)))) (cons 10 (polar (polar (cdr (assoc 10 txEnt))
  519.                           (+ (cdr (assoc 50 txEnt)) (/ PI 2.0)) (+ (cadar ptLst) (/ (- (cadadr ptLst) (cadar ptLst)) 2.0))) (cdr (assoc 50 txEnt)) (+ (caar ptLst) (/ (- (caadr ptLst) (caar ptLst)) 2.0))))
  520.                           (assoc 210 txEnt) (assoc 50 txEnt) '(71 . 5) '(72 . 5) '(90 . 1) '(63 . 1) '(45 . 1.25))
  521.                           )
  522.                       (entmake txEnt)
  523.                       (setq txEnt (subst '(90 . 3) '(90 . 1) (entget (entlast))))
  524.                       (entmod txEnt)
  525.                       )
  526.                   )
  527.                 (command "_.change" "_l" "" "_p" "_la" (nth 2 dproptxt) "_c" (nth 3 dproptxt) "_lt" (nth 4 dproptxt) "_lw" (nth 5 dproptxt) "")
  528.                 ); end progn
  529.                   ); end if
  530.   ); end progn
  531.    ); end if
  532.    (setq segLst(cdr segLst)); end setq
  533.    ); end while
  534. (command "_.erase" lEnt "")
  535. (asmi-LayersStateRestore stLst)
  536. ); end progn
  537.    ); end if
  538.    ); end of Body Function
  539.    (defun *error*(msg)
  540.     (if actDoc
  541.      (vla-EndUndoMark actDoc)
  542.      ); end if
  543.     (setvar "CMDECHO" 0)
  544.     (command "_.undo" "1")
  545.     (if oldVars
  546.      (mapcar 'setvar
  547.      '("FILLMODE" "PLINEWID" "HPANG" "HPSCALE" "HPNAME" "CMDECHO" "OSMODE" "CLAYER" "CECOLOR" "CELTYPE" "CELWEIGHT")
  548.      oldVars); end mapcar
  549.     ); end if
  550.     (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "")))
  551.        (princ (strcat "\nError: " msg))
  552.        (princ)
  553.        )
  554.    ); end of *error*
  555. (PipeMLineStyle)
  556. (setq oldVars(mapcar 'getvar '("FILLMODE" "PLINEWID" "HPANG" "HPSCALE" "HPNAME" "CMDECHO" "OSMODE" "CLAYER" "CECOLOR" "CELTYPE" "CELWEIGHT"))
  557.        ); end setq
  558. (if(entlast)(setq lObj(entlast)))
  559. (vla-StartUndoMark
  560.   (setq actDoc
  561.    (vla-get-ActiveDocument
  562.      (vlax-get-acad-object))))
  563. (if (not (member dpipeelb '("Mitered" "Radius" "Segmented" "Chamfered")))
  564. (progn
  565.         (initget "Mitered Radius Segmented Chamfered")
  566.         (setq dpipeelb (getkword (strcat "\nSpecify elbow type "
  567.                 (if (= dlastelb "Chamfered") "<Chamfered>/" "Chamfered/")
  568.                 (if (= dlastelb "Mitered") "<Mitered>/" "Mitered/")
  569.                 (if (= dlastelb "Segmented") "<Segmented>/" "Segmented/")
  570.                 (if (not (member dlastelb '("Chamfered" "Mitered" "Segmented")))
  571.                 (strcat "<" (setq dlastelb "Radius") ">: ")
  572.                 "Radius: ")))
  573.                 )
  574.         )
  575. )
  576. (if (not (member dpipeelb '("Chamfered" "Mitered" "Radius" "Segmented"))) (setq dpipeelb dlastelb))
  577. (if (/= "Radius" dpipeelb "Segmented") (setq dpipetan dpipeert) (setq dpiperad dpipeert))
  578. (if (not (and (numberp dlastpwd) (< 0 dlastpwd))) (setq dlastpwd (if (= (getvar "MEASUREMENT") 0) 6.0 100.0)))
  579. (if (/= (type dlastsuf) 'STR) (setq dlastsuf (if (= (getvar "MEASUREMENT") 0) "x6" "x100")))
  580. (if (/= "Radius" dpipeelb "Segmented")
  581. (if (not (and (numberp dpipetan) (< 0 dpipetan)))
  582.         (progn
  583.                 (initget 6)
  584.                 (setq dpipetan (getdist (strcat "\nSpecify " (if (= dpipeelb "Mitered") "elbow throat" "diagonal chamfer") " length <"
  585.                         (rtos (if (not (and (numberp dlasttan) (< 0 dlasttan)))
  586.                         (setq dlasttan (if (= (getvar "MEASUREMENT") 0) 6.0 (if (= dpipeelb "Mitered") 100.0 150.0))) dlasttan)) ">: "))
  587.                         )
  588.                 (if (not (and (numberp dpipetan) (< 0 dpipetan))) (setq dpipetan dlasttan))
  589.                 )
  590.         )
  591. (while (not (or (and (numberp dpiperad) (< 0 dpiperad)) (and (= (type dpiperad) 'STR) (< 0 (distof dpiperad)))))
  592.         (initget 6 "Throat R÷w(d)")
  593.         (setq dpiperad (getdist (strcat "\nSpecify radius [" (if (and (= (type dpiperad) 'STR) (< 0 (distof dpiperad)))
  594.                 "<Throat>/R÷w(d)] <" "Throat/<R÷w(d)>] <") (cond ((and (numberp dlastrad) (< 0 dlastrad)) (rtos dlastrad))
  595.                 ((and (= (type dlastrad) 'STR) (< 0 (distof dlastrad))) (rtos (distof dlastrad) 2)) (T (rtos (setq dlastrad
  596.                 (if (= (getvar "MEASUREMENT") 0) 6.0 100.0))))) ">: "))
  597.                 )
  598.         (cond
  599.                 ((= dpiperad "Throat") (setq dpiperad nil dlastrad (if (numberp dlastrad) dlastrad  (* (- (distof dlastrad) 0.5) dlastpwd))))
  600.                 ((= dpiperad "R÷w(d)") (setq dpiperad nil dlastrad (if (numberp dlastrad) (rtos (* (/ dlastrad dlastpwd) 1.5) 2)  dlastrad)))
  601.                 ((numberp dpiperad) (setq dpiperad (if (numberp dlastrad) dpiperad (rtos dpiperad 2))))
  602.                 (T (setq dpiperad dlastrad))
  603.                 )
  604.         )
  605. )
  606. (if (not (and (numberp dpipetrn) (<= 0 dpipetrn (/ PI 2.0))))
  607. (setq dpipetrn (getangle (strcat "\nSpecify transition angle <"
  608.         (angtos (if (and (numberp dlasttrn) (<= 0 dlasttrn (/ PI 2.0))) dlasttrn (setq dlasttrn (/ PI 6.0))) 0)
  609.         ">: "))
  610.                 )
  611.        )
  612. (if (not (and (numberp dpipetrn) (<= 0 dpipetrn (/ PI 2.0)))) (setq dpipetrn dlasttrn))
  613. (if (not (member dpipepat '("All" "Straight" "None")))
  614. (progn
  615.         (initget "All Straight None")
  616.         (setq dpipepat (getkword (strcat "\nSpecify segments to hatch "
  617.                 (if (= dlastpat "All") "<All>/" "All/")
  618.                 (if (= dlastpat "Straight") "<Straight>/" "Straight/")
  619.                 (if (/= "All" dlastpat "Straight")
  620.                 (strcat "<" (setq dlastpat "None") ">: ")
  621.                 "None: ")))
  622.                 )
  623.         )
  624.        )
  625. (if (not (member dpipepat '("All" "Straight" "None"))) (setq dpipepat dlastpat))
  626. (if (not (member dpipecln '(0 1 2 3)))
  627. (progn
  628.         (initget "Yes No")
  629.         (setq dpipecln (getkword (strcat "\nWould you like to have centerline shown? <"
  630.                 (if (not (/= 1 dlastcln 3)) "Y>" (progn (setq dlastcln (if (= dlastcln 2) 2 0))"N>"))))
  631.                 )
  632.         (cond
  633.                 ((= dpipecln "Yes")(setq dpipecln (logior dlastcln 1)))
  634.                 ((= dpipecln "No") (setq dpipecln (logand dlastcln -2)))
  635.                 (T (setq dpipecln dlastcln))
  636.                 )
  637.         (if (and (= (logand dpipecln 1) 1) (/= "Chamfered" dpipeelb "Mitered"))
  638.                 (progn
  639.                         (initget "Yes No")
  640.                         (setq dpipecln (getkword (strcat "\nWould you like elbow centerlines filleted? <"
  641.                                 (if (= (logand dlastcln 2) 2) "Y>" "N>")))
  642.                                 )
  643.                         (cond
  644.                                 ((= dpipecln "Yes")(setq dpipecln 3))
  645.                                 ((= dpipecln "No") (setq dpipecln 1))
  646.                                 (T (setq dpipecln (logior dlastcln 1)))
  647.                                 )
  648.                         )
  649.                 )
  650.         )
  651. )
  652. (if (not (member dpipecln '(0 1 2 3))) (setq dpipecln dlastcln))
  653. (if (/= (type dpipesuf) 'STR)
  654. (progn
  655.         (initget "Yes No")
  656.         (setq dpipesuf (getkword (strcat "\nWould you like to have size label shown? <"
  657.                 (if (and (= (type dlastsuf) 'STR) (/= " " dlastsuf)) "Y>" (progn (if (/= (type dlastsuf) 'STR) (setq dlastsuf " "))"N>"))))
  658.                 )
  659.         (cond
  660.                 ((= dpipesuf "Yes")(setq dpipesuf (if (/= " " dlastsuf) dlastsuf "")))
  661.                 ((= dpipesuf "No") (setq dpipesuf " "))
  662.                 (T (setq dpipesuf dlastsuf))
  663.                 )
  664.         )
  665. )
  666. (if (/= (type dpipesuf) 'STR) (setq dpipesuf dlastsuf) (setq dlastsuf dpipesuf))
  667. (if (not (and (numberp dpipepwd) (< 0 dpipepwd))) (setq dpipepwd dlastpwd) (setq dlastpwd dpipepwd))
  668. (if (or (/= (type dpropobj) 'LIST) (not (equal (mapcar 'type dpropobj) '(STR STR STR STR))))
  669.      (setq dpropobj '("" "" "" ""));objectline properties format '("layer" "color" "ltype" "lweight")
  670.      )
  671. (setvar "CMDECHO" 0)
  672. (if (and (read (caddr dpropobj)) (not (member (strcase (caddr dpropobj)) '("BYBLOCK" "BYLAYER" "CONTINUOUS"))) (not (tblsearch "LTYPE" (caddr dpropobj))))
  673.      (command "_.linetype" "_l" (caddr dpropobj) (findfile (nth (getvar "MEASUREMENT") '("acad.lin" "acadiso.lin"))) "")
  674.      )
  675. (command "_.clayer" (nth 0 dpropobj) "_.cecolor" (nth 1 dpropobj) "_.celtype" (nth 2 dpropobj) "_.celweight" (nth 3 dpropobj))
  676. (while (not (and (numberp dpipepWd) (< 0 dpipepWd) (= 'LIST (type dpipefpt)) (<= 2 (length dpipefpt) 3) (apply 'and (mapcar 'numberp dpipefpt))))
  677. (if (/= " " dpipesuf)
  678.         (progn
  679.                 (initget 128 "Suffix Width")
  680.                 (setq dlastfpt (getpoint (strcat "\nSpecify start point or [Width/Suffix] <"
  681.                         (rtos dlastpWd (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) (vl-string-subst "Ø" "%%C" (vl-string-subst "Ø" "%%c" dlastsuf)) ">: " ))
  682.                         ); end setq
  683.                 )
  684.             (setq dlastfpt (getpoint (strcat "\nSpecify start point or width <"
  685.                 (rtos dlastpWd (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) ">: " ))
  686.                 ); end setq
  687.         )
  688. (cond
  689.         ((and (= 'LIST (type dlastfpt)) (<= 2 (length dlastfpt) 3) (apply 'and (mapcar 'numberp dlastfpt)))
  690.                 (setq dpipefpt dlastfpt)
  691.                 ); end condition #1
  692.         ((and (= 'REAL (type (distof dlastfpt))) (< 0 (distof dlastfpt)))
  693.                 (setq dpipepWd (distof dlastfpt) dlastpWd dpipepWd); end setq
  694.                 ); end condition #2
  695.         ((= dlastfpt "Width")
  696.                 (initget 128)
  697.                 (setq dpipepWd (getdist (strcat "\nSpecify starting width <" (rtos dlastpWd (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) ">: ")) dlastpWd dpipepWd); end setq
  698.                 ); end condition #3
  699.         ((= dlastfpt "Suffix")
  700.                 (initget 128)
  701.                 (setq dpipesuf (getstring (strcat "\nEnter text for suffix <" (vl-string-subst "Ø" "%%C" (vl-string-subst "Ø" "%%c" dlastsuf)) ">: " ))
  702.                         dlastsuf dpipesuf); end setq
  703.                 ); end condition #4
  704.         (T
  705.                 (princ "\nInvalid option keyword! ")
  706.                 ); end condition #5
  707.         ); end cond
  708. ); end while
  709. (mapcar 'setvar '("FILLMODE" "PLINEWID" "CMDECHO") (list 0 dpipepWd 0))
  710. (setq ERRENT (entlast))
  711. (command "_.pline" dpipefpt)
  712. (setq DLP (list dpipefpt))
  713. (while (= (getvar "CMDNAMES") "PLINE")
  714. (setvar "CMDECHO" 0)
  715. (initget (strcat "Width " (if (/= " " dpipesuf) "Suffix " "") "Undo"))
  716. (setq PNT (getpoint (last DLP) (strcat "\nSpecify next point" (if (>= (length DLP) 2) (strcat " or [undo/Width" (if (/= " " dpipesuf) "/Suffix" "") "]") "") ": ")))
  717. (cond
  718.         ((/= (getvar "CMDNAMES") "PLINE"))
  719.         ((= PNT "Width")
  720.                 (setq PWD (getvar "PLINEWID"))
  721.                 (princ (strcat "\nSpecify ending width <" (rtos (getvar "PLINEWID") (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) ">: "))
  722.                 (command "_Width" "" PAUSE)
  723.                 (cond
  724.                         ((or (= PWD (getvar "PLINEWID")) (<= (distof (angtos dpipetrn 0 16)) 0) (> (distof (angtos dpipetrn 0 16)) 90)))
  725.                         ((= (distof (angtos dpipetrn 0 16)) 90)
  726.                                 (setq PWD (getvar "PLINEWID"))
  727.                                 (command (getvar "LASTPOINT") "_u" (getvar "LASTPOINT") "_w" PWD PWD)
  728.                                 )
  729.                         (T
  730.                                 (command (last (setq DLP (append DLP (list (polar (getvar "LASTPOINT") (angle (cadr (reverse DLP)) (last DLP))
  731.                                         (/ (abs (- PWD (getvar "PLINEWID"))) 2.0 (/ (sin dpipetrn) (cos dpipetrn))))))))
  732.                                         )
  733.                                 )
  734.                         )
  735.                 )
  736.         ((= PNT "Suffix")
  737.                 (initget 128)
  738.                 (setq dpipesuf (getstring (strcat "\nEnter text for suffix <" (vl-string-subst "Ø" "%%C" (vl-string-subst "Ø" "%%c" dlastsuf)) ">: " ))
  739.                         )
  740.                 (if (/= dpipesuf dlastsuf)
  741.                         (progn
  742.                                 (mapcar 'set '(dpipesuf dlastsuf) (list dlastsuf dpipesuf))
  743.                                 (setq        dlastpwd (getvar "PLINEWID")
  744.                                         dlastfpt (last DLP)
  745.                                         DLP (list dlastfpt)
  746.                                         )
  747.                                 (while (= (getvar "CMDNAMES") "PLINE") (command ""))
  748.                                         (BodyFunction)
  749.                                 (setq        dpipesuf dlastsuf)
  750.                                 (setvar "PLINEWID" dlastpwd)
  751.                                 (command "_.pline" dlastfpt)
  752.                                 )
  753.                         )
  754.                 )
  755.         ((= PNT "Undo")
  756.                 (command "_Undo")
  757.                 (setq DLP (reverse (cdr (reverse DLP))))
  758.                 )
  759.         ((and (= 'LIST (type PNT)) (<= 2 (length PNT) 3) (apply 'and (mapcar 'numberp PNT)))
  760.                 (command PNT)
  761.                 (setq DLP (append DLP (list PNT)))
  762.                 )
  763.         ((command PNT))
  764.         )
  765. )
  766. ; (while (= (getvar "CMDNAMES") "PLINE")
  767. ;        (setvar "CMDECHO" 0)
  768. ;        (princ (strcat "\nSpecify next point" (if (>= (length DLP) 2) " or [undo/Width/Suffix]" "") ": "))
  769. ;        (command PAUSE)
  770. ;        (initget "Width Suffix Undo")
  771. ;        (getpoint (last DLP) (strcat "\nSpecify next point" (if (>= (length DLP) 2) " or [undo/Width/Suffix]" "") ": "))
  772. ;        (cond
  773. ;                ((/= (getvar "CMDNAMES") "PLINE"))
  774. ;                ((and (equal (getvar "LASTPOINT") (last DLP)) (wcmatch (strcase (getvar "LASTPROMPT")) "*: W,*: W[i ],*: WI[D ],*: WID[T ],*: WIDTH,*: WIDTH "))
  775. ;                        (setq PWD (getvar "PLINEWID"))
  776. ;                        (princ (strcat "\nSpecify ending width <" (rtos (getvar "PLINEWID") (if (= (getvar "DIMLUNIT") 4) 5 (getvar "DIMLUNIT"))) ">: "))
  777. ;                        (command "" PAUSE)
  778. ;                        (cond
  779. ;                                ((or (= PWD (getvar "PLINEWID")) (<= (distof (angtos dpipetrn 0 16)) 0) (> (distof (angtos dpipetrn 0 16)) 90)))
  780. ;                                ((= (distof (angtos dpipetrn 0 16)) 90)
  781. ;                                        (setq PWD (getvar "PLINEWID"))
  782. ;                                        (command (getvar "LASTPOINT") "_u" (getvar "LASTPOINT") "_w" PWD PWD)
  783. ;                                        )
  784. ;                                (T
  785. ;                                        (command (last (setq DLP (append DLP (list (polar (getvar "LASTPOINT") (angle (cadr (reverse DLP)) (last DLP))
  786. ;                                                (/ (abs (- PWD (getvar "PLINEWID"))) 2.0 (/ (sin dpipetrn) (cos dpipetrn))))))))
  787. ;                                                )
  788. ;                                        )
  789. ;                                )
  790. ;                        )
  791. ;                ((and (equal (getvar "LASTPOINT") (last DLP)) (wcmatch (strcase (getvar "LASTPROMPT")) "*: S,*: S[u ],*: SU[F ],*: SUF[F ],*: SUFF[i ],*: SUFFI[X ],*: SUFFIX "))
  792. ;                        (initget 128)
  793. ;                        (setq dpipesuf (getstring (strcat "\nEnter text for suffix <" (vl-string-subst "Ø" "%%C" (vl-string-subst "Ø" "%%c" dlastsuf)) ">: " ))
  794. ;                                dlastsuf dpipesuf
  795. ;                                )
  796. ;                        )
  797. ;                ((and (equal (getvar "LASTPOINT") (last DLP)) (wcmatch (strcase (getvar "LASTPROMPT")) "*: U,*: UN,*: UND,*: UNDO"))
  798. ;                        (setq DLP (reverse (cdr (reverse DLP))))
  799. ;                        )
  800. ;                ((setq DLP (append DLP (list (getvar "LASTPOINT")))))
  801. ;                )
  802. ;        )
  803. (setq dlastpwd (getvar "PLINEWID"))
  804. (BodyFunction)
  805. (vla-EndUndoMark actDoc)
  806. (mapcar 'setvar
  807.      '("FILLMODE" "PLINEWID" "HPANG" "HPSCALE" "HPNAME" "CMDECHO" "OSMODE")
  808.      oldVars); end apply
  809. (command "_.regen")
  810. (setq dlastelb dpipeelb dlasttan dpipetan dlastrad dpiperad dlasttrn dpipetrn dlastpat dpipepat dlastcln dpipecln dlastsuf dpipesuf)
  811. (princ)
  812. ); end of ductmain
  813. (defun c:ductmain()
  814. (ductmain nil nil nil nil nil nil nil nil)
  815. )
回复

使用道具 举报

16

主题

69

帖子

54

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-5 16:26:37 | 显示全部楼层
我不知道这个例程在做什么,因为我的AutoCAD在运行它时会出错。
然而,您要查找的内容似乎位于第521行:
 
  1. (command "_.text" "_s" (nth 0 dproptxt) "_j" "_mc" (mapcar '/ (mapcar '+ plStart1 plEnd) '(2.0 2.0 2.0)))

 
目前它正在使用text命令。只需更改它即可使用mtext命令。一个困难是,这两种观点不同。我自己不能完全测试它,但我想你可以把这一行改成以下几行:
 
  1. (command "_.mtext" plStart1 "_s" (nth 0 dproptxt) "_j" "_mc" plEnd)

 
或者类似的东西。我希望这至少足以让你开始。
回复

使用道具 举报

16

主题

69

帖子

54

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-5 16:32:30 | 显示全部楼层
嗯,看起来我也有点过头了。似乎第525行已经在生成多行文字。无论是谁编写了这段代码,似乎都包含了这一功能。我必须先看看代码做了什么,然后才能真正判断哪些部分需要修复。也许有一个变量设置可以调整为使用正确的文本对象类型?
 
此外,我完全掩盖了颜色部分。变量dproptxt似乎具体包含颜色信息(nth 3 dproptext)。将其设置为2会导致默认为黄色。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:49:52 | 显示全部楼层
有几件事代码似乎是由ASMI编写的,但在代码头中没有任何确认信息等。需要检查的代码很多,但更改为多行文字。主要的是颜色,可以按层或颜色。{\fArial | b0 | i0 | c0 | p34;\C1;这是宋体红色1},因此您需要制作多行文字并更改文本字符串中的颜色设置。我知道我和李做了一些关于改变颜色的事情,我会努力找到它张贴在这里。
回复

使用道具 举报

1

主题

4

帖子

3

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:54:21 | 显示全部楼层
Benhubel,
 
谢谢你调查。你犯了什么错误?加载后使用lisp的命令是DuctMain。
 
至于(nth 3 dproptxt)代码,使用word进行查找和替换。。。。这段代码似乎有很多地方也使用了3以外的数字,这有点令人困惑,因为当我运行lisp时,文本确实是红色的。
 
比加尔,
 
嗨,ASMI是用户吗?如果我知道该归功于谁,我很乐意再加上一句致谢。我发现代码以“wpipe12”的形式提供,可以在另一个站点上免费使用。
 
关于红色arial文本,如果程序无法找到当前的文本样式,我相信这是一个备份。有趣的是,它采用了我在图形中预定义的样式(当我单击创建的文本并选择“属性”时,它会显示样式的名称),但是它是多行文字样式,但它的字体(单纯形)与普通文本一样正确。主要问题是,没有多行文字,就没有多行文字编辑器。
 
谢谢你的帮助!
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:11:52 | 显示全部楼层
http://www.cadtutor.net/forum/showthread.php?43876-AsmiTools公司
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-14 13:08 , Processed in 2.213140 second(s), 65 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表