明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 731|回复: 1

求助

[复制链接]
发表于 2008-10-6 09:36:00 | 显示全部楼层 |阅读模式
我用以下VBA编程:

Sub 画点编程()

Dim startPoint(0 To 2) As Double

Dim OjtPoint As AcadPoint

startPoint(0) = 100 'X

startPoint(1) = 10000 'Y

startPoint(2) = 0 'Z

Set OjtPoint = ACADProject.ThisDrawing.ModelSpace.AddPoint(startPoint)

End Sub

我已置我的用户坐标为当前坐标,但结果却是画点仍以世界坐标值画.我买了一本《AutoCAD VBA二次开发教程》看,但从中未找到启发,请高手百忙中指点一下好吗?以上编程语言,要作什么修改才可以是以UCS坐标画点呢?
 楼主| 发表于 2008-10-6 14:05:00 | 显示全部楼层

' 将点的UCS坐标转化到WCS坐标

Private Function PtUcs2Wcs(ptUcs As Variant) As Variant

    PtUcs2Wcs = ThisDrawing.Utility.TranslateCoordinates(ptUcs, acUCS, acWorld, False)

End Function

 

Sub 画点编程081007()

Dim startPoint(0 To 2) As Double

Dim OjtPoint As AcadPoint

'Dim ptStart As Variant

'Dim ptEnd As Variant

Dim ptStart(0 To 2) As Double

Dim ptEnd(0 To 2) As Double

ptStart(0) = 0 ''40''X

ptStart(1) = 100 ''Y

ptStart(2) = 0 '400'''Z

Dim ptStUcs As Variant

ptStUcs = PtUcs2Wcs(ptStart)

Set OjtPoint = ThisDrawing.ModelSpace.AddPoint(ptStUcs)

End Sub

 

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

本版积分规则

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

GMT+8, 2024-11-26 06:47 , Processed in 0.150624 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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