Split spline macro
Split spline macro
(OP)
Hi everybody,
I'm working with CATIA since not a long time, and I'm still a little lost, moreover on CATIA automation...The problem is that I want to split a spline (BottomSpline) using a point (ConnectionPoint(6)), and write it in a macro. Here is my code:
Dim Split1 As Split
Dim Supref As Reference
Set Supref = PtPart.CreateReferenceFromObject(ConnectionPoint(6))
Set Split1 = PtPart.ShapeFactory.AddNewSplit(Supref, BottomSpline)
Split1.AddElementToKeep BottomSpline
I'm using this 'guide', but honestly I don't understand it pretty well...
http:/ /catiadoc. free.fr/on line/CAASc dBase/CAAS cdAutomati onHome.htm
I gave as arguments the CuttingElem and the ElemToCut, however, it still gives me an error message, telling me Type Mismatch PtPart.ShapeFactory.AddNewSplit"
What does it mean??
Any help is welcome, thanks in advance,
L3munoz
I'm working with CATIA since not a long time, and I'm still a little lost, moreover on CATIA automation...The problem is that I want to split a spline (BottomSpline) using a point (ConnectionPoint(6)), and write it in a macro. Here is my code:
Dim Split1 As Split
Dim Supref As Reference
Set Supref = PtPart.CreateReferenceFromObject(ConnectionPoint(6))
Set Split1 = PtPart.ShapeFactory.AddNewSplit(Supref, BottomSpline)
Split1.AddElementToKeep BottomSpline
I'm using this 'guide', but honestly I don't understand it pretty well...
http:/
I gave as arguments the CuttingElem and the ElemToCut, however, it still gives me an error message, telling me Type Mismatch PtPart.ShapeFactory.AddNewSplit"
What does it mean??
Any help is welcome, thanks in advance,
L3munoz





RE: Split spline macro
Language="VBSCRIPT"
Sub CATMain()
Dim CATIA As Object
Dim AuxPartDocument As Object
Set CATIA = CreateObject("CATIA.Application")
CATIA.Visible = True
CATIA.Documents.Add("Part")
CATIA.Documents.Item(1).Activate
Set AuxPartDocument = CATIA.ActiveDocument
Set PtDoc = AuxPartDocument
Set PtPart = PtDoc.Part
Set PtHybridFactory = PtPart.HybridShapeFactory
Set PtHybridBody = PtPart.HybridBodies
Set myPtHybridBody = PtHybridBody.Add
myPtHybridBody.Name = "Train Geometry"
Set Point1 = PtPart.HybridShapeFactory.AddNewPointCoord(0,0,0)
Set Point2 = PtPart.HybridShapeFactory.AddNewPointCoord(10,0,0)
Set Point3 = PtPart.HybridShapeFactory.AddNewPointCoord(5,0,0)
myPtHybridBody.AppendHybridShape Point1
myPtHybridBody.AppendHybridShape Point2
myPtHybridBody.AppendHybridShape Point3
Set Spline = PtPart.HybridShapeFactory.AddNewSpline
Spline.SetSplineType 0
Spline.SetClosing 0
Spline.AddPoint Point1
Spline.AddPoint Point2
myPtHybridBody.AppendHybridShape Spline
PtPart.InWorkObject = Spline
Set mySplit = PtPart.HybridShapeFactory.AddNewHybridSplit(Point3,Spline,1)
myPtHybridBody.AppendHybridShape mySplit
PtPart.Update
End Sub
RE: Split spline macro
Set mySplit = PtPart.HybridShapeFactory.AddNewHybridSplit(Point3,Spline,1)
However, I couldn't manage to split the spline with two points. There is a method, AddCuttingElem
http:/