明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: masterlong

请教:如何用autolisp实现斜向的getcorner

  [复制链接]
发表于 2006-3-28 22:30 | 显示全部楼层
现在看来可能用改UCS和REC的方法比较能达到一种动态的效果。
发表于 2006-3-28 23:24 | 显示全部楼层
  1. (load "xyp_lib.vlx")  ;版本 V.20060327
  2. ;|下载和加载通用函数(可在签名栏直接下载后放到搜索路径下)
  3. 利用以下任何一种方式(首选第一种)即可加载和运行通用函数内的所有子程序:
  4. ★1·在acad.lsp中增加(load"xyp_lib.vlx")
  5. ■2·在每个程序内增加(load"xyp_lib.vlx")
  6. ■3·在command下,输入(load"xyp_lib.vlx")
  7. ■4·在菜单.mnl中增加(load"xyp_lib.vlx")
  8. ■5·将xyp_lib.vlx文件直接拽到cad屏幕
  9. [COLOR=red] ★通用函数下载地址:[/COLOR]
  10. [url]http://www.xdcad.net/forum/attachment.php?s=&postid=1606661[/url]
  11. |;
  12. ;;;xxjx(斜向矩形)
  13. (defun c:xxjx ()
  14.   (cmdla0)
  15.   (command "ucs" "")
  16.   (prompt "\n两点确定斜向角度: ")
  17.   (while (not (Setq pt1 (getpoint "\n起点: "))))
  18.   (while (not (Setq pt2 (getpoint pt1 "\n下一点: "))))
  19.   (setq ang1 (* 180 (/ (angle pt1 pt2) PI)))
  20.   (command "ucs" "z" ang1)
  21.   (while (Setq pt1 (getpoint "\n斜方块起点<退出>: "))
  22.     (if (Setq pt2 (getcorner pt1 "\n斜方块对角点<重设起点>: "))
  23.       (command "rectang" pt1 pt2)
  24.     )
  25.   )
  26.   (command "ucs" "")
  27.   (cmdla1)
  28. )
发表于 2006-3-29 07:48 | 显示全部楼层
xyp1964发表于2006-3-28 23:24:00 (load \"xyp_lib.vlx\") ;版本 V.20060327;|下载和加载通用函数(可在签名栏直接下载后放到搜索路径下)利用以下任何一种方式(首选第一种)...

(while (Setq pt1 (getpoint "\n斜方块起点<退出>: "))
     (if (Setq pt2 (getcorner pt1 "\n斜方块对角点<重设起点>: "))
       (command "rectang" pt1 pt2)
     )
   )
这段中的getcorner用得效果不好,既然程序前面已经给定两个点,再在WHILE里再输入两个点,好象操作不太方便!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-25 15:21 , Processed in 0.119330 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表