How to split selected spline from the picked point

How to split selected spline from the picked point

kite15
Advocate Advocate
516 Views
4 Replies
Message 1 of 5

How to split selected spline from the picked point

kite15
Advocate
Advocate

Hi,

Can anyone help NurbSpline a picked spline in Revit 2021?

Any idea about how I can start to split the picked one

 

Thank you

0 Likes
Accepted solutions (1)
517 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Use the original spline data to create two new separate splines.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 5

kite15
Advocate
Advocate

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.

0 Likes
Message 4 of 5

RPTHOMAS108
Mentor
Mentor
Accepted solution

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

 

 

Message 5 of 5

kite15
Advocate
Advocate

Awesome.. Thank you .. its working fine

0 Likes