明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2848|回复: 4

vla-GetBoundingBox方法可以用???

[复制链接]
发表于 2004-6-18 14:01:00 | 显示全部楼层 |阅读模式
中心旋转OBJECT (DEFUN c:crt ()
(SETQ minExt (VLAX-MAKE-SAFEARRAY VLAX-VBVARIANT '(0 . 2))
maxExt (VLAX-MAKE-SAFEARRAY VLAX-VBVARIANT '(0 . 2))
np (VLAX-MAKE-SAFEARRAY VLAX-VBDOUBLE '(0 . 2))
)
(SETQ ss (VLAX-ENAME->VLA-OBJECT (car(entsel))))
(VLA-INITIALIZEUSERINPUT (acad-utility) 1)
(SETQ rot (VLA-GETANGLE (acad-utility) "请输入角度:)"))
(IF (= (VLA-GET-OBJECTNAME ss) "AcDbTEXT")
(PROGN
(VLA-GETBOUNDINGBOX ss minExt maxExt))
(SETQ x (VLAX-SAFEARRAY-GET-ELEMENT minExt 0)
y (VLAX-SAFEARRAY-GET-ELEMENT minExt 1)
x1 (VLAX-SAFEARRAY-GET-ELEMENT maxExt 0)
y1 (VLAX-SAFEARRAY-GET-ELEMENT maxExt 1)
)
(SETQ nx (+ x (/ (- x1 x) 2))
ny (+ y (/ (- y1 y) 2))
)
(VLAX-SAFEARRAY-PUT-ELEMENT np 0 nx)
(VLAX-SAFEARRAY-PUT-ELEMENT np 1 ny)
(VLAX-SAFEARRAY-PUT-ELEMENT np 2 0)
(VLA-ROTATE si np rot) )
)
)
为什么说我Automation错误 VLA-GETBOUNDINGBOX 怎么用? 请各位高手赐教!
发表于 2004-6-18 14:43:00 | 显示全部楼层
Many mistakes :) (DEFUN c:crt ()
(SETQ minExt (VLAX-MAKE-SAFEARRAY VLAX-VBVARIANT '(0 . 2))
maxExt (VLAX-MAKE-SAFEARRAY VLAX-VBVARIANT '(0 . 2))
np (VLAX-MAKE-SAFEARRAY VLAX-VBDOUBLE '(0 . 2))
)
(SETQ ss (VLAX-ENAME->VLA-OBJECT (car (entsel))))
(VLA-INITIALIZEUSERINPUT (acad-utility) 1)
(IF (= (VLA-GET-OBJECTNAME ss) "AcDbText")
(PROGN
(VLA-GETBOUNDINGBOX ss 'minExt 'maxExt)
(SETQ x (VLAX-SAFEARRAY-GET-ELEMENT minExt 0)
y (VLAX-SAFEARRAY-GET-ELEMENT minExt 1)
x1 (VLAX-SAFEARRAY-GET-ELEMENT maxExt 0)
y1 (VLAX-SAFEARRAY-GET-ELEMENT maxExt 1)
)
(SETQ nx (+ x (/ (- x1 x) 2))
ny (+ y (/ (- y1 y) 2))
)
(VLAX-SAFEARRAY-PUT-ELEMENT np 0 nx)
(VLAX-SAFEARRAY-PUT-ELEMENT np 1 ny)
(VLAX-SAFEARRAY-PUT-ELEMENT np 2 0)
(SETQ rot (VLA-GETANGLE (acad-utility) np "\nInput angle: "))
(VLA-ROTATE ss np rot) )
)
)
(defun acad-utility ()
(vla-get-utility
(vla-get-activedocument (vlax-get-acad-object))
)
)
 楼主| 发表于 2004-6-20 21:35:00 | 显示全部楼层
原来如此 谢谢alin 以后还请多多指教!!


那么 object.GetEntity Object, PickedPoint[, Prompt]


用vlisp解释应该是 (vla-getentity        object 'pickedpoint         [msg])


对吗?
发表于 2004-6-21 00:34:00 | 显示全部楼层
应该是 (vla-getentity        object 'object 'pickedpoint         [msg])


第一个object是utility, 即上面程序中的(acad-utility)


第二个为选中的输出的object
 楼主| 发表于 2004-6-21 23:24:00 | 显示全部楼层
再次感谢ALIN
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 12:46 , Processed in 0.181161 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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