乐筑天下

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

[编程交流] 带图案填充和

[复制链接]

24

主题

147

帖子

123

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 06:11:22 | 显示全部楼层 |阅读模式
大家好,
 
这是我的Lisp程序。它执行以下操作:
1) 将云线批注添加到多个图元中
2) 添加图层(或根据需要创建并添加特性)
3) 添加图案填充
4) 插入引线和文字的块(已格式化)
 
我对lisp的了解非常有限。正如你所见,我复制了几个不同的代码,并将其组合在一起,使其适用于我的应用程序。这是可行的,但我知道这一点也不系统。我不知道我的错误处理是否正确。
 
我想补充的一件事是,如果修订云太大或太小,它应该允许在不关闭和撤消所有内容的情况下这样做。从另一个意义上讲,我需要在此中撤消和重置弧长选项。有人能帮我吗?
 
 
  1. (defun c:RVC6 (/ *error* oce mflag ans)
  2. ;************************************Error handling*********************************************
  3.   (defun *error* (msg)
  4.     (setvar "cmdecho" OCE)
  5.     (setq *error* nil)
  6.     (princ "\nRevision cloud program is done.")
  7.     (princ)
  8.   )
  9. ;************************************Program begins*********************************************
  10.   (setq OCE (getvar "cmdecho")
  11.         OOS (getvar "osmode")
  12.    )
  13.   (setvar "cmdecho" 0)
  14.   (setq mflag nil)
  15.   (while (not mflag)
  16.     (prompt "\n***    Enter option C, H, L, or E    ***")
  17.     (initget 0 "Cloud Hatch Leader Exit")
  18.     (setq Ans (getkword "\nconvert to revision Cloud/Hatch/Leader/<Exit>: "))
  19.     (if (= Ans nil)
  20.         (setq Ans "Exit")
  21.       ) ;end if
  22.     (cond
  23.         (  (= Ans "Cloud")
  24.            (convcloud)
  25.         )
  26.         (  (= Ans "Hatch")
  27.            (Addhatch)
  28.         )
  29.         (  (= Ans "Leader")
  30.            (Addleader)
  31.         )
  32.         (  (= Ans "Exit")
  33.            (setvar "cmdecho" OCE)
  34.            (setvar "osmode" OOS)
  35.            (quit)
  36.         )
  37.      ) ;end cond
  38.   );end while
  39. );end defun
  40. ;************************************Program ends**********************************************
  41. ;*******************************Start of "convcloud" program***********************************
  42. (defun convcloud (/ al ss)
  43.         (initget (+ 2 4))
  44.         (setq al (getreal "Specify Arc length <0.5>:"))
  45.         (if (= al nil) ;If user do not input a value here
  46.             (setq al 0.5) ;Consider "Enter" as 0.5
  47.          ) ; end if
  48.         (if (setq ss (ssget '((0 . "LINE,*POLYLINE,CIRCLE,ELLIPSE,SPLINE,ARC"))))
  49.             (progn
  50. (repeat (setq i (sslength ss))
  51.                  (command "_.revcloud" "a" al al "" (ssname ss (setq i (1- i))) "")
  52.           (if
  53.     (not (tblsearch "LAYER" "CONSTRUCTION"))
  54.     (command "-layer" "N" "CONSTRUCTION" "C" "1" "CONSTRUCTION" "LT" "continuous" "CONSTRUCTION" "")
  55.     ) ; end if
  56.           (command ".-layer" "S" "CONSTRUCTION" "C" "red" "" "")  
  57.              (Command "Chprop" "l" "" "la" "CONSTRUCTION" "C" "BYLAYER" "Lt" "BYLAYER" "LW" "BYLAYER" "")
  58.                 );end repeat
  59.               (princ "\nRevision cloud(s) created on CONSTRUCTION layer.")
  60.              );end progn
  61.            (princ "\nNo objects selected.")
  62. )
  63. );end defun
  64. ;*******************************End of "convcloud" program*************************************
  65. ;*****************************Start of "Addhatch" Program *************************************
  66. (defun Addhatch (/ htype selset thisobj setlen entname)
  67.      
  68.         (initget 1 "D R")
  69.         (setq htype (getkword "\nSpecify hatch type? Demo(D)/Rebuild(R):"))
  70.         (if (= htype "D")
  71.             (setq htype "ANSI31")
  72.           ) ;end if
  73.    
  74.         (if (= htype "R")
  75.             (setq htype "DOTS")
  76.           ) ;end if
  77.         (princ "\nSelect object(s) to hatch:")
  78.         (setq selset (ssget))
  79.        (if selset
  80.          (progn
  81.            (setq thisobj 0)
  82.            (setq setlen (sslength selset))
  83.            (while (< thisobj setlen )
  84.               (setq entname(ssname selset thisobj))
  85.               (Command "-bhatch" "Advanced" "Style" "Outer" "" "")
  86.               (command "-bhatch" "p" htype "3" "" "s" entname "" "")
  87.        (if
  88.   (not (tblsearch "LAYER" "CONSTRUCTION"))
  89.   (command "-layer" "N" "CONSTRUCTION" "C" "1" "CONSTRUCTION" "LT" "continuous" "CONSTRUCTION" "")
  90. ) ; end if
  91.        (command ".-layer" "S" "CONSTRUCTION" "C" "red" "" "")
  92.               (Command "Chprop" "l" "" "la" "CONSTRUCTION" "C" "BYLAYER" "Lt" "BYLAYER" "LW" "BYLAYER" "")
  93.               (setq thisobj(+ thisobj 1))
  94.             ) ; end while
  95. (alert "\n ***WARNING***
  96. Hatching could not skip the inner objects.
  97. To solve this, Double click hatch and `Add: select objects'
  98. and select inner object & click OK")
  99.           ) ; end progn
  100.         ) ;end if selset
  101.         (princ "\nNo objects selected.")
  102. );end defun
  103. ;*******************************End of "Addhatch" program*************************************
  104. ;*****************************Start of "Addleader" Program ***********************************
  105. (defun Addleader (/ pt1)
  106.          (while
  107.             (setq pt1 (getpoint "\nInserting task description note, Specify Arrow End Point or hit Enter to close:"))
  108.      (Command "_INSERT" "CP TEXT" pt1 "" "" "")
  109.        (command "explode" "l")
  110.           );end while
  111. );end defun
回复

使用道具 举报

24

主题

147

帖子

123

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 07:27:38 | 显示全部楼层
有人能帮我做这件事吗?
 
 
提前感谢
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:45 , Processed in 0.337737 second(s), 56 queries .

© 2020-2025 乐筑天下

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