乐筑天下

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

[编程交流] 关于图案填充原点位置的帮助

[复制链接]

56

主题

256

帖子

230

银币

后起之秀

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

铜币
253
发表于 2022-7-5 16:33:40 | 显示全部楼层 |阅读模式
只有两个问题:
 
1.当我在默认getkword上点击return时,它无法正确运行。
 
2.当我选择除拾取图案填充位置之外的任何内容时,它将输出到已选择的每个图案填充实体的命令行。我该怎么摆脱它呢。osmode为0。
 
  1. [use current origin/Set new origin/Default to boundary extents] <Use current origin>:
  2. [bottom Left/bottom Right/top rIght/top lEft/Center] <bottom Left>:] <bottom Left>:

 
  1. ;;-----------------=={ Hatch_Origin_Location.lsp }==--------------------;;
  2. ;;  Author: 3dwannab, 2017
  3. ;;----------------------------------------------------------------------;;
  4. ;;  Version 0.1    -    18-03-2017
  5. ;;----------------------------------------------------------------------;;
  6. ;;  Hatch Location Options:
  7. ;;  BottomLeft/BottomRight/TopRight/TopLeft/Center/Pick
  8. ;;----------------------------------------------------------------------;;
  9. (defun c:HOL nil (c:Hatch_Origin_Location))
  10. (defun c:Hatch_Origin_Location ( / *error* os cmde pt ss ent data ans)
  11. (defun *error* (errmsg)
  12.         (and acDoc (vla-EndUndoMark acDoc))
  13.         (and errmsg
  14.                 (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
  15.                 (princ (strcat "\n<< Error: " errmsg " >>"))
  16.                 )
  17.         (setvar 'cmdecho cmde)
  18.         (setvar 'osmode os)
  19.         (princ)
  20.         )
  21. (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  22. (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc))
  23. (setq os (getvar "osmode"))
  24. (setq cmde (getvar "cmdecho"))
  25. (initget "BottomLeft BottomRight TopRight TopLeft Center Pick")
  26. (setq ans (getkword "\nChoose Hatch Origin Location ? [bottomLeft/BottomRight/TopRight/TopLeft/Center/Pick] <Pick>: "))
  27. (cond
  28.         (
  29.                 (= "Pick" ans)
  30.                 (sssetfirst)
  31.                 (and (setq ent (entsel "\n Select Hatch: "))
  32.                         (setq pt (getpoint "\n New Hatch Origin:"))
  33.                         (command "._HatchEdit" ent "O" "S" pt "N")
  34.                         )
  35.                 )
  36.         )
  37. (cond
  38.         (
  39.                 (/= "Pick" ans)
  40.                 (if        (setq ss (ssget "_:L" '((0 . "HATCH")))
  41.                         )
  42.                 (repeat (setq i (sslength ss))
  43.                         (setq ent (ssname ss (setq i (1- i)))
  44.                                 data (entget ent)
  45.                                 )
  46.                         (progn
  47.                                 (cond
  48.                                         (
  49.                                                 (= "BottomLeft" ans)
  50.                                                 (command "._HatchEdit" ent "O" "D" "L" "N")(princ)
  51.                                                 )
  52.                                         (
  53.                                                 (= "BottomRight" ans)
  54.                                                 (command "._HatchEdit" ent "O" "D" "R" "N")(princ)
  55.                                                 )
  56.                                         (
  57.                                                 (= "TopRight" ans)
  58.                                                 (command "._HatchEdit" ent "O" "D" "I" "N")(princ)
  59.                                                 )
  60.                                         (
  61.                                                 (= "TopLeft" ans)
  62.                                                 (command "._HatchEdit" ent "O" "D" "E" "N")(princ)
  63.                                                 )
  64.                                         (
  65.                                                 (= "Center" ans)
  66.                                                 (command "._HatchEdit" ent "O" "D" "C" "N")(princ)
  67.                                                 )
  68.                                         )
  69.                                 )
  70.                         )
  71.                 )
  72.                 )
  73.         )
  74. (*error* nil)
  75. (princ)
  76. )
  77. (vl-load-com)
  78. (princ
  79. (strcat
  80.         "\n:: Hatch_Origin_Location.lsp | Version 0.1 | \\U+00A9 3dwannab " (menucmd "m=$(edtime,0,yyyy)") " ::"
  81.         "\n:: Type "HOL" or "Hatch_Origin_Location" to Run ::"
  82.         )
  83. )
  84. (princ)
回复

使用道具 举报

0

主题

61

帖子

62

银币

限制会员

铜币
-1
发表于 2022-7-5 17:14:19 | 显示全部楼层
我可能没有完全遵循您的逻辑,但我不认为有任何东西会告诉程序默认为“pick”提示中的指示器仅供用户使用。基本上,ANS的最终COND值为零。
 
 
dJE
回复

使用道具 举报

56

主题

256

帖子

230

银币

后起之秀

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

铜币
253
发表于 2022-7-5 17:58:06 | 显示全部楼层
 
有那么一点要做。通过将变量设置为“Pick”,使用:
  1. (if (not ans) (setq ans "Pick"))

 
你能告诉我为什么即使程序中的cmdecho设置为0,它也会输出到cmd吗?
  1. (command-s "._HatchEdit" pause "O" "D" "L" "N")

 
全新代码:
  1. ;;-----------------=={ Hatch_Origin_Location.lsp }==--------------------;;
  2. ;;  Author: 3dwannab, 2017
  3. ;;----------------------------------------------------------------------;;
  4. ;;  Version 0.1    -    18-03-2017
  5. ;;----------------------------------------------------------------------;;
  6. ;;  Hatch Location Options:
  7. ;;  BottomLeft/BottomRight/TopRight/TopLeft/Center/Pick
  8. ;;----------------------------------------------------------------------;;
  9. (defun c:HOL nil (c:Hatch_Origin_Location))
  10. (defun c:Hatch_Origin_Location ( / *error* os cmde mutt pt ss ent data ans)
  11. (defun *error* (errmsg)
  12.         (and acDoc (vla-EndUndoMark acDoc))
  13.         (and errmsg
  14.                 (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
  15.                 (princ (strcat "\n<< Error: " errmsg " >>"))
  16.                 )
  17.         (setvar 'cmdecho cmde)
  18.         (setvar 'osmode os)
  19.         (setvar 'nomutt mutt)
  20.         (princ)
  21.         )
  22. (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  23. (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc))
  24. (setq os (getvar "osmode"))
  25. (setq cmde (getvar "cmdecho"))
  26. (setq ex (getvar "expert"))
  27. (setq mutt (getvar "nomutt"))
  28. (progn
  29.         (setvar 'cmdecho 0)
  30.         (setvar 'osmode 0)
  31.         (setvar 'nomutt 1)
  32.         (initget "bottomLeft bottomRight toprIght toplEft Center Pick")
  33.         (setq ans (getkword "\nX Brick Size (Standard=112.5 Joint=10)? [bottom Left/bottom Right/top rIght/top lEft/Center/Pick] <Pick>: "))
  34.         (if (not ans) (setq ans "Pick"))
  35.         (cond
  36.                 ((= "Pick" ans)
  37.                         (sssetfirst)
  38.                         (and (setq ent (entsel "\n Select Hatch: "))
  39.                                 (setq pt (getpoint "\n New Hatch Origin:"))
  40.                                 (command "._HatchEdit" ent "O" "S" pt "N")
  41.                                 )
  42.                         )
  43.                 )
  44.         (cond
  45.                 ((/= "Pick" ans)
  46.                         (if        (setq ss (ssget "_:L" '((0 . "HATCH")))
  47.                                 )
  48.                         (repeat (setq i (sslength ss))
  49.                                 (setq ent (ssname ss (setq i (1- i)))
  50.                                         data (entget ent)
  51.                                         )
  52.                                 (cond
  53.                                         ((=  "bottomLeft" ans)
  54.                                                 (command-s "._HatchEdit" ent "O" "D" "L" "N")(princ)
  55.                                                 )
  56.                                         ((= "bottomRight" ans)
  57.                                                 (command-s "._HatchEdit" ent "O" "D" "R" "N")(princ)
  58.                                                 )
  59.                                         ((= "toprIght" ans)
  60.                                                 (command-s "._HatchEdit" ent "O" "D" "I" "N")(princ)
  61.                                                 )
  62.                                         ((= "toplEft" ans)
  63.                                                 (command-s "._HatchEdit" ent "O" "D" "E" "N")(princ)
  64.                                                 )
  65.                                         ((= "Center" ans)
  66.                                                 (command-s "._HatchEdit" ent "O" "D" "C" "N")(princ)
  67.                                                 )
  68.                                         )
  69.                                 )
  70.                         )
  71.                         )
  72.                 )
  73.         T
  74.         )
  75. (*error* nil)
  76. (princ)
  77. )
  78. (vl-load-com)
  79. (princ
  80. (strcat
  81.         "\n:: Hatch_Origin_Location.lsp | Version 0.1 | \\U+00A9 3dwannab " (menucmd "m=$(edtime,0,yyyy)") " ::"
  82.         "\n:: Type "HOL" or "Hatch_Origin_Location" to Run ::"
  83.         )
  84. )
  85. (princ)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-3 20:10 , Processed in 0.545441 second(s), 59 queries .

© 2020-2025 乐筑天下

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