宏
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(0.000000, 0.000000, 0.000000)
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Open_body.1")
hybridBody1.AppendHybridShape hybridShapePointCoord1
part1.InWorkObject = hybridShapePointCoord1
part1.Update
Set originElements1 = part1.OriginElements
Set hybridShapePlaneExplicit1 = originElements1.PlaneXY
Set reference1 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1)
Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
Set hybridShapeLineNormal1 = hybridShapeFactory1.AddNewLineNormal(reference1, reference2, 0.000000, 20.000000, False)
hybridBody1.AppendHybridShape hybridShapeLineNormal1
part1.InWorkObject = hybridShapeLineNormal1
part1.Update
Set hybridShapePointCoord2 = hybridShapeFactory1.AddNewPointCoord(15.000000, 15.000000, 0.000000)
hybridBody1.AppendHybridShape hybridShapePointCoord2
part1.InWorkObject = hybridShapePointCoord2
part1.Update
Set reference3 = part1.CreateReferenceFromObject(hybridShapeLineNormal1)
Set reference4 = part1.CreateReferenceFromObject(hybridShapePointCoord2)
Set hybridShapeHelix1 = hybridShapeFactory1.AddNewHelix(reference3, False, reference4, 15.000000, 10.000000, False, 0.000000, 0.000000, False)
hybridShapeHelix1.PitchLawType = 0
hybridShapeHelix1.SetStartingAngle 0.000000
hybridShapeHelix1.SetHeight 60.000000
hybridBody1.AppendHybridShape hybridShapeHelix1
part1.InWorkObject = hybridShapeHelix1
part1.Update
Set reference5 = part1.CreateReferenceFromObject(hybridShapePointCoord2)
Set hybridShapeSphere1 = hybridShapeFactory1.AddNewSphere(reference5, Nothing, 2.000000, -45.000000, 45.000000, 0.000000, 180.000000)
hybridShapeSphere1.Limitation = 1
hybridBody1.AppendHybridShape hybridShapeSphere1
part1.InWorkObject = hybridShapeSphere1
part1.Update
Dim i
For i=1 To 20
Set reference6 = part1.CreateReferenceFromObject(hybridShapeHelix1)
Set reference7 = part1.CreateReferenceFromObject(hybridShapePointCoord2)
Set hybridShapePointOnCurve1 = hybridShapeFactory1.AddNewPointOnCurveWithReferenceFromDistance(reference6, reference7, 20.000000, False)
Set hybridShapePointCoord2 = hybridShapePointOnCurve1
hybridBody1.AppendHybridShape hybridShapePointOnCurve1
part1.InWorkObject = hybridShapePointOnCurve1
part1.Update
Set reference8 = part1.CreateReferenceFromObject(hybridShapePointOnCurve1)
Set hybridShapeSphere2 = hybridShapeFactory1.AddNewSphere(reference8, Nothing, 2.000000, -45.000000, 45.000000, 0.000000, 180.000000)
hybridShapeSphere2.Limitation = 1
hybridBody1.AppendHybridShape hybridShapeSphere2
part1.InWorkObject = hybridShapeSphere2
part1.Update
Next
End Sub |