改成下面的试试,主要是运行InsertMoveCopyBody2前要有个选择语句,这样InsertMoveCopyBody2方法才知道要移动那一个对象。
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim Feature As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set Feature = Part.InsertPart("F:\my documents\冲头一.SLDPRT", False, False, True)
boolstatus = Part.Extension.SelectByID("<冲头一>-<拉伸1>", "SOLIDBODY", 0, 0, 0, True, 1, Nothing)
Part.FeatureManager.InsertMoveCopyBody20 , 0.01, 0, 0, 0, 0, 0, 0, 0, 0, False, 0
End Sub |