Custom SetPT

Hi,

I’m trying to create a SetPt function.

This is what I’m doing:

For Each Vertice As Rhino.Geometry.BrepVertex In ObjRef.Brep.Vertices

Dim Z As Double = Vertice.Location.Z
Dim MoveVertices As Geometry.Transform = Rhino.Geometry.Transform.Translation(New Rhino.Geometry.Vector3d(New Rhino.Geometry.Point3d(0, 0, 0 - Z)))
Vertice.Transform(MoveVertices)

Next

But its not working.
Do I need to CommitChanges somewhere or add a new object like duplicate?

Edit:

This also doesnt work :(:

For Each Vertice As Rhino.Geometry.BrepVertex In Brep.Vertices
                Vertice.Location = New Geometry.Point3d(Vertice.Location.X, Vertice.Location.Y, 0)
Next
Brep.SetVertices()
doc.Objects.AddBrep(Brep)

What are you trying to accomplish? Moving only the vertices of a BREP will accomplish nothing, except probably making the BREP invalid, because the BREP datastructure is more complex.

See http://wiki.mcneel.com/developer/brepstructure

I was trying to make a custom SetPt. So I want to get the “control points” of a brep then set them too Z = 0

the same as this does:

“_pointson _selpt -_setpt X=No Y=No 0,0,0 _pointsoff”

Try this:

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsSetPt.cs

Thanks.

Where is SelectObjects hidden? and TransformObjects
I’ve imported the same libraries but I can’t get that one to work.

also gx doesnt know   gx.AddTransformObjects(list);

code:

Public Class GetSetPtTransform
        Public Sub GetSetPtTransform(ByVal bSetX As Boolean, ByVal bSetY As Boolean, ByVal bSetZ As Boolean)
            SetX = bSetX
            SetY = bSetY
            SetZ = bSetZ
        End Sub

Public SetX As Boolean
        Public SetY As Boolean
        Public SetZ As Boolean

Public Overridable Function CalculateTransform(ByVal Viewport As Rhino.Display.RhinoViewport, ByVal Point As Geometry.Point3d)
            Dim xForm As Rhino.Geometry.Transform = New Rhino.Geometry.Transform(0)
            If SetX Then
                xForm(0, 3) = Point.X
            Else
                xForm(0, 0) = 1.0
            End If

If SetY Then
                xForm(1, 3) = Point.Y
            Else
                xForm(1, 1) = 1.0
            End If

If SetZ Then
                xForm(2, 3) = Point.Z
            Else
                xForm(2, 2) = 1.0
            End If

xForm(3, 3) = 1

Return xForm
        End Function
    End Class

And in my function

Dim gx As New GetSetPtTransform
            gx.GetSetPtTransform(False, False, True)
   Dim list As TransformObjectList = New TransformObjectList()
            rc = SelectObjects(“Select objects to transform”, list)

Notice what class the command inherits from?

You mean :smile:

internal class GetSetPtTransform : GetTransform ?

How do I translate this to vb.net?

No, this:

public class SampleCsSetPt : TransformCommand

How to refer too that in Vb.Net?

Instead of this:

Public Class JordyCommand
    Inherits Command

Do this:

Public Class JordyCommand
    Inherits TransformCommand

Learned something new again thanks. I’m getting there xD

This link is broken

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsSetPoint.cs

1 Like