jerryjun wrote:
這一行似乎有問題
Dim Pad1 as Pad
好像沒有Pad這種性質
apple_bao_bao wrote:
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便宜器中编译通过
欢迎光临 iCAx开思工具箱 (https://t.icax.org/) | Powered by Discuz! X3.3 |