关于vla-intersectwith求交点的一点疑惑
用vla-intersectwith求交点,在不延伸情况下,无论有没有交点都返回#<variant 8197 ..,那该怎么判断到底有没有交点呢? changyiran 发表于 2012-6-6 16:18 static/image/common/back.gif非常感谢,刚才我用VLAX-SAFEARRAY-GET-l-BOUND 试的,但没加后面的维数1,结果返回了错误信息,原来1是必 ...
用如下方法就无需转换数据
(vlax-invoke (vlax-ename->vla-object (car(entsel))) 'IntersectWith (vlax-ename->vla-object (car(entsel))) acExtendNone) 本帖最后由 caddog 于 2012-6-6 16:14 编辑
用VLAX-VARIANT-VALUE函数返回变体的值(设为ver-interse),再用(VLAX-SAFEARRAY-GET-U-BOUND ver-interse 1)返回变体数组的上界,若没有交点,应为-1
若有的话,用(VLAX-SAFEARRAY->LIST ver-interse)将之转换为表就好操作了。
关键的语句如下:
(setq obj1 (vlax-ename->vla-object (car(entsel)))
obj2(vlax-ename->vla-object (car(entsel))))
(setq ver-interse
(VLAX-VARIANT-VALUE
(VLA-INTERSECTWITH obj1 obj2 2)
)
)
(VLAX-SAFEARRAY-GET-U-BOUND ver-interse 1)
(VLAX-SAFEARRAY->LIST ver-interse)
Gu_xl 发表于 2012-6-6 16:40
用如下方法就无需转换数据
(vlax-invoke (vlax-ename->vla-object (car(entsel))) 'IntersectWith (vlax ...
这个方法的确好。{:1_1:} caddog 发表于 2012-6-6 16:11 static/image/common/back.gif
用VLAX-VARIANT-VALUE函数返回变体的值(设为ver-interse),再用(VLAX-SAFEARRAY-GET-U-BOUND ver-interse ...
非常感谢,刚才我用VLAX-SAFEARRAY-GET-l-BOUND 试的,但没加后面的维数1,结果返回了错误信息,原来1是必须的啊,求下标为0. acet-geom-intersectwith
(acet-geom-intersectwith (car (entsel)) (car (entsel)) 3)
Gu_xl 发表于 2012-6-6 16:40 static/image/common/back.gif
用如下方法就无需转换数据
(vlax-invoke (vlax-ename->vla-object (car(entsel))) 'IntersectWith (vlax ...
版主这个牛逼,佩服! Andyhon 发表于 2012-6-6 16:42 static/image/common/back.gif
acet-geom-intersectwith
(acet-geom-intersectwith (car (entsel)) (car (entsel)) 3)
运行时提示没有acet-geom-intersectwith这个函数,不知为何。 Acet-* 需要 Express Tools 支持 好好学习。 Andyhon 发表于 2012-6-6 18:08 static/image/common/back.gif
Acet-* 需要 Express Tools 支持
哦,谢谢,学习了。