乐筑天下

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

[编程交流] 删除Dcl

[复制链接]

40

主题

132

帖子

107

银币

后起之秀

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

铜币
227
发表于 2022-7-6 17:09:17 | 显示全部楼层 |阅读模式
  1. ;Tip1662c:   POFFSET.LSP    Piping Utilities    (c)2000, Mitch Thaxter
  2. (defun C:POFFSET ()
  3. (setq OLD_BLIPMODE (getvar "blipmode"))
  4. (setvar "blipmode" 0)
  5. (setq FILE_FOUND_DCL (findfile "poffset.dcl"))
  6. (if (= FILE_FOUND_DCL NIL)
  7.    (ANGLE_FILE_NOT_FOUND)
  8. ) ;_ end of if
  9. (setq DCL_ID (load_dialog FILE_FOUND_DCL))
  10. (if (not (new_dialog "poffset" DCL_ID))
  11.    (exit)
  12. ) ;_ end of if
  13. (action_tile "cancel" "(exit)")
  14. (action_tile "pipe_size" "(setq pipe_size $value)")
  15. (if (= 1 (start_dialog))
  16.    (start_dialog)
  17.    (exit)
  18. ) ;_ end of if
  19. ;;;Nominal
  20. (if (= PIPE_SIZE "0")
  21.    (setq PIPE_SIZE 0.405)
  22. ) ;_ end of if
  23. ;;;  1/8"
  24. (if (= PIPE_SIZE "1")
  25.    (setq PIPE_SIZE 0.540)
  26. ) ;_ end of if
  27. ;;;  1/4"
  28. (if (= PIPE_SIZE "2")
  29.    (setq PIPE_SIZE 0.675)
  30. ) ;_ end of if
  31. ;;;  3/8"
  32. (if (= PIPE_SIZE "3")
  33.    (setq PIPE_SIZE 0.840)
  34. ) ;_ end of if
  35. ;;;  1/2"
  36. (if (= PIPE_SIZE "4")
  37.    (setq PIPE_SIZE 1.050)
  38. ) ;_ end of if
  39. ;;;  3/4"
  40. (if (= PIPE_SIZE "5")
  41.    (setq PIPE_SIZE 1.315)
  42. ) ;_ end of if
  43. ;;;   1"
  44. (if (= PIPE_SIZE "6")
  45.    (setq PIPE_SIZE 1.660)
  46. ) ;_ end of if
  47. ;;; 1 1/4"
  48. (if (= PIPE_SIZE "7")
  49.    (setq PIPE_SIZE 1.900)
  50. ) ;_ end of if
  51. ;;; 1 1/2"
  52. (if (= PIPE_SIZE "8")
  53.    (setq PIPE_SIZE 2.375)
  54. ) ;_ end of if
  55. ;;;   2"
  56. (if (= PIPE_SIZE "9")
  57.    (setq PIPE_SIZE 2.875)
  58. ) ;_ end of if
  59. ;;; 2 1/2"
  60. (if (= PIPE_SIZE "10")
  61.    (setq PIPE_SIZE 3.500)
  62. ) ;_ end of if
  63. ;;;   3"
  64. (if (= PIPE_SIZE "11")
  65.    (setq PIPE_SIZE 4.000)
  66. ) ;_ end of if
  67. ;;; 3 1/2"
  68. (if (= PIPE_SIZE "12")
  69.    (setq PIPE_SIZE 4.500)
  70. ) ;_ end of if
  71. ;;;   4"
  72. (if (= PIPE_SIZE "13")
  73.    (setq PIPE_SIZE 5.563)
  74. ) ;_ end of if
  75. ;;;   5"
  76. (if (= PIPE_SIZE "14")
  77.    (setq PIPE_SIZE 6.625)
  78. ) ;_ end of if
  79. ;;;   6"
  80. (if (= PIPE_SIZE "15")
  81.    (setq PIPE_SIZE 8.625)
  82. ) ;_ end of if
  83. ;;;   8"
  84. (if (= PIPE_SIZE "16")
  85.    (setq PIPE_SIZE 10.75)
  86. ) ;_ end of if
  87. ;;;  10"
  88. (if (= PIPE_SIZE "17")
  89.    (setq PIPE_SIZE 12.75)
  90. ) ;_ end of if
  91. ;;;  12"
  92. (setq DIST   (/ PIPE_SIZE 2)
  93.        PICBOX ""
  94. ) ;_ end of setq
  95. (princ "\nCurrent offset < ")
  96. (princ DIST)
  97. (setq ENT (entsel "\nSelect line: "))
  98. (setq POINT (cadr ENT))
  99. (setq SIDE (getpoint "\nSelect side: "))
  100. (setq DIS1 (distance SIDE POINT))
  101. (setq ANG (angle SIDE POINT))
  102. (if (or (or (< ANG 0.78) (> ANG 5.5))
  103.          (and (> ANG 2.35) (< ANG 3.92))
  104.      ) ;_ end of or
  105.    (setq ANG (- 0 ANG))
  106.    (setq ANG (- pi ANG))
  107. ) ;end if
  108. (setq OTHER (polar POINT ANG DIST))
  109. (command "offset" DIST ENT SIDE ENT OTHER "")
  110. (prin1)
  111. ) ;_ end of defun

有人能告诉我如何取消对DCL的呼叫吗
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2022-7-6 17:41:36 | 显示全部楼层
这套粗俗的套路到底要做什么?
 
  1.           ;Tip1662c:   POFFSET.LSP    Piping Utilities    (c)2000, Mitch Thaxter
  2. ; Modified 11/17/08
  3. (defun C:POFFSET (/ ANG DAT DIS1 DIST ENT OTHER PIPE_SIZE POINT SIDE)
  4. (and
  5.    (setq PIPE_SIZE (getint "\nEnter Pipe Size: "))
  6.    (setq dat (assoc Pipe_size
  7.                     '((0  0.405)
  8.                       (1  0.540) ;  1/4"
  9.                       (2  0.675) ;  3/8"
  10.                       (3  0.840) ;  1/2"
  11.                       (4  1.050) ;  3/4"
  12.                       (5  1.315) ;   1"
  13.                       (6  1.660) ; 1 1/4"
  14.                       (7  1.900) ; 1 1/2"
  15.                       (8  2.375) ;   2"
  16.                       (9  2.875) ; 2 1/2"
  17.                       (10 3.500) ;   3"
  18.                       (11 4.000) ; 3 1/2"
  19.                       (12 4.500) ;   4"
  20.                       (13 5.563) ;   5"
  21.                       (14 6.625) ;   6"
  22.                       (15 8.625) ;   8"
  23.                       (16 10.75) ;  10"
  24.                       (17 12.75) ;  12"
  25.                      )
  26.              )
  27.    )
  28.    (setq DIST   (/ (cadr dat) 2.))
  29.    (princ "\nCurrent offset < ")
  30.    (princ DIST)
  31.    (setq ENT (entsel "\nSelect line: "))
  32.    (setq POINT (cadr ENT))
  33.    (setq SIDE (getpoint "\nSelect side: "))
  34.    (setq DIS1 (distance SIDE POINT))
  35.    (setq ANG (angle SIDE POINT))
  36.    (if (or (or (< ANG 0.78) (> ANG 5.5))
  37.            (and (> ANG 2.35) (< ANG 3.92))
  38.        ) ;_ end of or
  39.      (setq ANG (- 0 ANG))
  40.      (setq ANG (- pi ANG))
  41.    )     ;end if
  42.    (setq OTHER (polar POINT ANG DIST))
  43.    (command "offset" DIST ENT "non" SIDE ENT "non" OTHER "")
  44. )
  45. (prin1)
  46. ) ;_ end of defun
回复

使用道具 举报

40

主题

132

帖子

107

银币

后起之秀

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

铜币
227
发表于 2022-7-6 18:38:06 | 显示全部楼层
谢谢你的回复,我似乎无意中发现了很多模糊的例程,我使用了这个程序POFFSET,并且大小没有指定,我想我只是被这里的一些程序员和他们的帮助宠坏了。
  1. ;Tip1714:  ATTUPDATE.LSP    Attribute update      (c)2001, Brian Iwaskewycz
  2. (defun C:ATTUPDATE  (/ NEXTENTTYPE ENTTYPE BLOCKNAME SSET ENTNAME
  3.                     SELECTION FILENAME INDEX1 NEWBLOCKNAME MAINENTNAME
  4.                     SUBENTNAME ATTLIST INSPOINT XSCALE YSCALE ZSCALE
  5.                     ROTATION ENTDATA INDEX2 VALUE LOSSFLAG LAYERNAME)
  6. (while (or (/= "ATTRIB" NEXTENTTYPE) (/= "INSERT" ENTTYPE))
  7.    (setq BLOCKNAME "")
  8.    (setq BLOCKNAME
  9.           (getstring
  10.             "\nEnter name of block to update or <ENTER> to select: "))
  11.    (if (/= "" BLOCKNAME)
  12.      (progn
  13.        (setq SSET
  14.               (ssget "x"
  15.                      (list (cons 0 "INSERT") (cons 2 BLOCKNAME))))
  16.        (if SSET
  17.          (progn
  18.            (setq ENTNAME (ssname SSET 0))
  19.            (setq ENTTYPE (cdr (assoc 0 (entget ENTNAME))))
  20.            (if (entnext ENTNAME)
  21.              (setq NEXTENTTYPE
  22.                     (cdr
  23.                       (assoc 0
  24.                              (entget (entnext ENTNAME)))))
  25.              (princ "\nThe selected block has no attributes.")
  26.              )
  27.            )
  28.          (progn
  29.            (princ (strcat "\nBlock name "
  30.                           (strcase BLOCKNAME)
  31.                           " not found."))
  32.            (setq NEXTENTYPE NIL
  33.                  ENTTYPE NIL)
  34.            )
  35.          )
  36.        )
  37.      (progn
  38.        (setq SELECTION NIL)
  39.        (while (not SELECTION)
  40.          (setq SELECTION (entsel "\nSelect block to update:"))
  41.          )
  42.        (setq ENTNAME (car SELECTION))
  43.        (setq ENTTYPE (cdr (assoc 0 (entget ENTNAME))))
  44.        (if (entnext ENTNAME)
  45.          (setq NEXTENTTYPE
  46.                 (cdr (assoc 0 (entget (entnext ENTNAME))))))
  47.        (if (/= "INSERT" ENTTYPE)
  48.          (princ "\nThe selected entity is not a block.")
  49.          (if (/= "ATTRIB" NEXTENTTYPE)
  50.            (princ "\nThe selected block has no attributes."))
  51.          )
  52.        )
  53.      )
  54.    )
  55. (if (= "" BLOCKNAME)
  56.    (setq BLOCKNAME (cdr (assoc 2 (entget ENTNAME)))))
  57. (setq SSET (ssget "x" (list (cons 0 "INSERT") (cons 2 BLOCKNAME))))
  58. (princ (strcat "\n"
  59.                 (itoa (sslength SSET))
  60.                 " occurrence(s) of block "
  61.                 (strcase BLOCKNAME)
  62.                 " found.\n"))
  63. (setq FILENAME (getfiled "Select New Block Name" "" "dwg" 0))
  64. (setq INDEX1 (strlen FILENAME))
  65. (while (/= "\" (substr FILENAME INDEX1 1))
  66.    (setq INDEX1 (1- INDEX1))
  67.    )
  68. (setq BLOCKNAME (strcase BLOCKNAME))
  69. (setq NEWBLOCKNAME
  70.         (strcase (substr FILENAME
  71.                          (1+ INDEX1)
  72.                          (- (- (strlen FILENAME) INDEX1) 4))))
  73. (setvar "attdia" 0)
  74. (setvar "attreq" 0)
  75. (setvar "cmdecho" 0)
  76. (if (and (tblsearch "block" NEWBLOCKNAME)
  77.           (/= NEWBLOCKNAME BLOCKNAME))
  78.    (progn
  79.      (princ
  80.        (strcat "A block named "
  81.                NEWBLOCKNAME
  82.                " already exists.  Using local copy instead."))
  83.      (command "insert" NEWBLOCKNAME "0,0,0" "" "" "")
  84.      )
  85.    (progn
  86.      (if (/= BLOCKNAME NEWBLOCKNAME)
  87.        (command "rename" "b" BLOCKNAME NEWBLOCKNAME))
  88.      (command "insert"
  89.               (strcat NEWBLOCKNAME "=" FILENAME)
  90.               "0,0,0"
  91.               ""
  92.               ""
  93.               "")
  94.      )
  95.    )
  96. (setq MAINENTNAME (entlast))
  97. (setq SUBENTNAME (entnext MAINENTNAME))
  98. (while (= "ATTRIB" (cdr (assoc 0 (entget SUBENTNAME))))
  99.    (setq
  100.      ATTLIST (append ATTLIST
  101.                      (list (cdr (assoc 2 (entget SUBENTNAME))))))
  102.    (setq SUBENTNAME (entnext SUBENTNAME))
  103.    )
  104. (entdel MAINENTNAME)
  105. (setvar "attreq" 1)
  106. (setq INDEX1 0)
  107. (command "ucs" "w")
  108. (princ "\n")
  109. (while (setq MAINENTNAME (ssname SSET INDEX1))
  110.    (setq SUBENTNAME (entnext MAINENTNAME))
  111.    (setq INSPOINT (cdr (assoc 10 (entget MAINENTNAME))))
  112.    (setq XSCALE (cdr (assoc 41 (entget MAINENTNAME))))
  113.    (setq YSCALE (cdr (assoc 42 (entget MAINENTNAME))))
  114.    (setq ZSCALE (cdr (assoc 43 (entget MAINENTNAME))))
  115.    (setq ROTATION
  116.           (* (/ 180.0 pi) (cdr (assoc 50 (entget MAINENTNAME)))))
  117.    (setq LAYERNAME (cdr (assoc 8 (entget MAINENTNAME))))
  118.    (while (= "ATTRIB"
  119.              (cdr (assoc 0 (setq ENTDATA (entget SUBENTNAME)))))
  120.      (set (read (cdr (assoc 2 ENTDATA))) (cdr (assoc 1 ENTDATA)))
  121.      (setq SUBENTNAME (entnext SUBENTNAME))
  122.      )
  123.    (setq INDEX2 0)
  124.    (command "insert" NEWBLOCKNAME INSPOINT "xyz" XSCALE YSCALE ZSCALE
  125.             ROTATION)
  126.    (while (< INDEX2 (length ATTLIST))
  127.      (setq VALUE (eval (read (nth INDEX2 ATTLIST))))
  128.      (if VALUE
  129.        (command VALUE)
  130.        (progn
  131.          (command "")
  132.          (setq LOSSFLAG t)
  133.          )
  134.        )
  135.      (set (read (nth INDEX2 ATTLIST)) NIL)
  136.      (setq INDEX2 (1+ INDEX2))
  137.      )
  138.    (entmod (subst (cons 8 LAYERNAME)
  139.                   (assoc 8 (entget (entlast)))
  140.                   (entget (entlast))))
  141.    (entdel MAINENTNAME)
  142.    (setq INDEX1 (1+ INDEX1))
  143.    (princ (strcat "\r"
  144.                   (itoa INDEX1)
  145.                   "/"
  146.                   (itoa (sslength SSET))
  147.                   " blocks updated."))
  148.    )
  149. (command "ucs" "p")
  150. (setvar "cmdecho" 1)
  151. (setvar "attdia" 1)
  152. (if LOSSFLAG
  153.    (princ
  154.      "\nWARNING! Due to non-identical tag names, some data may have been lost."))
  155. (princ (strcat "\n"
  156.                 (itoa (sslength SSET))
  157.                 " occurrences of block "
  158.                 BLOCKNAME
  159.                 " updated successfully."))
  160. (if (/= BLOCKNAME NEWBLOCKNAME)
  161.    (princ (strcat "\nBlock was renamed to " NEWBLOCKNAME ".")))
  162. (princ)
  163. )
  164. (princ "ATTUPDATE ver 1.0 loaded.")
  165. (princ)

 
此代码用于区域,想知道它是否过期?你能帮我做这个吗?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 16:52 , Processed in 0.343823 second(s), 58 queries .

© 2020-2025 乐筑天下

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