几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » ObjectARX(VB.NET/C#)
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-29, 05:26 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】在vba中求点的ucs坐标,嘿嘿,在工程中用处可大了 - 精华帖集合

在vba中求点的ucs坐标,嘿嘿,在工程中用处可大了 - 精华帖集合
www.dimcax.com
在vba中求点的ucs坐标,嘿嘿,在工程中用处可大了
'*感谢卢老师,感谢peter
'*已知点在wcs中的坐标,如何求在ucs中的坐标
sub example_translatecoordinates()
' this example creates a ucs with an origin at 2, 2, 2.
' next, a point is entered by the user. the wcs and ucs
' coordinates of that point are output in a msgbox.

' create a ucs named "new_ucs" in current drawing
dim ucsobj as acaducs
dim origin(0 to 2) as double
dim xaxispnt(0 to 2) as double
dim yaxispnt(0 to 2) as double

' define the ucs
origin(0) = 2#: origin(1) = 2#: origin(2) = 2#
xaxispnt(0) = 5#: xaxispnt(1) = 2#: xaxispnt(2) = 2#
yaxispnt(0) = 2#: yaxispnt(1) = 6#: yaxispnt(2) = 2#

' add the ucs to the usercoordinatessystems collection
set ucsobj = thisdrawing.usercoordinatesystems.add(origin, xaxispnt, yaxispnt, "new_ucs")
thisdrawing.activeucs = ucsobj

' get the active viewport and make sure the ucs icon is on
dim viewportobj as acadviewport
set viewportobj = thisdrawing.activeviewport
viewportobj.ucsiconon = true
viewportobj.ucsiconatorigin = true
thisdrawing.activeviewport = viewportobj

' have the user enter a point
dim pointwcs as variant
pointwcs = thisdrawing.utility.getpoint(, "enter a point to translate:")

' translate the point into ucs coordinates
dim pointucs as variant
pointucs = thisdrawing.utility.translatecoordinates(pointwcs, acworld, acucs, false)

' display the coordinates
msgbox "the point has the following coordinates:" & vbcrlf & _
"wcs: " & pointwcs(0) & ", " & pointwcs(1) & ", " & pointwcs(2) & vbcrlf & _
"ucs: " & pointucs(0) & ", " & pointucs(1) & ", " & pointucs(2), , "translatecoordinates example"
end sub
来顶个啦
俺也来顶
如此高深的程序,怎能不顶!
坐标系转换时候会有一定的误差,在程式中就把它消灭掉最好了~
impossible is nothing
这个主要用在工程放样做模具的时候很有用
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 02:35 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多