明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1938|回复: 4

[求助]如何在块中改变属性的插入点?

[复制链接]
发表于 2004-3-8 09:02:00 | 显示全部楼层 |阅读模式
(defun c:oo (/ pt doc pl att pt2 p block blocks blockref line)
(setq pt (getpoint "Enter the insert position:"))
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq blocks (vla-get-blocks doc))
(setq block (vla-add blocks (vlax-3d-point pt) "*U"))
(setq pt2 (polar pt 0 15))
(setq line (vla-addline block (vlax-3d-point pt) (vlax-3d-point pt2)))
(setq att (vla-Addattribute
block
3.5
0
"HELLO"
(vlax-3d-point '(0 0 0))
"hello1"
"hello2"
)
)
(setq blockref (vla-insertblock
(vla-get-ModelSpace doc)
(vlax-3d-point pt)
(vla-get-name block)
1
1
1
0
)
)
(vla-put-endpoint line (vlax-3d-point '(0 0 0)))
(vla-put-InsertionPoint att (vlax-3d-point '(0 0 0)))
(vla-update line)
(vla-update att)
(vla-update blockref)
(princ)
) ;;;这里能改变线的端点,却不能改变属性的插入点,为何?
发表于 2004-3-8 12:49:00 | 显示全部楼层
(defun c:oo (/ pt doc pl att pt2 p block blocks blockref line origin)
(setq pt (getpoint "Enter the insert position:"))
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq blocks (vla-get-blocks doc))
(setq block (vla-add blocks (vlax-3d-point pt) "*U"))
(setq pt2 (polar pt 0 15))
(setq line (vla-addline block (vlax-3d-point pt) (vlax-3d-point pt2)))
(setq att (vla-Addattribute
block
3.5
0
"HELLO"
(vlax-3d-point '(0 0 0))
"hello1"
"hello2"
)
)
(setq blockref (vla-insertblock
(vla-get-ModelSpace doc)
(vlax-3d-point pt)
(vla-get-name block)
1
1
1
0
)
)
(vla-put-endpoint line (vlax-3d-point '(0 0 0)))
(setq origin (vla-get-origin block))
(VLA-PUT-ORIGIN BLOCK (VLAX-3D-POINT '(0 0 0)))
(VLA-MOVE BLOCKREF origin (VLAX-3D-POINT '(0 0 0)))
(vla-update line)
(vla-update att)
(vla-update blockref)
(princ)
)
 楼主| 发表于 2004-3-8 16:05:00 | 显示全部楼层
非常感激,但如果不把块参考的插入点移动,只更新属性的插入点,就如那条线一样,只更新它的端点,该怎么办?
发表于 2004-3-8 20:49:00 | 显示全部楼层

本帖子中包含更多资源

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

x
 楼主| 发表于 2004-3-12 17:33:00 | 显示全部楼层
搞定,感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 20:38 , Processed in 0.187454 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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