Hello,
I have a custom UserData class which is attatched to a block. Inside the UserData, there is a polyline (“BaseLine” in my code) which provides custom grips on all of its points, on which I then can modify the block.
However, when copying the block (using copy and gumball), the UserData of my initial block instance gets transformed aswell, which in turn transforms my custom grips.
I was wondering if maybe OnTransform gets called first and the OnDuplicate doing its thing affects the outcome.
The fact that I’m attaching the UserData to a block should not matter. It can be basicly any RhinoObject.
Take a look at the screenshots:
First picture explains the order of creation:
Here you can see how the custom grips should work and are working on the latest copy
Here you can see the first copy having the transformed custom grips
Here you can see the initial block having the transformed custom grips of the last copying
Here is my OnTransform method:
protected override void OnTransform(Transform xform)
{
if (this.BaseLine != null)
this.BaseLine.Transform(xform);
}
And here is my OnDuplicate method:
protected override void OnDuplicate(UserData source)
{
MyUserData dataSource = source as MyUserData;
this.Type = dataSource.Type;
this.BaseLine = dataSource.BaseLine;
this.Thickness = dataSource.Thickness;
this.IsClosed = dataSource.IsClosed;
this.DatabaseID = dataSource.DatabaseID;
}