Grasshopper

algorithmic modeling for Rhino

Hi to all.

I've being reading several threads about display conduit and GH pipeline, but I can't resolve my problem.

What I need is update the camera plane every time the user orbits or change the view-port. to do that, I'm doing this:

Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
Vector3d vecX = doc.Views.ActiveView.ActiveViewport.CameraX;
Vector3d vecY = doc.Views.ActiveView.ActiveViewport.CameraY;

Then I Call the DA fuction..

DA.SetData(0, new Plane(ptOrigin, vecX, vecY));

To update the view I create a new class:

public class myConduit : Rhino.Display.DisplayConduit
{
protected override void PostDrawObjects(Rhino.Display.DrawEventArgs e)
{
base.PostDrawObjects(e);

}
}

And from the solveInstance Method I make the conduit True. Like this.

Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
Vector3d vecX = doc.Views.ActiveView.ActiveViewport.CameraX;
Vector3d vecY = doc.Views.ActiveView.ActiveViewport.CameraY;

var conduit = new myConduit();
conduit.Enabled = true;
doc.Views.Redraw();

DA.SetData(0, new Plane(ptOrigin, vecX, vecY));

So What Im doing wrong?

What I need to change or add to update that plane dinamically?

thanks in advance,

C.

Views: 759

Replies to This Discussion

There's a lot of problem with this approach. First of all views can change rapidly in Rhino (which is a good thing! we want the viewports to have high a framerate). If you start doing a lot of computation based on camera changes, that may slow down the refresh rate, making everybody angry.

Secondly you do not want to refresh views as a result of views refreshing. That sort of thing leads to all kinds of bad results.

I'm actually not sure what it is exactly you want. Do you want to draw things in Rhino viewports using a conduit or do you want to output data from a component based on viewport changes?

If it's the latter, you can pretty much forget about it being realtime, because Grasshopper solutions are much slower than viewport refresh rates plus solutions trigger viewport updates. Both of these are huge problems.

Hi David, thanks for replay.

What I need is get the plane of the camera every time the user orbits or change the view port. is quite similar the point list node does.

Is that make sense?

kind regards

thanks. in advance

C

But what do you need it for? Are you just drawing stuff in the viewport that needs this camera plane or are you actually outputting it from a component and using it geometrically?

Thanks Again,

Yes to draw stuff.

I need the plane to display data, similar as the point list node.

nothing more.

I dont know What Im doing wrong, I resolved the problem with a Boolean to refresh the node every time the user orbit or change the view. But I need to do it automatically this is why started with conduit.

regards

C.

Ok, then you definitely do not want to trigger Grasshopper solution updates. You just need to either override the DrawViewportWires or DrawViewportMeshes method and get the camera plane of whatever viewport is currently drawing, or you can implement your own display conduit (not really recommended, Grasshopper provides access to a conduit which is set up correctly).

If you're drawing curves or points or text, I recommend overriding DrawViewportWires on your component class.

Hi,

Did you manage to solve this issue as suggested by David? I am trying a similar approach with no results...

naa,

Just put a bolean in the node to refresh.

if you figure it out,  share please

best

C.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service