VB,macro的做法
比如3点-〉1spline
宏指令是
Language="VBSCRIPT"
Sub CATMain()
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set hybridShapeSpline1 = hybridShapeFactory1.AddNewSpline()
hybridShapeSpline1.SetSplineType 0
hybridShapeSpline1.SetClosing 0
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1")
Set hybridShapes1 = hybridBody1.HybridShapes
Set hybridShapePointOnPlane1 = hybridShapes1.Item("oint.6")
Set reference1 = part1.CreateReferenceFromObject(hybridShapePointOnPlane1)
hybridShapeSpline1.AddPointWithConstraintExplicit reference1, Nothing, -1.000000, 1, Nothing, 0.000000
Set hybridShapePointOnPlane2 = hybridShapes1.Item("oint.5")
Set reference2 = part1.CreateReferenceFromObject(hybridShapePointOnPlane2)
hybridShapeSpline1.AddPointWithConstraintExplicit reference2, Nothing, -1.000000, 1, Nothing, 0.000000
Set hybridShapePointOnPlane3 = hybridShapes1.Item("oint.7")
Set reference3 = part1.CreateReferenceFromObject(hybridShapePointOnPlane3)
hybridShapeSpline1.AddPointWithConstraintExplicit reference3, Nothing, -1.000000, 1, Nothing, 0.000000
hybridBody1.AppendHybridShape hybridShapeSpline1
part1.InWorkObject = hybridShapeSpline1
part1.Update
End Sub
把里头的点坐标用VB之类的写,从excel文件读将来就好 |