Private Sub CommandButton2_Click()
Dim MyDocuments As Documents
Set MyDocuments = CATIA.Documents
Dim MypartDocument As PartDocument
Set MypartDocument = MyDocuments.Add("art")
Dim MySpecsAndGeomWindow As SpecsAndGeomWindow
Set MySpecsAndGeomWindow = CATIA.ActiveWindow
MySpecsAndGeomWindow.WindowState = catWindowStateMaximized
'以上是窗体初始化
'以下是PAD造型
Dim MyApp As Application
Dim MyDoc As Document
Dim MyPart As Part
Set MyApp = GetObject(, "CATIA.Application")
Set MyDoc = MyApp.ActiveDocument
Set MyPart = MyDoc.Part
Dim MyBody As Body
Set MyBody = MyPart.Bodies.Item("artBody")
Dim MyPlane As Plane
Set MyPlane = MyPart.OriginElements.PlaneXY
Dim MySkt As Sketch
Set MySkt = MyBody.Sketches.Add(MyPlane)
MySkt.OpenEdition
Dim MyFact As Factory2D
Dim MyCircle As Circle2D
Set MyFact = MySkt.Factory2D
Set MyCircle = MyFact.CreateCircle(0, 0, 50, 0, 0)
MySkt.CloseEdition
Dim MyPad As Pad
Dim Sf As Factory
Set Sf = MyPart.ShapeFactory
Set MyPad = Sf.AddNewPad(MySkt, 50)
MyPart.Update
End Sub
在V5R10的VBA便宜器中编译通过
请把上面的代码也写出来好么?
不然看不到你的代码的全部,也许是其他地方的错误传到这一行上了 |