|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
以下的是获取的装配体外形尺寸写入配置
但是我现在需要的是零件的
- Dim swApp As SldWorks.SldWorks
- Dim swModel As SldWorks.ModelDoc2
- Dim vBox As Variant
- Dim X_max As Double
- Dim X_min As Double
- Dim Y_max As Double
- Dim Y_min As Double
- Dim Z_max As Double
- Dim Z_min As Double
- Dim chang As Double
- Dim kuan As Double
- Dim gao As Double
- Sub main()
- Set swApp = Application.SldWorks
- Set swModel = swApp.ActiveDoc
- vBox = swModel.GetBox() '获取装配体的边界框swBoundingBoxIncludeRefPlanes
-
- X_max = vBox(3) '获取边界框6个点的坐标
- X_min = vBox(0)
- Y_max = vBox(4)
- Y_min = vBox(1)
- Z_max = vBox(5)
- Z_min = vBox(2)
-
- chang = X_max * 1000 - X_min * 1000 '获取长宽高
- kuan = Y_max * 1000 - Y_min * 1000
- gao = Z_max * 1000 - Z_min * 1000
-
- blnretval = swModel.DeleteCustomInfo2("", "外形尺寸") '把数据导入属性栏
- blnretval = swModel.AddCustomInfo3("", "外形尺寸", swCustomInfoText, Format(chang, "0.0") & "*" & Format(kuan, "0.0") & "*" & Format(gao, "0.0"))
-
- End Sub
复制代码
|
|