服务您是我们的荣幸
2020-04-07
150****7331
Inventor
下列程序段须在ipt文件中运行,第四行的item(1)表示当前ipt文件中的第一个三维草图,这里的1可以换成相应三维草图的名称,记得要用双引号把名称包住,也就是要用字符串形式表示三维草图名,item(2)表示该三维草图中的第二个点,请根据情况自己更改,这里的2只能更改其他的数字,因为点是没有名称的,只有在系统里的内置序号,序号是根据你作图时的放置点的顺序来的。
这里的坐标值我都用了*10或者/10来转换数值,因为inventor的内置默认单位是厘米,而显示的单位是根据文档设置来的,一般大家用的都是毫米,所以我直接转换了,没有再去找相应的API先更改内置默认单位。
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oSP3D As SketchPoint3D
oSP3D = oDoc.ComponentDefinition.Sketches3D.Item(1).SketchPoints3D.Item(4)
MessageBox.Show("X:" + CStr(oSP3D.Geometry.X * 10) + Chr(10) + "Y:" + CStr(oSP3D.Geometry.Y * 10) + Chr(10) + "Z:" + CStr(oSP3D.Geometry.Z * 10), "提示")
Dim UserPoint As String = InputBox("请输入想要移动到的坐标值,格式为:X,Y,Z", "提示")
Dim PointX As Double = Left(UserPoint, InStr(UserPoint, ",") -1)
UserPoint = Right(UserPoint, Len(UserPoint) -InStr(UserPoint, ","))
Dim PointY As Double = Left(UserPoint, InStr(UserPoint, ",") -1)
Dim PointZ As Double = Right(UserPoint, Len(UserPoint) -InStr(UserPoint, ","))
Dim UP As Point
UP=ThisApplication.TransientGeometry.Point(PointX/10,PointY/10,PointZ/10)
oSP3D.MoveTo(UP)
Copyright © 2019 FOMT360 沪ICP备17004251号-1   Address:厦门市湖里区日华国际大厦301J-K phone: 0592-5590932