找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1173|回复: 1

[他山之石] 用Entmake制造遮盖实体

[复制链接]
发表于 2013-5-25 03:47:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 Free-Lancer 于 2013-5-26 06:27 编辑

LISP (entmake)’ing a WipeOut object in AutoCAD gives different coordinates than expected                                                        by Fenton Webb
Here’s one from the past I thought you might all like to see.
Using LISP to (entmake) a Wipeout object inside of AutoCAD… Adding the x,y,z values for group code 10 and the coordinates for the boundary (group code 14) it seems that when the wipeout is created it is not located at the specified coordinates…
The reason is because some objects use the OCS (Object Coordinate System)
Here’s a couple of examples which show how to deal specifically with the WipeOut object so that it places in the drawing as you would expect.
  1. (defun c:makewo (/ )
  2.   (setq ins_pt (getpoint "select a point for lower left of 2x2 wipeout"))
  3.   ; Add 1.5 to the x and subtract .5 from the Y point
  4.   ; With this change to the point used for the lower left
  5.   ; the wipeout is the same as the selected point.
  6.   (setq xVal (nth 0 ins_pt))
  7.   (setq xVal (+ xVal 1.5))
  8.   (setq yVal (nth 1 ins_pt))
  9.   (setq yVal (- yVal 0.5))

  10.   (entmake
  11.     (list
  12.       '(0 . "WIPEOUT")
  13.       '(100 . "AcDbEntity")
  14.       '(8 . "0")
  15.       '(100 . "AcDbWipeout")
  16.       (cons 10 (list xVal yVal 0.0))
  17.       (cons 11 '(0.0 1.0 0.0))
  18.       (cons 12 '(1.0 0.0 0.0))
  19.       (cons 13 '(1.0 1.0 0.0))
  20.       '(70 . 7)
  21.       '(280 . 1)
  22.       '(281 . 50)
  23.       '(282 . 50)
  24.       '(283 . 0)
  25.       '(71 . 2); 1=RECTANGLE 2=POLYGON
  26.       '(91 . 5); NUMBER OF VERTICIES TO FOLLOW

  27.       ; Note: X and Y are reversed compared to the UCS
  28.       ; the origin of these points is the lower right
  29.       ; This is the lower right corner
  30.       (cons 14 '(0.0 0.0 0.0))
  31.       ;x and y are reversed 2.0 is the first y coordinate
  32.       ;on the upper right corner
  33.       (cons 14 '(2.0 0.0 0.0))
  34.       ;This is the upper left corner
  35.       ; Notice that the second coordinate is the X value
  36.       ; and that a positive value moves it to the left which is
  37.       ; the opposite of the default UCS.
  38.       (cons 14 '(2.0 2.0 0.0))
  39.       ;This is the lower left corner
  40.       (cons 14 '(0.0 2.0 0.0))
  41.       ;This completes the boundary of the wipeout
  42.       ;needs to be the same as the first coordinate
  43.       (cons 14 '(0.0 0.0 0.0))

  44.       )
  45.     )
  46.   )


  47. (defun c:makewo2 ()
  48.   (setq ins_pt (getpoint "select a point"))
  49.   (setq xVal (nth 0 ins_pt))
  50.   (setq xVal (+ xVal 1.5))
  51.   (setq yVal (nth 1 ins_pt))
  52.   (setq yVal (- yVal 0.5))
  53.   (entmake
  54.     (list
  55.       '(0 . "WIPEOUT")
  56.       '(100 . "AcDbEntity")
  57.       '(8 . "0")
  58.       '(100 . "AcDbWipeout")
  59.       (cons 10 (list xVal yVal 0.0))
  60.       (cons 11 '(0.0 1.0 0.0))

  61.       (cons 12 '(1.0 0.0 0.0))
  62.       (cons 13 '(1.0 1.0 0.0))
  63.       '(70 . 7)
  64.       '(280 . 1)
  65.       '(281 . 50)
  66.       '(282 . 50)
  67.       '(283 . 0)
  68.       '(71 . 2)
  69.       '(91 . 9)
  70.       (cons 14 '(0.7888 -0.9376 0.0))
  71.       (cons 14 '(-0.9336 0.7792 0.0))
  72.       (cons 14 '(-0.9376 3.2112 0.0))
  73.       (cons 14 '(0.7792 4.9336 0.0))
  74.       (cons 14 '(3.2112 4.9376 0.0))
  75.       (cons 14 '(4.9336 3.2208 0.0))
  76.       (cons 14 '(4.9376 0.7888 0.0))
  77.       (cons 14 '(3.2208 -0.9336 0.0))
  78.       (cons 14 '(0.7888 -0.9376 0.0))
  79.       )
  80.     )
  81.   )


评分

参与人数 2D豆 +7 贡献 +1 收起 理由
Highflybird + 5 + 1 好主题奖!
ScmTools + 2 很给力!经验;技术要点;资料分享奖!

查看全部评分

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2013-5-28 17:24:14 | 显示全部楼层
这么多表啊
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-25 14:29 , Processed in 0.378315 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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