乐筑天下

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

[编程交流] 修改“LinExp”lisp

[复制链接]

3

主题

14

帖子

11

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 01:35:08 | 显示全部楼层 |阅读模式
linexp。艾斯费罗各位,
 
我想使用我在论坛中找到的LinExp lisp,但我想知道如何修改它,这样用户就不必选择对象,只需分解所有“行”,而不分解其他对象。分解不同形状的对象时,lisp不准确。我知道必须使用过滤器,但我不知道该如何开始或从哪里开始。这是很容易做到的吗?我不懂autolisp。我只是其他语言的新手。非常感谢您的帮助。
 
非常感谢。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 01:41:37 | 显示全部楼层
你不能爆炸线!这是一个最简单的元素,和圆、弧、文本一样,你可以分解柱脚、多行文字块以及更多。
 
你能解释一下你想做什么吗。
回复

使用道具 举报

8

主题

1133

帖子

1164

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 01:41:46 | 显示全部楼层
我想你会发现线是可以分解的。
 
附加的lisp是TEXTEXP的一个改编,它基本上导出WMF图像,然后将图像作为多段线重新导入。它不是非常精确(比例略不是1),线宽变为0。
 
但是如果OP想要进一步调整它,现在是学习Lisp的好机会。
回复

使用道具 举报

3

主题

14

帖子

11

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 01:45:18 | 显示全部楼层
谢谢你的回复。我正在努力学习Lisp程序。我只是认为可以修改linexp lisp以分解所有行,而不是让用户选择每一行。
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 01:48:10 | 显示全部楼层
 
我认为我必须同意比格尔的观点。
 
lisp文件没有附加,但看看什么可以被视为分解线实体会很有趣-大卫
回复

使用道具 举报

8

主题

1133

帖子

1164

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 01:52:25 | 显示全部楼层
 
我在发布之前确实试过了,所以对于我的设置,我可以分解所有行。无论我是否愿意走到OP看起来的那么远,我都不会。
 
连续线“分解”为零线宽的多段线。非连续线型“分解”为单个多段线。
 
这是发布的lisp代码
 
  1. ;;
  2. ;;;
  3. ;;;    By Dominic Panholzer
  4. ;;;
  5. ;;;    Modified original TXTEXP.LSP from Express Tools
  6. ;;;    Copyright © 1999 by Autodesk, Inc.
  7. ;;     LINEXP.LSP modifications by XANADU
  8. ;;;
  9. ;;;    Your use of this software is governed by the terms and conditions of the
  10. ;;;    License Agreement you accepted prior to installation of this software.
  11. ;;;    Please note that pursuant to the License Agreement for this software,
  12. ;;;    "[c]opying of this computer program or its documentation except as
  13. ;;;    permitted by this License is copyright infringement under the laws of
  14. ;;;    your country.  If you copy this computer program without permission of
  15. ;;;    Autodesk, you are violating the law."
  16. ;;;
  17. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
  18. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  19. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  20. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
  21. ;;;    UNINTERRUPTED OR ERROR FREE.
  22. ;;;
  23. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
  24. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
  25. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
  26. ;;;    (Rights in Technical Data and Computer Software), as applicable.
  27. ;;;
  28. ;;;  ----------------------------------------------------------------
  29. ;;;
  30. ;;;  External Functions:
  31. ;;;
  32. ;;;     ACET-ERROR-INIT           --> ACETUTIL.FAS   Intializes bonus error routine
  33. ;;;     ACET-ERROR-RESTORE        --> ACETUTIL.FAS   Restores old error routine
  34. ;;;     ACET-GEOM-ZOOM-FOR-SELECT --> ACETUTIL.FAS   Zoom boundry to include points given
  35. ;;;     ACET-LAYER-LOCKED         --> ACETUTIL.FAS   Checks to see if layer is locked
  36. ;;;     ACET-GEOM-PIXEL-UNIT      --> ACETUTIL.FAS   Size of pixel in drawing units
  37. ;;;     ACET-GEOM-TEXTBOX         --> ACETUTIL.FAS   Returns the textbox for any text
  38. ;;;     ACET-GEOM-MIDPOINT        --> ACETUTIL.FAS   Returns midpoint between two points
  39. ;;;     ACET-GEOM-VIEW-POINTS     --> ACETUTIL.FAS   Returns corner points of screen or viewport
  40. ;;;     ACET-STR-FORMAT           --> ACETUTIL.ARX   String builder
  41. ;;;     ACET-WMFIN                --> ACETUTIL.FAS   Brings in WMF file
  42. ;;;
  43. (defun c:linexp (/ grplst getgname blknm FLTR GLST GDICT SS VIEW UPLFT TMPFIL TBX
  44.                   TMPFIL CNT PT1 PT2 ENT TXT TXTYP PTLST ZM LOCKED GNAM vpna vplocked)
  45. (acet-error-init
  46.        (list
  47.         (list   "cmdecho" 0
  48.                 "highlight" 1
  49.                 "osmode" 0
  50.                 "Mirrtext" 1
  51.                 "limcheck" 0
  52.         )
  53.         T
  54.        )
  55. )
  56. ; --------------------- GROUP LIST FUNCTION ----------------------
  57. ;   This function will return a list of all the group names in the
  58. ;   drawing and their entity names in the form:
  59. ;   ((<ename1> . <name1>) ... (<enamex> . <namex>))
  60. ; ----------------------------------------------------------------
  61. (defun acet-txtexp-grplst (/ GRP ITM NAM ENT GLST)
  62.    (setq GRP  (dictsearch (namedobjdict) "ACAD_GROUP"))
  63.    (while (setq ITM (car GRP))       ; While edata item is available
  64.      (if (= (car ITM) 3)             ; if the item is a group name
  65.        (setq NAM (cdr ITM)           ; get the name
  66.              GRP (cdr GRP)           ; shorten the edata
  67.              ITM (car GRP)           ; get the next item
  68.              ENT (cdr ITM)           ; which is the ename
  69.              GRP (cdr GRP)           ; shorten the edata
  70.              GLST                    ; store the ename and name
  71.                  (if GLST
  72.                    (append GLST (list (cons ENT NAM)))
  73.                    (list (cons ENT NAM))
  74.                  )
  75.        )
  76.        (setq GRP (cdr GRP))          ; else shorten the edata
  77.      )
  78.    )
  79.    GLST                              ; return the list
  80. )
  81. ; ------------------- GET GROUP NAME FUNCTION --------------------
  82. ;   This function returns a list of all the group names in GLST
  83. ;   where ENT is a member. The list has the same form as GLST
  84. ; ----------------------------------------------------------------
  85. (defun acet-txtexp-getgname (ENT GLST / GRP GDATA NAM NLST)
  86.    (if (and GLST (listp GLST))
  87.      (progn
  88.        (foreach GRP GLST
  89.          (setq GDATA (entget (car GRP)))
  90.          (foreach ITM GDATA                   ; step through the edata
  91.            (if (and
  92.                  (= (car ITM) 340)            ; if the item is a entity name
  93.                  (eq (setq NAM (cdr ITM)) ENT) ; and the ename being looked for
  94.                )
  95.              (setq NLST                       ; store the ename and name
  96.                      (if NLST
  97.                        (append NLST (list (cons (car GRP) (cdr GRP))))
  98.                        (list (cons (car GRP) (cdr GRP)))
  99.                      )
  100.              )
  101.            )
  102.          )
  103.        )
  104.      )
  105.    )
  106.    NLST
  107. )
  108. ; ----------------------------------------------------------------
  109. ;                          MAIN PROGRAM
  110. ; ----------------------------------------------------------------
  111. (if (and                                                ; Are we in plan view?
  112.        (equal (car (getvar "viewdir")) 0 0.00001)
  113.        (equal (cadr (getvar "viewdir")) 0 0.00001)
  114.        (> (caddr (getvar "viewdir")) 0)
  115.      )
  116.    (progn
  117.      (prompt "\nSelect lines to be EXPLODED: ")
  118.      (Setq FLTR    '((-4 . "<AND")
  119.                        (-4 . "<OR")                      ; filter for mtext and text
  120.                          (0 . "MTEXT")
  121.                          (0 . "TEXT")
  122.                        (-4 . "OR>")
  123.                        (-4 . "<NOT")
  124.                          (102 . "{ACAD_REACTORS")        ; and not leader text
  125.                        (-4 . "NOT>")
  126.                      (-4 . "AND>")
  127.                     )
  128.            GLST     (acet-txtexp-grplst)                             ; Get all the groups in drawing
  129.            GDICT    (if GLST
  130.                       (dictsearch (namedobjdict) "ACAD_GROUP")
  131.                     )
  132.            SS       (ssget);  FLTR)
  133.            CNT      0
  134.      )
  135.      ;; filter out the locked layers
  136.      (if SS
  137.        (setq SS (car (bns_ss_mod SS 1 T)))
  138.      ) ;if
  139.      ;; if we have anything left
  140.      (if SS
  141.        (progn
  142.          (setq CNT 0)                                 ; Reset counter
  143.          (while (setq ENT (ssname SS CNT))            ; step through each object in set
  144.            (and
  145.              GLST                                     ; if groups are present in the drawing
  146.              (setq GNAM (acet-txtexp-getgname ENT GLST))          ; and the text item is in one or more
  147.              (foreach GRP GNAM                        ; step through those groups
  148.                (command "_.-group" "_r"               ; and remove the text item
  149.                  (cdr GRP) ENT ""
  150.                )
  151.              )
  152.            )
  153.            (setq TBX (acet-geom-textbox (entget ENT) 0))   ; get textbox points
  154.            (setq TBX (mapcar '(lambda (x)
  155.                                 (trans x 1 0)         ; convert the points to WCS
  156.                               )
  157.                        TBX
  158.                      )
  159.            )
  160.            (setq PTLST (append PTLST TBX))            ; Build list of bounding box
  161.                                                       ; points for text items selected
  162.            (setq CNT (1+ CNT))                        ; get the next text item
  163.          ); while
  164.          (setq PTLST (mapcar '(lambda (x)
  165.                                 (trans x 0 1)         ; convert all the points
  166.                               )                       ; to the current ucs
  167.                      PTLST
  168.                    )
  169.          )
  170.          (if (setq ZM (acet-geom-zoom-for-select PTLST))          ; If current view does not contain
  171.            (progn                                     ; all bounding box points
  172.              (setq ZM
  173.                (list
  174.                  (list (- (caar ZM) (acet-geom-pixel-unit))     ; increase zoom area by
  175.                        (- (cadar ZM) (acet-geom-pixel-unit))    ; one pixel width to
  176.                        (caddar ZM)                    ; sure nothing will be lost
  177.                  )
  178.                  (list (+ (caadr ZM) (acet-geom-pixel-unit))
  179.                        (+ (cadadr ZM) (acet-geom-pixel-unit))
  180.                        (caddr (cadr zm))
  181.                  )
  182.                )
  183.              )
  184.              (if (setq vpna (acet-currentviewport-ename))
  185.                  (setq vplocked (acet-viewport-lock-set vpna nil))
  186.              );if
  187.              (command "_.zoom" "_w" (car ZM) (cadr ZM))  ; zoom to include text objects
  188.            )
  189.          )
  190.          (setq VIEW     (acet-geom-view-points)
  191.                TMPFIL   (strcat (getvar "tempprefix") "txtexp.wmf")
  192.                PT1      (acet-geom-midpoint (car view) (cadr view))
  193.                PT2      (list (car PT1) (cadadr VIEW))
  194.          )
  195.          (if (acet-layer-locked (getvar "clayer"))       ; if current layer is locked
  196.            (progn
  197.              (command "_.layer" "_unl" (getvar "clayer") "")  ; unlock it
  198.              (setq LOCKED T)
  199.            )
  200.          )
  201.          (command "_.mirror" SS "" PT1 PT2 "_y"
  202.                   "_.WMFOUT" TMPFIL SS "")
  203.          (if (findfile tmpfil)                           ; Does WMF file exist?
  204.            (progn
  205.              (command "_.ERASE" SS "")                   ; erase the orignal text
  206.              (setq ss (acet-wmfin TMPFIL))               ; insert the WMF file
  207.              (command "_.mirror" ss "" PT1 PT2 "_y")
  208.            ) ;progn
  209.          ) ;if
  210.          (if LOCKED
  211.            (command "_.layer" "_lock" (getvar "clayer") "") ; relock if needed
  212.          ) ;if
  213.          (if ZM (command "_.zoom" "_p"))              ; Restore original view if needed
  214.          (if vplocked
  215.              (acet-viewport-lock-set vpna T) ;re-lock the viewport if needed.
  216.          );if
  217.          (prompt (acet-str-format "\n%1 object(s) have been exploded to lines."  CNT))
  218.          (prompt "\nThe line objects have been placed on layer 0.")
  219.        )
  220.      )
  221.    )
  222.    (prompt "\nView needs to be in plan (0 0 1).")
  223. );if equal
  224. (acet-error-restore)                                  ; Retsore values
  225. (princ)
  226. )
  227. (princ)
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 01:54:44 | 显示全部楼层
当与线实体结合使用时,我仍然不同意使用术语“爆炸”。对不起-大卫
回复

使用道具 举报

3

主题

14

帖子

11

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 01:58:49 | 显示全部楼层
谢谢Eldon的发帖。这是我第一次尝试发布代码(失败)。我正在尝试使用这个lisp,这样我可以自动分解所有缝合线型,而不是手动分解。我不知道如何更改行“提示”\n选择要分解的行:“只分解所有行或至少用“缝合”线型分解所有行。这听起来像是不可行的吗?
回复

使用道具 举报

8

主题

1133

帖子

1164

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 02:03:38 | 显示全部楼层
 
把一条虚线变成几条被空格分割的短线的过程叫什么?
 
在AutoCAD的范围内,我认为很多人都会对“爆炸”这个表达感到高兴
 
 
为什么不能通过关闭/冻结其他所有内容来隔离要爆炸的线?然后用窗口选择选择所有线。
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 02:05:12 | 显示全部楼层
 
 
根据直线的线型来分割直线,我认为它效率很低,可以称之为绘制的直线,因为这是基于向量的应用程序所看到的-大卫
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 21:03 , Processed in 0.705975 second(s), 72 queries .

© 2020-2025 乐筑天下

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