Creating a point class derived from GeometryBase?

Could anyone give me an example how to derive a point class from GeometryBase.

Reason: educational purposes

I wish to make a custom point class that overrides the Transform and Translate methods such that they don’t do anything.

I know I can achieve the same thing using events, but I don’t want to store guids nor check each selected or to_be_transformed object about its guid.

I want to create a polysurface/block that is not exploded when the command explode is used on them.

Custom overriding of GeometryBase classes doesn’t really work in RhinoCommon. You’ll just end up frustrated as things won’t work as expected.

Thanks for the reply @stevebaer,

What is the proper way then? I do not want to derive objects from Rhino.Geometry.SomeObject because it creates objects that are affected by drag/move/explode etc.

I can only think of creating conduits but then I cannot select these objects.

Also there is no event for hovering over objects.

Third option could be using workspaces but I do not want to use multiple files. Also, there are no methods currently to automate that with scripts.

@stevebaer,

Is it possible to override the Group class somehow, like another workaround to the behavior I wish to achieve?

e.g. instead of creating custom brep_type to create custom group_type. Groups don’t get exploded, right?

I’ll have to be extra careful maintaining water-tightness of the custom_objects.

If I create a class derived both from brep and group. Can I prevent explode? :thinking:

Update:

Pffff. :roll_eyes: Groups can’t but the objects inside can.

Update (2):
This comment by @DavidRutten,

Made me think of another probable solution, which seem a bit more complex and but anyways I’ll ask.

Is it possible to create an extension of Rhino3dmIO (Rhino3dm) so that I can create custom objects there using not RhinoCommon but a custom API that derives from RhinoCommon?

Or I don’t know what I’m talking about :smiley:

Custom behavior in general is pretty limited in RhinoCommon. Please help me understand what you are trying to achieve and I can then figure out a solution or at least tell you in is not currently possible.

1 Like

For starters I want a point that ignores translations. Like a permanent origin point. That I can copy and select as reference to some other object but not move it.

Subsequently I want the same behavior with lines, curves, polysurfaces that will not allow to be exploded.

I’m not coming up with anything useful that would help here.

Hi @stevebaer,

I am open to any option.

  • Changing the language (e.g. Cpp)
  • Implementing it with conduits, but I need to understand how can I implement selection of the objects.
  • Of course perhaps the best current option is just to use GH to create immutable objects. Here the selection in 3D is still an issue. I know @DanielPiker has a grab tool but I don’t know what/how he did it. Also, I don’t use kangaroo but, I think it only selects vertices, and only if the solver is running.

It definitely seems quite a lot of work if there is a need of hovering (enter/leave) and selecting events implementation on conduits (by a beginner coder like me).

I need some guidance on where to start.
I wanted to start with a point but apparently even that is not working as I thought it would.

In my opinion you can implement your desired behaviour by deriving from CustomPoint. It’s going to be a lot of effort and quite a hack so maybe rethinking what you are trying to achieve would be wise.

Overriding the OnTransform method of your custom point you can revert any and all translations and Explode should not work on points anyways.

That doesn’t work. At least when I tried to override the method didn’t work because the point created on the canvas is normal RhinoCommon point and it is affected by translations.

Perhaps I must not derive my custom point from Rhino.Geometry but Rhino.DocObjects. :thinking:

Just to make sure we are talking about the same thing:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_RhinoObject_OnTransform.htm

Why does this not work? How did you overwrite this method? What was the behaviour you were seeing?

1 Like

Thanks for pointing that one @lando.schumpich,

What I was trying to do is create a new type deriving from Rhino.Geometry.* I was trying to override the Rhino.Geometry.Point.Transform Which is a method of GeometryBase.
Problem was I didn’t want to store and check for GUIDs every time I try to move something.

I will try now to create a custom class derived from one of the Rhino.DocObjects.* classes and see if I can “negate” the effect of transformations and “explosions”.