Message 1 of 4
How to Split a SketchSpline3D and return the same path section?

Not applicable
03-08-2017
03:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Recently,I try to generate a SketchSpline3D an then split it to two section.But after split it, the spline change its original path.How can I keep its original path after split it? The test code as below:
PartDocument m_oPartPreSweepSplineDoc = m_inventorApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, m_inventorApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject), false) as PartDocument; PartComponentDefinition oPartCompDef = m_oPartPreSweepSplineDoc.ComponentDefinition; Sketch3D m_sweepSketch = oPartCompDef.Sketches3D.Add() as Sketch3D; TransientGeometry oTG = m_inventorApplication.TransientGeometry; ObjectCollection controlPoints = m_inventorApplication.TransientObjects.CreateObjectCollection(); for (int index = 0; index < 6; index++) { Point singlePoint = m_sweepSketch.SketchPoints3D.Add(oTG.CreatePoint(index * 3000, index * index * 2000, 0)).Geometry; controlPoints.Add(singlePoint); } SketchSpline3D spline = m_sweepSketch.SketchSplines3D.Add(controlPoints, SplineFitMethodEnum.kSweetSplineFit) as SketchSpline3D; AssemblyComponentDefinition oAsmCompDef = (m_inventorApplication.ActiveDocument as AssemblyDocument).ComponentDefinition; Inventor.Matrix oMatrix = oTG.CreateMatrix(); ComponentOccurrence oOcc = oAsmCompDef.Occurrences.AddByComponentDefinition(m_oPartPreSweepSplineDoc.ComponentDefinition as ComponentDefinition, oMatrix); SketchPoint3D cutpoint = m_sweepSketch.SketchPoints3D.Add(spline.StartSketchPoint.Geometry); m_sweepSketch.GeometricConstraints3D.AddCoincident(cutpoint as SketchEntity3D, spline as SketchEntity3D); WorkPlane tempPlane = m_oPartPreSweepSplineDoc.ComponentDefinition.WorkPlanes.AddByNormalToCurve(spline, cutpoint); Point originPoint = null; UnitVector xAxis = null; UnitVector yAxis = null; tempPlane.GetPosition(out originPoint, out xAxis, out yAxis); UnitVector UnitDirection = xAxis.CrossProduct(yAxis); tempPlane.Delete(); Vector direction = oTG.CreateVector(UnitDirection.X * 10000, UnitDirection.Y * 5000, UnitDirection.Z * 10); cutpoint.MoveBy(direction);
SketchPoint3D splitPoint = spline.InsertFitPoint(cutpoint.Geometry); SketchSpline3D sp = spline.Split(splitPoint); spline.Delete();
The result as shown in picture.The smooth one is original one ,and the other is the split one.It is clear that the first part from start point to cut point is ok,but the rest one is not the same as before.I have tried skecthSplinehandle3D to resolve it.No luck.Any help?