VBA开发记录:Solidoworks在实战中应用的属性
Dim swApp As Object
Dim Part As Object
Dim Part1 As Object
Dim Part2 As Object
Sub test()
Set swApp = GetObject(, "SldWorks.Application") '配置程序
Set Part = swApp.ActiveDoc
Set Part1 = swApp.ActiveDoc.Extension
Set Part2 = swApp.ActiveDoc.ActiveView
Debug.Print Part.GetFeatureManagerWidth'获取Solidworks的导航栏宽度
Part.SetFeatureManagerWidth (0)'设置Solidworks的导航栏宽度为0
Part.SetFeatureManagerWidth (228)'设置Solidworks的导航栏宽度为228
Part1.HideFeatureManager (True)'隐藏Solidworks的导航栏
Part1.HideFeatureManager (False)'显示Solidworks的导航栏
Part.ShowNamedView2 "*前视", 1'调整Solidworks当前视图为前视图
Part.ViewZoomtofit2’'设置Solidworks视图为适应大小
Part2.ZoomByFactor (1.4)'设置Solidworks视图Zoom(适应大小)的1.4倍
longstatus = Part.SaveAs3("C:\test.JPG", 0, 2)'当前视图保存为图片
End Sub
技术交流,软件开发,欢迎微信沟通: