Look at my original reply.
No, you’ll need plug-in - user data is owned by a plug-in.
– Dale
Look at my original reply.
No, you’ll need plug-in - user data is owned by a plug-in.
– Dale
Is it possible to compile the plugin to dll and call it in python?
Or it must be a plugin to use the userdata?
Could you provide a very minimal example how to override UserData.Transform?
I get that you need to override this one:
protected override void OnTransform(Transform xform){
...
}
But what to fill in this method and how to use it from rhino interface. I have no clue.
When object is moved, rotated, transformed is this transformation updated ?
I am reviewing the mobile plane example again.
When I attach the plane, the Rhino plane where I draw changes to this plane.
However, what I am looking for is a plane that is only attached to an object, allowing me to always get or set it.
Is there an example for this scenario? Or is it possible to modify the mobile plane example to achieve this?
I see that the plane is currently attached to the viewport, but I need it to be attached only to an object.
public static bool Attach(RhinoObject obj, Plane plane, Guid viewportId)
{
bool rc = false;
if (null != obj)
{
SampleCsMobilePlaneUserData data = DataFromObject(obj);
if (null != data)
{
data.Plane = plane;
data.ViewportId = viewportId;
rc = true;
}
else
{
data = new SampleCsMobilePlaneUserData
{
Plane = plane,
ViewportId = viewportId,
Enabled = true
};
rc = obj.Geometry.UserData.Add(data);
}
}
return rc;
}
Okey. If I remove all the viewport linkage, it works per object (look at the printed plane string in the command line). I was very confused by viewport plane reorientation in this example.
It is actually quite a nice thing, as it gets updated when you rotate or move an object.
It is a pity we need to compile rhino plugin for this, as it is not enough just to override dot net class.
@dale is there any possibility to
a) override directly OnTransform in CPython?
b) build MobilePlaneExample project in ScriptEditor instead of Visual Studio, @eirannejad can you help ?
c) can I retrieve OnTransform from python when I get object guid?
I need somehow to use python in workflow…
Just throwing out there that if you don’t plan to do major edits on the objects other than moving them around, then you can put them in a block and use rs.BlockInstanceXform()
to get the transformation.
True, I can go BlockInstance way, but I see I need custom objects for the Conduits.
I am wondering if it is possible to write Python code in the scripteditor and build it as plugin.
Instead of single commands. The build engine of script editor wraps python code to C# command plugin, so there must be some way.
How to do this thing practically I do not know.