Delete Grip-points vb.net


#1

Hi,

I’m trying to delete some grips points through my plugin (Mesh object).
I first let someone select the points with lasso and then get them inside the plugin and try to delete them.

Dim refs As Rhino.DocObjects.ObjRef() = Nothing
Dim rc As Result = Rhino.Input.RhinoGet.GetMultipleObjects("Select points", False, DocObjects.ObjectType.Grip, refs)
 If rc <> Rhino.Commands.Result.Success Then
Return rc
End If

   doc.Objects.Delete(refs, True)

But its not working for grip objects somehow.


(Menno Deij - van Rijswijk) #2

Don’t use ObjectType.Grip - use ObjectType.MeshVertex to select points in a Mesh. Then refer to the ObjRef.ComponentIndex to find the index of the mesh vertex selected.


(Dale Fugier) #3

For the time being, Menno’s suggest is correct. But, there should be a way to delete grip objects and have the owning object (parent) update. I’ve added this to the “to-do” list…


#4

I know it has been a while but I’m just looking back at this post and trying to get it to work again.
But I really cant figure this one out.
I’ve changed it too:

Dim refs As Rhino.DocObjects.ObjRef() = Nothing
Dim rc As Result = Rhino.Input.RhinoGet.GetMultipleObjects("Select points", False, DocObjects.ObjectType.MeshVertex, refs)
 If rc <> Rhino.Commands.Result.Success Then
Return rc
End If

I don’t PointsOn because I select them directly on the mesh. Then I got those points in refs.
So I can

For Each Ref In Refs
Next

But do I need to get the “Mesh” itself also?
So I know that the MeshVertexes are from that object?
and how do i refer to objRef.Componentindex? or do you mean ref.GeometryComponentIndex? and how does this one work? Because I can only get ComponentIndexType out of that.

I know it are a lot of questions. Sorry for that.

Found another post where it says:

    For Each ref In refs
        Dim ci As ComponentIndex = ref.GeometryComponentIndex

        If ci.ComponentIndexType = ComponentIndexType.MeshVertex Then

            Dim vi As Integer = ci.Index
            Dim vertex = m.Vertices(vi)

        ElseIf ci.ComponentIndexType = ComponentIndexType.MeshTopologyVertex Then

            Dim ti As Integer = ci.Index
            Dim vertex = m.TopologyVertices(ti)

        End If
    Next

where Dim m As Rhino.Geometry.Mesh = mesh.Mesh
but this is about a mesh and i want to delte grip-points in a mesh

So to have it all in 1 what I have but then I have to select the mesh and then the points:

Dim mesh As Rhino.DocObjects.ObjRef = Nothing
Dim rc As Result = Rhino.Input.RhinoGet.GetOneObject("Select points", False, DocObjects.ObjectType.Mesh, mesh)
If rc <> Rhino.Commands.Result.Success Then
Return rc
End If

Dim refs As Rhino.DocObjects.ObjRef() = Nothing
Dim rc2 As Result = Rhino.Input.RhinoGet.GetMultipleObjects("Select points", False, DocObjects.ObjectType.MeshVertex, refs)
If rc2 <> Rhino.Commands.Result.Success Then
Return rc2
End If

Dim m As Rhino.Geometry.Mesh = mesh.Mesh

For Each ref In refs
Dim ci As ComponentIndex = ref.GeometryComponentIndex

If ci.ComponentIndexType = ComponentIndexType.MeshVertex Then

Dim vi As Integer = ci.Index
Dim vertex = m.Vertices(vi)

ElseIf ci.ComponentIndexType = ComponentIndexType.MeshTopologyVertex Then

   Dim ti As Integer = ci.Index
 Dim vertex = m.TopologyVertices(ti)

End If
Next

But now the deleting part