Dear Rhino5 Developer Ninjas
I am trying to do a dynamic transformation of objects such as curves, and am indeed successful utilizing the custom overriden methods shown here.
http://wiki.mcneel.com/developer/rhinocommonsamples/rhinogettransform
I was originally trying to do this behavior in a custom overriden GetPoint class which had this method.
protected override void OnDynamicDraw(GetPointDrawEventArgs e)
{
//dynamically move elements
base.OnDynamicDraw(e);
Point3d currentPoint = e.CurrentPoint; //Create the current point object (where the mouse is)
Vector3d pointsVector = new Vector3d(currentPoint.X - hereOriginPoint.X, currentPoint.Y - hereOriginPoint.Y, currentPoint.Z - hereOriginPoint.Z);
RhinoApp.WriteLine("PointsVector is {0}", pointsVector);
Transform xform = Transform.Translation(pointsVector);
if (hereObjRef.Object().ObjectType == ObjectType.Curve)
{
ObjRef tempRef = hereObjRef;
hereDoc.Objects.Transform(tempRef.ObjectId, xform, true);
Curve tempCurve = tempRef.Curve();
e.Display.DrawCurve(tempCurve, System.Drawing.Color.Black);
e.Display.DrawPoint(tempCurve.PointAtStart, System.Drawing.Color.Black);
e.Display.DrawPoint(currentPoint, System.Drawing.Color.Black);
}
}
I am able to see that the vector created calculates correctly, and also that the matrix inside the Transformation class is indeed changing, however the temporary Curve I have transformed to draw does not move dynamically as I thought it would. It does move with the overriden Transform Class that is in the example, however there are some additional things I am trying to do concurrently while dynamically transforming the objects, namely run some math and display some other things. I am a bit lost on the easiest way to implement this.
If possible I’d like to continue to utilize the custom GetPoint class that is basically overriden, and am not really sure why it is not displaying the curve dynamically with the current point of the OnDynamicDraw method. Thanks!!!