Use the original spline data to create two new separate splines.
Thank you Mr. Jeremy,
Can you please, suggest how I can adjust the vertices according to the current Spline form?
For example, if I like to split this into three parts.
Kinly, give some more light on this.
Thanks.
You can change the bound limits the downside is the control points remain the same.
Below is for detail curves but same applies to model curves.
Private Class RT_SelCurveElement
Implements Autodesk.Revit.UI.Selection.ISelectionFilter
Public Function AllowElement(elem As Element) As Boolean Implements Selection.ISelectionFilter.AllowElement
Return TypeOf elem Is DetailCurve
End Function
Public Function AllowReference(reference As Reference, position As XYZ) As Boolean Implements Selection.ISelectionFilter.AllowReference
Return True
End Function
End Class
Private Function Obj_231109a(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData,
ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Result
Dim UIApp As UIApplication = commandData.Application
Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
If UIDoc Is Nothing Then Return Result.Cancelled Else
Dim Doc As Document = UIDoc.Document
Dim R As Reference = Nothing
Try
R = UIDoc.Selection.PickObject(Selection.ObjectType.PointOnElement, New RT_SelCurveElement)
Catch ex As Exception
Return Result.Cancelled
End Try
Dim crvEl As CurveElement = Doc.GetElement(R)
Dim Crv As Curve = crvEl.GeometryCurve
Dim IR As IntersectionResult = Crv.Project(R.GlobalPoint)
Dim Param As Double = IR.Parameter
Dim crv0 = Crv.Clone
Dim crv1 = Crv.Clone
crv0.MakeBound(crv0.GetEndParameter(0), Param)
crv1.MakeBound(Param, crv1.GetEndParameter(1))
Using Tx As New Transaction(Doc, "Split detail curve")
If Tx.Start = TransactionStatus.Started Then
Dim DC0 As DetailCurve = Doc.Create.NewDetailCurve(UIDoc.ActiveGraphicalView, crv0)
Dim DC1 As DetailCurve = Doc.Create.NewDetailCurve(UIDoc.ActiveGraphicalView, crv1)
DC0.LineStyle = crvEl.LineStyle
DC1.LineStyle = crvEl.LineStyle
Doc.Delete(crvEl.Id)
Tx.Commit()
End If
End Using
Return Result.Succeeded
End Function