algorithmic modeling for Rhino
So I have something along the lines below. I am just messing with text previews for now, just to make it work :) but thats not going so well. Below is my process, any help would be appreciated. Thanks
My understanding is that I have to overide the following:
public override void DrawViewportWires(IGH_PreviewArgs args)
{
base.DrawViewportWires(args);
Color c = Color.Transparent;
args.Display.Draw2dText(temp, c, new Rhino.Geometry.Point2d(5, 5), true,20);
}
public override Rhino.Geometry.BoundingBox ClippingBox
{
get
{
return this.m_clip_box;
}
}
public override bool IsPreviewCapable
{
get
{
return true;
}
}
The BoundingBox is Unioned like this:
pt = new Rhino.Geometry.Point3d(5, 5, 5);
this.m_clip_box.Union(pt);
Tags:
Draw2DText does not require clipping, so you don't in fact have to override the ClippingBox property. Only 3D shapes are depth-tested and clipped.
Why are you drawing something in a transparent colour though? If it doesn't work, you won't see anything. If it works, you won't see anything. Makes it difficult to tell whether it's working or not...
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Are you sure it's not just behind the viewport name? 5 pixels off the upper-left corner isn't all that much. Try new Rhino.Geometry.Point2d(100, 100)
--
David Rutten
david@mcneel.com
Poprad, Slovakia
LOL, let me try quick
You were totally correct, it was behind the viewport name. Now I just feel stupid........You are a legend!!!!!!!!!!!! thanks so so so very much David, it was driving me crazy :)
And you may find this example useful: http://wiki.mcneel.com/developer/rhinocommonsamples/drawoverlay
Mostapha
Is there any house keeping when using the Display Pipline to prevent "An error occured in the display pipeline". I just want to make sure I'm doing this right.
I've received this error before when using Kangaroo once or some other plugin, nasty thing, Rhino crashed hard:(
That message is drawn by Grasshopper when it detects an exception during its own drawing routines. The fact that it was handled means the exception didn't cause a crash immediately, it may however have had a delayed effect.
When that message is drawn it is almost always due to a bug in the drawing code. Could be anything from divide-by-zero to null-reference to index-out-of-range, or even a problem with memory management.
Due to the Grasshopper exception handlers it is not possible to use Visual Studio to easily find the crash, but if the crash occurs somewhere in your own code you should be able to narrow it down quite quickly by logging the execution of your code. Easiest is to print information to the Rhino command-line at key points.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
As always , very informative, thankyou David :)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by