乐筑天下

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

[编程交流] 如何使lisp运行aut

[复制链接]

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:25:19 | 显示全部楼层
这是代码,我所有的修复都没有成功。
 
  1. (defun c:standardlayers (/ *error*)
  2.    (defun *error* (msg)
  3.    (and Osmode# (setvar "osmode" Osmode#))
  4.    (command "_.undo" "_e")
  5.    (if
  6.      (not
  7.    (member
  8.      msg
  9.      '("console break" "Function cancelled" "quit / exit abort")
  10.    ) ;_ member
  11.      ) ;_ not
  12.             (princ (strcat "\nError: " msg))
  13.    ) ;_ if
  14. ) ;_ defun
  15. ; Layers
  16. (command "layer" "m" "Const"   "lt"   "continuous" "" "c" "1" "" "")
  17. (command "layer" "m" "Steel"   "lt"   "continuous" "" "c" "2" "" "")
  18. (command "layer" "m" "Dimension"     "lt"   "continuous" "" "c" "4" "" "")
  19. (command "layer" "m" "Hidden"  "lt"   "Hidden" "" "c" "1" "" "")
  20. (command "layer" "m" "Text"   "lt"   "continuous" "" "c" "7" "" "")
  21. (command "layer" "m" "Welds"   "lt"   "continuous" "" "c" "6" "" "")
  22. (command "layer" "m" "Ref"   "lt"   "continuous" "" "c" "8" "" "")
  23. (command "-linetype" "load"   "hidden"  ""     "yes" "")
  24. (princ)
  25. );end of defun
  26. (C:standardlayers)

 
当涉及到在例程中输入命令时,我只是处于停滞状态。
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 15:29:32 | 显示全部楼层
这可行,但很难看。
  1. (if (not (= (command "-layer" "s" "YourLayer" "") nil))
  2. (command "-layer" "m" "YourLayer" "c" "2" "" "")
  3. )

 
我不是一个Lisp程序的人,vba是我的东西,但原则是一样的
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 15:31:24 | 显示全部楼层
下一步将是制作一个带有值的函数,以简化键入。大声思考
  1. (defun CheckLayer(/ LayerName LayerColor LayerLinetype)
  2. (if (not (= (command "-layer" "s" LayerName "") nil))
  3. (command "-layer" "m" LayerName "c" LayerColor "" "lt" LayerLinetype "" "")
  4. )
  5. )
可以从主例程中调用
(选中层“Layer1Name”“Layer1Color”“L1LT”)
回复

使用道具 举报

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:36:24 | 显示全部楼层
你是怎么做到的我得到的只是
命令:多个参数出错
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 15:38:04 | 显示全部楼层
试试看,
 
 
  1. ;;;/////////////////////////////////////////////////////////////////
  2. (defun c:standardlayers ()                                          ;Define function
  3. (SET_LAYER)                                                       ;Goto SET_LAYER Function
  4. (princ)                                                           ;Exit quietly
  5. )                                                                   ;End of define function
  6. ;;;/////////////////////////////////////////////////////////////////
  7. (defun SET_LAYER ()                                                 ;Define function
  8. (CREATE_LAYER "Const"     "1" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  9. (CREATE_LAYER "Steel"     "2" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  10. (CREATE_LAYER "Dimension" "4" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  11. (CREATE_LAYER "Hidden"    "1" "HIDDEN")                           ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  12. (CREATE_LAYER "Text"      "7" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  13. (CREATE_LAYER "Welds"     "6" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  14. (CREATE_LAYER "Ref"       "8" "CONTINUOUS")                       ;Goto CREATE_Layer Function, Layer Name, Color, LineType
  15. )                                                                   ;End define function
  16. ;;;/////////////////////////////////////////////////////////////////
  17. (defun CREATE_LAYER (NLAY CLR LT / LAY FRZ)                         ;Define function, Declare variables and arguments
  18. (setq LAY  (tblsearch "layer" NLAY))                              ;Search drawing to find layer
  19. (if                                                               ;If the following returns true
  20.    (not LAY)                                                       ;Layer not in drawing
  21.    (command "_.layer" "m" NLAY "c" CLR "" "lt" LT "" "")           ;Layer command ~ make new layer with color and linetype
  22.    (progn                                                          ;Then do the following
  23.      (setq FRZ (cdr (assoc 70 LAY)))                               ;Variable FRZ is frozen layer
  24.      (if (= FRZ 65)                                                ;Layer frozen from last edit
  25.        (progn                                                      ;Then do the following
  26.          (command "_.layer" "t" NLAY "")                           ;Thaw new layer if frozen
  27.          (command "_.layer" "s" NLAY "")                           ;Set new layer
  28.        )                                                           ;End progn (otherwise...)
  29.        (command "_.layer" "s" NLAY "")                             ;Set new layer
  30.      )                                                             ;End if
  31.    )                                                               ;End progn (otherwise...)
  32. )                                                                 ;End if
  33. )                                                                   ;End define function
  34. ;;;/////////////////////////////////////////////////////////////////
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 15:42:32 | 显示全部楼层
布洛赫,
 
抱歉,刚刚编辑了SET_LAYER功能,以进行颜色更正,以匹配您发布的功能。
 
秃鹰
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:46:06 | 显示全部楼层
这对你不管用吗?
 
http://www.cadtutor.net/forum/showpost.php?p=224949&postcount=5
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 15:47:57 | 显示全部楼层
这对我很有效。
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 15:52:29 | 显示全部楼层
你试了哪一部分?第一个对我有用,第二个我想得很清楚
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 15:55:40 | 显示全部楼层
经过更多测试后,它只在该层已经存在的情况下工作。我会使用李或Buzzard的方法,因为他们比我更了解LISP
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 22:18 , Processed in 0.355605 second(s), 70 queries .

© 2020-2025 乐筑天下

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