RhinoCommon Custom Objects

Are there any SDK samples demonstrating the use of the RhinoCommon custom doc objects? In particular showing the use of custom grips for custom brep objects, although any would be helpful.

Thanks,

Larry

I’m not sure this is even possible yet. Let me try to type up a sample and see far I get.

– Dale

Hi Dale, just wanted to check in to see if any progress has been made on custom objects in RhinoCommon.

Is it correct that if I wanted to do this with the C++ SDK, the functionality needed to create my own Brep for example is already there.

Thanks, Larry

@steve and I are looking into this. So far, nothing new has been added to make this easier (or possible).

Hi guys,

@dale, I see that CustomBrepObject is in RhinoCommon. Do you have an RC example to share?

Thanks,
Dmitriy

Hi Dmitriy,

No, I don’t have any samples to share. Why do you need a custom object? What problem are you trying to solve?

– Dale

What follows is a minimal example of a custom mesh object - maybe it is useful.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
    ObjRef mRef;
    Result res = RhinoGet.GetOneObject("Select mesh", false, ObjectType.Mesh, out mRef);
    if (res != Result.Success)
        return res;

    Mesh m = mRef.Mesh();
    MyMeshObject my = new MyMeshObject(m);

    doc.Objects.Replace(mRef, my);
    doc.Views.Redraw();
}

public class MyMeshObject : CustomMeshObject
{
    private BoundingBox _bb;
    public MyMeshObject(Mesh m)
        : base(m)
    {
        if (null != m)
            _bb = m.GetBoundingBox(true);
    }

    public MyMeshObject()
    {
        // required
    }

    protected override void OnDuplicate(RhinoObject source)
    {
        MyMeshObject other = source as MyMeshObject;
        if (null != other)
        {
            _bb = other._bb;
        }
        base.OnDuplicate(source);
    }

    protected override void OnDraw(DrawEventArgs e)
    {
        if (_bb.IsValid)
            e.Display.DrawBox(_bb, Color.Red, 2);
        base.OnDraw(e);
    }

Hi @dale,

To start with - I need to draw a polyline passing through the row or column of the control points.
Another example would be to show and manipulate on the small group of control points only.
So, I should be able to manipulate control points in both cases, not only draw it.

Thanks,
Dmitriy

Hi again,

@dale , from Menno I realized, that for the purpose I am looking for - CustomGrip(s) class should be used here as well.
I have seen that this in now available in RC.
So, a short example of combination of CutomObject and CustomGrip would be highly appreciated,

Thanks in advance,
Dmitriy

Custom Grip in RC is available but not working. Believe me, I have tried :smile:

Thanks Menno,

If this is the case - I hope it is in the soonest list TO DO.
@dale, @stevebaer - Is it smth. we can expect in the next SR?

Thanks,
Dmitriy

Another short question: if Custom Grip is not yet available - maybe there is another way to draw and manipulate a vertex, which is not a Rhino object though?
Then I can connect it to the other routines.

Thanks,
Dmitriy

This is not something that will be added for the next SR. If you really need custom grips and the RhinoCommon implementation is not working, then I would recommend using either Rhino_DotNet or the C++ SDK for this.

Thanks, Steve.

Is it any example how access to the C++ SDK methods and functions is done from RC?

KR,
Dmitriy

@dale may have written an example for calling C++ code from RhinoCommon

Thanks.
Much appreciated.

Dear Everybody - any news on this topic within the last 6 month ?

Is the RhinoCommon implementation really not working ? or is it just a question of how to do it?
(see stevebaer 27 Jan 2015)

Did somebody manage to implement one or more of the following using RhinoCommon c# ?

There is another similar / related Topic
grip-editing-of-custommeshobject-turns-it-into-a-normal-mesh

The above Topic links to the following c++ sample
https://github.com/mcneel/Rhino5Samples_CPP/tree/master/SampleCustomGrips
Anybody any success to transfer it to c# ?
Maybe a starting point ?

It seams that all neccessary stuff is implemented in rhinocommon
github.com/mcneel/rhinocommon/blob/master/dotnet/rhino/rhinosdkgrips.cs
(line 468 onwards)

@menno let s hope we get it worked with rhinocommon, i dont want to start with c++
@stevebaer you might answer this topic, instead of my mail. THANKS.

We haven’t done any work in this area recently.

I just wanted to point out that there is now a working example on GitHub. All the pieces seem to be there:

https://github.com/dalefugier/SampleCsRectangleGrips