Rhino Object - Orientation Transformation

Is there a way to store transformation matrix on any rhino geometry object point, polyline, mesh. So that when an object is manipulated in rhino e.g. moved, rotated, not deformed, the transformation matrix would be updated?

Softwares like Unity, Solidworks and others has such option:

If it exists, can someone explain how to do this with RhinoObject class?

Hi @Petras_Vestartas,

Attach custom user data to the Rhino object’s geometry member. The custom user data should override the user data’s OnTransform virtual method.

Sample:

– Dale

2 Likes

Does it mean that I must create a custom class object to attach transformations and also make it serializable?

By any chance would you have time for writing a python example too?

I think I am a bit lost in this example … I need some help.
First of all how would this example work in non-compiled code like python?

Hi @Petras_Vestartas,

You can only add custom user data from a real plug-in.

What are you confused about?

Have you run the example?

– Dale

@dale

I tried it works, but it is not exactly what I was looking for.

Expected workflow:

  1. I create 100 meshes
  2. I add meshes to rhino
  3. I transform these meshes e.g. Rotate, Translate, Orient.
  4. Then I click on all these meshes and get their frame after transformation.

Is there any simpler workflow to keep track of an object orientation?

Hi @Petras_Vestartas,

I guess you can try using this:

https://developer.rhino3d.com/api/rhinocommon/rhino.docobjects.rhinoobject/objectframe

Can’t say as I know much about it.

– Dale

@dale

Thank you but the ObjectFrame is not consistent:

@dale

How do blocks in rhino keeps consistent orientation of any sub-blocks?

What does this mean?

When blocks are transformed, so are their sub-blocks.

– Dale

The orientation of ObjectFrame sometimes flips or changes its orientation without relation to object.

I really wish that RhinoObject would have a default transformation matrix or plane that is updated upon object manipulation.

Currently I used mesh face coordinates as a plane, which is really not error prone method…

@Petras_Vestartas - so something like this isn’t helpful?

TestPetras.py (1.2 KB)

– Dale

2 Likes

@dale You are awesome!

Looks like it works, I will try with other geometries other than spheres and let you know.

@dale

Is it possible to keep object frame when an object is copied?

In the video below you can see that after an object is copied the Plane become unset:

1 Like

Hi @dale, i’ve been following this with interest as it would be really useful for my work too and i have no way to build custom objects via a PlugIn.

I too would like to store a plane to an object upon creation and that plane should follow all object transforms. The new ObjectFrame in Rhino 8 does this, which is great.

But if the purpose is to use the plane so an object can be reset to it’s original position (on creation, as in your example script) after it has been transformed by the user, then the ObjectFrame will not give the expected results once the gumball was individually relocated.

This is because the gumball relocation (without transforming the object) seems to alter the ObjectFrame.

So please count my wish for a CustomObjectFrame which can be attached to the attributes in the same way as ObjectFrame. It should follow object transforms too but it should not be changed when the gumball is individually relocated. Of course if a user transforms (eg. moves) the object using the gumball, the CustomObjectFrame should reflect these changes.

Would this be possible ?

thanks,
c.

3 Likes

I also would have a lot of use for this across the board (what @clement outlines) and would like to upvote this as well please +1 @dale

3 Likes

:eyes: looks like this thread is important to many other people :slight_smile: On mcneel search bar there is very little you can find about this topic… @dale we want this new feature :slight_smile:

2 Likes

I don’t understand how the CustomObjectFrame will help. If we provide it any plugin (not just yours) may use and modify it.

If you really need a frame only you control then you should save a plane/xform/whatever in UserData like I outlined here:

Not currently. I opened RH-85938 to fix it. When a new object is added it usually copies its attributes from some other object. In case of commands like Join/Explode you can get some funky results copying frames from the input. I think we need to tune that up for when something is copied.

1 Like

Hi @Joshua_Kennedy,

UserData.Transform is for PlugIns only so it won’t be usable with Python scripting.

I would not mind. If i can store the CustomObjectFrame eg. with a key value which is required to retrieve it. Users will never be able to access it. If other devs would have access to it i wouln’t mind as well, they could use their own key.

thanks,
c.

1 Like

Is is possible to show an exanple for UserData.Transform?

If there is a possibility in python.