Notifications
Clear all

[Closed] get spline from railing object

How can i get the spline back from a existing railing AEC object?

1 Reply

Have a solution, but it’s ugly:

filtered_objects = $*/geometry as array

for obj in filtered_objects do (   
    obj2 = copy obj
    obj2.Top_Rail_Profile = 2
    obj2.Lower_Rail_Profile = 0
    obj2.Post_Profile = 0
    obj2.Top_surface_of_Top_Rail_Height = 3
    obj2.Top_Rail_Width = 0
    obj2.Top_Rail_Depth = 0
    obj2.Top_surface_of_Top_Rail_Height = 0
    
    convertTo obj2 PolyMeshObject

    num_vert = obj2.EditablePoly.GetNumVertices()
    obj2.EditablePoly.SetSelection #Vertex #{1..num_vert}
    obj2.weldThreshold = 0.0
    obj2.EditablePoly.weldFlaggedVertices()
    
    new_spline = splineShape ()
    addNewSpline new_spline
    
    for i = 1 to obj2.GetNumVertices() do (
        vertex = obj2.GetVertex i
        addKnot new_spline 1 #corner #line vertex
    )
    weldSpline new_spline 0.01
    
    new_spline.transform = obj.transform
    updateShape new_spline
    
    delete obj2
)