乐筑天下

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

[编程交流] 引线到多重引线编辑。UCS mo

[复制链接]

56

主题

256

帖子

230

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
253
发表于 2022-7-5 15:15:19 | 显示全部楼层 |阅读模式
我只学了几个星期的Lisp程序,所以C&C是最受欢迎的。
 
 
链接到视频:
 
 
我最常用的口吃之一是LeaderToMleader。LSP。在此处找到。
 
它上次更新是在很多个月前,所以我决定尝试学习并修改它以适应。非常感谢原作者莱尔·哈丁。
 
我只是需要一些关于如何让UCS使用它的指导。
编辑。使用TRANS-fn。它工作正常。稍微调整了一下,但我成功了。请测试。
 
下面是我在代码顶部更改的内容列表:
主要有:
 
[列表=1]
  • 多选-用户现在可以同时选择引线和多行文字,而不再单独选择,从而实现更快的转换。
  • Strip text-Of formatting option-LM:LeeMac编写的UnFormat fn。
  • 注释支持-程序只是将(entget)对象与(entlast)对象匹配。借助于艾伦·J·汤普森(AlanJ.Thompson)的《AT:isAnnotative》。
  • 大小写转换-使用(load“tcasessup.lsp”)内置fns-选项:Titlecase小写大写句子Case toGglecase Keepcase
  • 顶点-引线到多重引线现在支持2或3个点。(旧方法只有2)。它使用引线的第一个、第二个(如果适用)和最后一个顶点。第四个顶点或更多顶点将被删除。
  • 文字旋转-现在保留多行文字旋转。
  • 撤消级别-与每次执行一个命令相反。
    [/列表]
     
    PS.计算引线点的起点和多行文字的位置之间的距离,然后将每个最接近的对作为多重引线,这有多容易。那太酷了。
     
    1. ;;;        CADALYST 08/08 www.cadalyst.com/code
    2. ;                Tip 2305: Leader_To_Multileader.lsp LEADER to Multileader (c) 2008 Lyle Hardin
    3. ;                Pick an old style LEADER and text to create a new MLEADER entity and erase the old LEADER and text.
    4. ;                March/2008
    5. ;;;        EDITED ON 15/04/2017 BY 3DWANNAB
    6. ;                Reason for creating this, was to learn and create a LISP that I use on a regular basis.
    7. ;                Commandline Syntax: Type "Leader_To_Multileader" OR "LTM" to run Program.
    8. ;
    9. ;                ADDED        -        Case Conversion.
    10. ;                                                OPTIONS:
    11. ;                                                Titlecase Lowercase Uppercase Sentencecase toGglecase Keepcase.
    12. ;
    13. ;                ADDED        -        Annotation support. Program simply matches the (entget) object to that of the (entlast) object. With the help of AT:isAnnotative written by Alan J. Thompson.
    14. ;                ADDED        -        Custom LM:ssget fn written by LeeMac.
    15. ;                ADDED        -        Multiple Selection. User can now select the LEADER and MTEXT together and no longer individually resulting in a much faster conversion.
    16. ;                ADDED        -        Round off points - To nearest round number. That been 1. round fn written by Doug Broad. Additional credits to Joe Burke, Peter Toby.
    17. ;                ADDED        -        Strip MTEXT - Of formatting option - LM:UnFormat fn written by LeeMac.
    18. ;                ADDED        -        Text Rotation - MTEXT rotation is now preserved.
    19. ;                ADDED        -        Undo levels - As opposed to one command at a time.
    20. ;                ADDED        -        Picking of existing MLEADER to use as new style.
    21. ;                                                RMB-SPACEBAR-ENTER to skip this step and use the current MLEADER style
    22. ;                                                SETTINGS TRANSLATED IF PICKED:
    23. ;                                                (vla-put-Layer newmleader existingMlLayer)
    24. ;                                                (vla-put-ScaleFactor newmleader existingMlScale)
    25. ;                                                (vla-put-StyleName newmleader existingMlStyle)
    26. ;                                                (vla-put-TextWidth newmleader existingMlWidth)
    27. ;
    28. ;                                                SETTINGS TRANSLATED IF NOT:
    29. ;                                                (vla-put-Layer newmleader existingTxtLayer)
    30. ;                                                (vla-put-TextRotation newmleader existingTxtRot)
    31. ;                                                (vla-put-TextWidth newmleader existingTxtWidth)
    32. ;
    33. ;                CHG                -        Changed to 'vla-get-TextString' as more robust.
    34. ;                CHG                -        Moved new MLEADER to TEXT Layer as opposed to existing LEADER.
    35. ;                CHG                -        Picking never fails, prompts user to keep picking until successful. LM:SelectIf fn written by LeeMac.
    36. ;                FIX                -        ACADs built in functions to convert ill-formatted MTEXT creates a bug in the string result. LM:StringSubst by LeeMac.
    37. ;                FIX                -        End position of MLEADER.
    38. ;                FIX                -        Z coordinate to 0, resulting in no fuzzy text.
    39. ;                FIX                -        Forces the MLEADER to be created from the 'LEADER arrowHead first' resulting in correct results all the time.
    40. ;                FIX                -        Vertices, Leader_To_Multileader now supports 2 or 3 points.
    41. ;                                                If 2 (Straight) it straightens the MLEADER up to the Y axis of the LEADER point for those LEADERS at an angle.
    42. ;                                                If 3 (Dog Legged) it recreates those as they originally were.
    43. ;                                                If <3 (Multiple) it recreates the 1st, 2nd & end point point of the original LEADER. The 4th vert or more, will get removed.
    44. ;                                                NOTE: Not really any need for more than 3 points on an MLEADER, I don't think.
    45. ;
    46. ;;; KNOWN QUIRKS, BUGS
    47. ;                Works in different UCSs, if you are fixing MTEXT & LEADERS which are upside down then the new MLEADER might be a little wacky.
    48. ;
    49. ;;; FUTURE ADDITIONS
    50. ;                Convert based on how close the LEADER and MTEXT are away from each other. To enable multiple selection.
    51. ;
    52. ;;; COMMENT OUT
    53. ;                First off, Big THANKS to Lyle Hardin for the original code.
    54. ;                Big THANKS to LeeMac for the functions he has put up on his website.
    55. ;                        Finally getting the basics of this LISP'ing lark thanks to guys like him.
    56. ;                Lots of other places on forums and Users too. To many users to mention.
    57. ;                Let me know your thoughts on this Program or if you want to drop a Thank you.
    58. ;                        e. stephensherry147@yahoo.co.uk
    59. (defun c:LTM nil (c:Leader_To_Multileader))
    60. (defun c:Leader_To_Multileader ( /
    61. *error*
    62. cmde
    63. entLeader
    64. entLeaderName
    65. entTxt
    66. entTxtName
    67. entTxtVlaObj
    68. existingMlScale
    69. existingMlStyle
    70. existingMlvlaObj
    71. existingMlWidth
    72. existingTxtLayer
    73. existingTxtRot
    74. existingTxtString
    75. existingTxtWidth
    76. ldxf10_1
    77. ldxf10_2
    78. ldxf10_last
    79. lstleaderlen
    80. lstleaderpts
    81. os
    82. ss1
    83. ss2
    84. )
    85. (defun *error* (errmsg)
    86. (and acDoc (vla-EndUndoMark acDoc))
    87. (and errmsg
    88.         (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
    89.         (princ (strcat "\n<< Error: " errmsg " >>"))
    90.         )
    91. (setvar 'cmdecho cmde)
    92. (setvar 'osmode os)
    93. )
    94. (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
    95. (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc))
    96. (setq cmde (getvar "cmdecho"))
    97. (setq os (getvar "osmode"))
    98. (setvar 'cmdecho 0)
    99. (setvar 'osmode 0)
    100. (if
    101. (setq ss1
    102.         (car
    103.                 (LM:SelectIf
    104.                         (strcat
    105.                                 "\nSelect an existing MULTILEADER to use as the new style\nor RMB-SPACEBAR-ENTER to use current: '"
    106.                                 (getvar "cmleaderstyle") "'."
    107.                                 )
    108.                         (lambda ( x ) (eq "MULTILEADER" (cdr (assoc 0 (entget (car x)))))) entsel nil
    109.                         )
    110.                 )
    111.         )
    112. (progn
    113.         (setq existingMlvlaObj (vlax-ename->vla-object ss1)
    114.                 existingMlLayer (vla-get-Layer existingMlvlaObj)
    115.                 existingMlStyle (vla-get-StyleName existingMlvlaObj)
    116.                 existingMlWidth (vla-get-TextWidth existingMlvlaObj)
    117.                 )
    118.         (if        (/= T (AT:isAnnotative ss1))
    119.                 (setq existingMlScale (vla-get-ScaleFactor existingMlvlaObj))
    120.                 )
    121.         (princ (strcat "\nStyle to use: ' " existingMlStyle " '"))
    122.         )
    123. )
    124. (initget "Titlecase Lowercase Uppercase Sentencecase toGglecase Keepcase")
    125. (setq ansCase
    126. (cond
    127.         (
    128.                 (getkword
    129.                         (strcat "\nChoose Text Case : [Title case/Lower case/Upper case/Sentence case/toGgle case/Keep case] <"
    130.                                 (setq ansCase
    131.                                         (cond ( ansCase ) ( "Keepcase" ))
    132.                                         )
    133.                                 ">: "
    134.                                 )
    135.                         )
    136.                 )
    137.         ( ansCase )
    138.         )
    139. )
    140. (initget "Keepformatting Removeformatting")
    141. (setq ansFromatting
    142. (cond
    143.         (
    144.                 (getkword
    145.                         (strcat "\nChoose Formatting : [Keep formatting/Remove formatting] <"
    146.                                 (setq ansFromatting
    147.                                         (cond ( ansFromatting ) ( "Keepformatting" ))
    148.                                         )
    149.                                 ">: "
    150.                                 )
    151.                         )
    152.                 )
    153.         ( ansFromatting )
    154.         )
    155. )
    156. (while
    157. (setq ss2
    158.         (LM:ssget "\nSelect 1 LEADER & 1 MTEXT: "
    159.                 (list "_:L"
    160.                         (append '(
    161.                                 (-4 . "<OR")
    162.                                 (0 . "MTEXT")
    163.                                 (0 . "LEADER")
    164.                                 (-4 . "OR>")
    165.                                 )
    166.                         )
    167.                         )
    168.                 )
    169.         )
    170. (if (/= (sslength ss2) 2)
    171.         (progn
    172.                 (alert "Select only 1 MTEXT and 1 LEADER.")
    173.                 (princ "        >>> 'LTM' failed selection, try again ...")(princ)
    174.                 )
    175.         (progn
    176.                 (if (= (cdr (assoc 0 (entget (ssname ss2 0)))) "LEADER")
    177.                         (setq
    178.                                 entLeader (entget (ssname ss2 0))
    179.                                 entTxt (entget (ssname ss2 1))
    180.                                 )
    181.                         (setq
    182.                                 entLeader (entget (ssname ss2 1))
    183.                                 entTxt (entget (ssname ss2 0))
    184.                                 )
    185.                         )
    186.                 (if
    187.                         (or (and (eq (dxf 0 entLeader) "LEADER") (eq (dxf 0 entTxt) "LEADER"))
    188.                                 (and (eq (dxf 0 entLeader) "MTEXT") (eq (dxf 0 entTxt) "MTEXT")))
    189.                         (progn
    190.                                 (alert "Please, check your Selection !\n\nSelect only 1 MTEXT and 1 LEADER.")
    191.                                 (princ "        >>> 'LTM' failed selection, try again ...")(princ)
    192.                                 )
    193.                         (progn
    194.                                 (setq
    195.                                         entLeaderName (dxf -1 entLeader)
    196.                                         entTxtName (dxf -1 entTxt)
    197.                                         existingTxtLayer (dxf 8 entTxt)
    198.                                         entTxtVlaObj (vlax-ename->vla-object entTxtName)
    199.                                         existingTxtString (vla-get-TextString entTxtVlaObj)
    200.                                         existingTxtWidth (dxf 41 entTxt)
    201.                                         existingTxtRot (dxf 50 entTxt)
    202.                                         lstleaderpts (vl-remove-if-not
    203.                                                 '(lambda (p) (eq (car p) 10))
    204.                                                 entLeader
    205.                                                 )
    206.                                         lstleaderlen (length lstleaderpts)
    207.                                         ldxf10_1 (cdr (car lstleaderpts))
    208.                                         ldxf10_1 (mapcar '(lambda (x)
    209.                                                 (round x 1)
    210.                                                 )
    211.                                         ldxf10_1
    212.                                         )
    213.                                         ldxf10_2 (if (>= lstleaderlen 3)
    214.                                                 (cdr (nth (- lstleaderlen 2) lstleaderpts))
    215.                                                 )
    216.                                         ldxf10_2 (mapcar '(lambda (x)
    217.                                                 (round x 1)
    218.                                                 )
    219.                                         ldxf10_2
    220.                                         )
    221.                                         ldxf10_last (if (< lstleaderlen 3)
    222.                                                 (list (car (dxf 10 entTxt)) (cadr ldxf10_1) (caDDr (dxf 10 entTxt)))
    223.                                                 (list (car (dxf 10 entTxt)) (cadr ldxf10_2) (caDDr (dxf 10 entTxt)))
    224.                                                 ; (list (car (dxf 10 entTxt)) (cadr ldxf10_1) 0)
    225.                                                 ; (list (car (dxf 10 entTxt)) (cadr ldxf10_2) 0)
    226.                                                 )
    227.                                         ldxf10_last (mapcar '(lambda (x)
    228.                                                 (round x 1)
    229.                                                 )
    230.                                         ldxf10_last
    231.                                         )
    232.                                         )
    233.                                 (cond
    234.                                         ((=  "Keepformatting" ansFromatting)
    235.                                                 )
    236.                                         ((= "Removeformatting" ansFromatting)
    237.                                                 (setq existingTxtString (LM:UnFormat existingTxtString nil))
    238.                                                 )
    239.                                         )
    240.                                 (progn
    241.                                         (if (>= lstleaderlen 3)
    242.                                                 (progn
    243.                                                         (command "._MLEADER" "_L" "_H" "_O" "_M" 3 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_2 0 1) "_non" (trans ldxf10_last 0 1) "")
    244.                                                         )
    245.                                                 (progn
    246.                                                         (command "._MLEADER" "_L" "_H" "_O" "_M" 2 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_last 0 1) "")
    247.                                                         )
    248.                                                 )
    249.                                         (setq newmleader (vlax-ename->vla-object (entlast)))
    250.                                         (cond
    251.                                                 ((=  "Titlecase" ansCase)
    252.                                                         (setq existingTxtString (acet-tcase-change-string existingTxtString "TITLE"))
    253.                                                         )
    254.                                                 ((= "Lowercase" ansCase)
    255.                                                         (setq existingTxtString (acet-tcase-change-string existingTxtString "LOWER"))
    256.                                                         )
    257.                                                 ((= "Uppercase" ansCase)
    258.                                                         (setq existingTxtString (acet-tcase-change-string existingTxtString "UPPER"))
    259.                                                         )
    260.                                                 ((= "Sentencecase" ansCase)
    261.                                                         (setq existingTxtString (acet-tcase-change-string existingTxtString "SENTENCE"))
    262.                                                         )
    263.                                                 ((= "toGglecase" ansCase)
    264.                                                         (setq existingTxtString (acet-tcase-change-string existingTxtString "TOGGLE"))
    265.                                                         )
    266.                                                 ((= "Keepcase" ansCase)
    267.                                                         (setq existingTxtString existingTxtString)
    268.                                                         )
    269.                                                 )
    270.                                         (setq existingTxtString (LM:StringSubst "\\\H" "\\\h" existingTxtString))
    271.                                         (vla-put-TextString newmleader existingTxtString)
    272.                                         (vla-put-TextRotation newmleader existingTxtRot)
    273.                                         (if ss1
    274.                                                 (progn
    275.                                                         (command "._MATCHPROP" ss1 (entlast) "")
    276.                                                         (vla-put-TextWidth newmleader existingMlWidth)
    277.                                                         ; (vla-put-StyleName newmleader existingMlStyle)
    278.                                                         ; (vla-put-Layer newmleader existingMlLayer)
    279.                                                         (if        (/= T (AT:isAnnotative ss1))
    280.                                                                 (vla-put-ScaleFactor newmleader existingMlScale)
    281.                                                                 )
    282.                                                         )
    283.                                                 (progn
    284.                                                         (vla-put-Layer newmleader existingTxtLayer)
    285.                                                         (if (/= existingTxtWidth 0)
    286.                                                                 (vla-put-TextWidth newmleader existingTxtWidth)
    287.                                                                 )
    288.                                                         )
    289.                                                 )
    290.                                         (command "_.erase" entTxtName "")
    291.                                         (command "_.erase" entLeaderName "")
    292.                                         (command "_.move" (entlast) "" '(0 0 1e99) ""
    293.                                                 "_.move" "_p" "" '(0 0 -1e99) "")
    294.                                         (princ "        >>> 'LTM' has done the business ...")(princ)
    295.                                         )
    296.                                 )
    297.                         )
    298.                 )
    299. )
    300. )
    301. (*error* nil)
    302. (princ)
    303. )
    304. ;; Unknown Autor
    305. (defun dxf (code elist)
    306. (cdr (assoc code elist))
    307. )
    308. ;; Doug Broad
    309. ;; additional credits Joe Burke, Peter Toby
    310. (defun round (value to)
    311. (setq to (abs to))
    312. (* to (fix (/ ((if (minusp value) - +) value (* to 0.5)) to)))
    313. )
    314. ;;--------------------=={ String Subst }==--------------------;;
    315. ;;                                                            ;;
    316. ;;  Substitutes a string for all occurrences of another       ;;
    317. ;;  string within a string.                                   ;;
    318. ;;------------------------------------------------------------;;
    319. ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
    320. ;;------------------------------------------------------------;;
    321. ;;  Arguments:                                                ;;
    322. ;;  new - string to be substituted for 'old'                  ;;
    323. ;;  old - string to be replaced                               ;;
    324. ;;  str - the string to be searched                           ;;
    325. ;;------------------------------------------------------------;;
    326. ;;  Returns:  String with 'old' replaced with 'new'           ;;
    327. ;;------------------------------------------------------------;;
    328. (defun LM:StringSubst ( new old str / inc len )
    329. (setq len (strlen new)
    330.         inc 0
    331.         )
    332. (while (setq inc (vl-string-search old str inc))
    333.         (setq str (vl-string-subst new old str inc)
    334.                 inc (+ inc len)
    335.                 )
    336.         )
    337. str
    338. )
    339. ;; ssget        -        Lee Mac
    340. ;; A wrapper for the ssget function to permit the use of a custom selection prompt
    341. ;;
    342. ;; Arguments:
    343. ;; msg                -        selection prompt
    344. ;; params        -        list of ssget arguments
    345. (defun LM:ssget ( msg params / sel )
    346. (princ msg)
    347. (setvar 'nomutt 1)
    348. (setq sel (vl-catch-all-apply 'ssget params))
    349. (setvar 'nomutt 0)
    350. (if (and sel (not (vl-catch-all-error-p sel)))
    351.         sel
    352.         )
    353. )
    354. ;;---------------------=={ Select if }==----------------------;;
    355. ;;                                                            ;;
    356. ;;  Provides continuous selection prompts until either a      ;;
    357. ;;  predicate function is validated or a keyword is supplied. ;;
    358. ;;------------------------------------------------------------;;
    359. ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
    360. ;;------------------------------------------------------------;;
    361. ;;  Arguments:                                                ;;
    362. ;;  msg  - prompt string                                      ;;
    363. ;;  pred - optional predicate function [selection list arg]   ;;
    364. ;;  func - selection function to invoke                       ;;
    365. ;;  keyw - optional initget argument list                     ;;
    366. ;;------------------------------------------------------------;;
    367. ;;  Returns:  Entity selection list, keyword, or nil          ;;
    368. ;;------------------------------------------------------------;;
    369. (defun LM:SelectIf ( msg pred func keyw / sel ) (setq pred (eval pred))
    370. (while
    371.         (progn (setvar 'ERRNO 0) (if keyw (apply 'initget keyw)) (setq sel (func msg))
    372.                 (cond
    373.                         ( (= 7 (getvar 'ERRNO))
    374.                                 (princ "\nMissed, Try again.")
    375.                                 )
    376.                         ( (eq 'STR (type sel))
    377.                                 nil
    378.                                 )
    379.                         ( (vl-consp sel)
    380.                                 (if (and pred (not (pred sel)))
    381.                                         (princ "\nInvalid Object Selected.")
    382.                                         )
    383.                                 )
    384.                         )
    385.                 )
    386.         )
    387. sel
    388. )
    389. ;;-------------------=={ UnFormat String }==------------------;;
    390. ;;                                                            ;;
    391. ;;  Returns a string with all MTEXT formatting codes removed. ;;
    392. ;;------------------------------------------------------------;;
    393. ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
    394. ;;------------------------------------------------------------;;
    395. ;;  Arguments:                                                ;;
    396. ;;  str - String to Process                                   ;;
    397. ;;  mtx - MTEXT Flag (T if string is for use in MTEXT)        ;;
    398. ;;------------------------------------------------------------;;
    399. ;;  Returns:  String with formatting codes removed            ;;
    400. ;;------------------------------------------------------------;;
    401. (defun LM:UnFormat ( str mtx / _replace rx )
    402. (defun _replace ( new old str )
    403.         (vlax-put-property rx 'pattern old)
    404.         (vlax-invoke rx 'replace str new)
    405.         )
    406. (if (setq rx (vlax-get-or-create-object "VBScript.RegExp"))
    407.         (progn
    408.                 (setq str
    409.                         (vl-catch-all-apply
    410.                                 (function
    411.                                         (lambda ( )
    412.                                                 (vlax-put-property rx 'global     actrue)
    413.                                                 (vlax-put-property rx 'multiline  actrue)
    414.                                                 (vlax-put-property rx 'ignorecase acfalse)
    415.                                                 (foreach pair
    416.                                                         '(
    417.                                                                 ("\032"    . "\\\\\\\")
    418.                                                                 (" "       . "\\\\P|\\n|\\t")
    419.                                                                 ("$1"      . "\\\\(\\\\[ACcFfHLlOopQTW])|\\\\[ACcFfHLlOopQTW][^\\\\;]*;|\\\\[ACcFfHLlOopQTW]")
    420.                                                                 ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);")
    421.                                                                 ("$1$2"    . "\\\\(\\\\S)|[\\\\](})|}")
    422.                                                                 ("$1"      . "[\\\\]({)|{")
    423.                                                                 )
    424.                                                         (setq str (_replace (car pair) (cdr pair) str))
    425.                                                         )
    426.                                                 (if mtx
    427.                                                         (_replace "\\\" "\032" (_replace "\\$1$2$3" "(\\\\[ACcFfHLlOoPpQSTW])|({)|(})" str))
    428.                                                         (_replace "\"   "\032" str)
    429.                                                         )
    430.                                                 )
    431.                                         )
    432.                                 )
    433.                         )
    434.                 (vlax-release-object rx)
    435.                 (if (null (vl-catch-all-error-p str))
    436.                         str
    437.                         )
    438.                 )
    439.         )
    440. )
    441. ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-annotative-using-lisp-or-vlisp/m-p/3266716#M301077
    442. ;; Check if entity is annotative and which accounts for objects that were once annotative but are no longer.
    443. ;; ename - ename to check (returns T if annotative)
    444. ;; Alan J. Thompson
    445. (defun AT:isAnnotative (ename / check)
    446. (and (setq check (cdr (assoc 360 (entget ename))))
    447.         (setq check (dictsearch check "AcDbContextDataManager"))
    448.         (setq check (dictsearch (cdr (assoc -1 check)) "AcDb_AnnotationScales"))
    449.         (assoc 350 check)
    450.         )
    451. )
    452. ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-annotative-using-lisp-or-vlisp/m-p/3266684#M301075
    453. ;; By User pbejse
    454. ;; (IsAnno-p
    455. ;;   (setq itm (vlax-ename->vla-object (Car (entsel))))
    456. ;;   )
    457. (defun IsAnno-p (ent / exd ano)
    458. (vl-load-com)
    459. (and (eq (vla-get-HasExtensionDictionary ent) :vlax-true)
    460.         (setq exd (vla-GetExtensionDictionary ent)
    461.                 exd (vla-item exd "AcDbContextDataManager")
    462.                 ano (vla-item exd "ACDB_ANNOTATIONSCALES")
    463.                 )
    464.         (not (zerop (vla-get-Count ano)))
    465.         )
    466. )
    467. (load "TcaseSup.lsp")
    468. (vl-load-com)
    469. ;; End
    470. (princ
    471. (strcat
    472.         "\n:: Leader_To_Multileader.lsp edited on "
    473.         (menucmd "m=$(edtime,0,DD-MO-yyyy)")
    474.         " by 3dwannab (stephensherry147@yahoo.co.uk) loaded ::"
    475.         "\n:: Type "Leader_To_Multileader" OR "LTM" to run Program ::"
    476.         )
    477. )
    478. (princ)

    MLEADER测试图纸。图纸
  • 回复

    使用道具 举报

    0

    主题

    2

    帖子

    2

    银币

    初来乍到

    Rank: 1

    铜币
    0
    发表于 2022-7-5 15:33:25 | 显示全部楼层
    是否可以注释掉其中的一部分以删除顶点支持?我现在得到了一个奇怪的结果,当我运行这个程序时,我没有真正的原因得到了额外的顶点,我认为我开始使用的引线有3个点(箭头,狗腿,终点),你的例程添加了一个新的点。有什么想法吗?
    回复

    使用道具 举报

    56

    主题

    256

    帖子

    230

    银币

    后起之秀

    Rank: 20Rank: 20Rank: 20Rank: 20

    铜币
    253
    发表于 2022-7-5 15:54:51 | 显示全部楼层
    你能附上一个问题的领导人和文本。
     
    因此,您希望引线的2个以上点变为2(起点和终点)。这是正确的吗?
    回复

    使用道具 举报

    0

    主题

    2

    帖子

    2

    银币

    初来乍到

    Rank: 1

    铜币
    0
    发表于 2022-7-5 16:12:39 | 显示全部楼层
    是的,确切地说,作为命令中的选项,或者是否有方法注释掉添加多顶点支持的部分?
    回复

    使用道具 举报

    56

    主题

    256

    帖子

    230

    银币

    后起之秀

    Rank: 20Rank: 20Rank: 20Rank: 20

    铜币
    253
    发表于 2022-7-5 16:24:14 | 显示全部楼层
    仅创建具有起点和终点的多重引线。替换:(未经测试)
    1. (if (>= lstleaderlen 2)
    2. (progn
    3.         (command "._MLEADER" "_L" "_H" "_O" "_M" 3 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_2 0 1) "_non" (trans ldxf10_last 0 1) "")
    4.         )
    5. (progn
    6.         (command "._MLEADER" "_L" "_H" "_O" "_M" 2 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_last 0 1) "")
    7.         )
    8. )

     
    使用:
    1. (command "._MLEADER" "_L" "_H" "_O" "_M" 2 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_last 0 1) "")
    回复

    使用道具 举报

    发表回复

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

    本版积分规则

    • 微信公众平台

    • 扫描访问手机版

    • 点击图片下载手机App

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

    GMT+8, 2025-3-14 13:04 , Processed in 0.433458 second(s), 63 queries .

    © 2020-2025 乐筑天下

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