Grasshopper

algorithmic modeling for Rhino

Hi,

 

I'm trying to write a C# GH Component that will access it's input parameter and disable it's grasshopper preview.

Is there a way to access a GH parameter in the current GH document and disable its preview using the SDK?

Thanks,

H.

Views: 2008

Replies to This Discussion

When a certain geometry parameter is created in a grasshopper document, it is being displayed in the viewports in red color AKA preview.

In grasshopper document you can right click the geometry parameter and turn off the preview in the view ports.

My component is drawing to the display pipeline by itself and i want to be able to disable that input geometry parameter's preview - so grasshopper won't preview it.

Hen, If I understand you right you want to turn the preview off for the connected component? and not only an input parameter? Something like this should do it for you:

In this example as soon as you connect a component to x input the preview of the component will be off. You can use a very similar approach and set the input/output parameters to Hidden too.

Mostapha,

I've tried running your code - the problem i came across is that the InstanceGuid from my input parameter was not found in the component list, because it's a IGH_Param and not IGH_Component - for components the following code works.

I'm looking for a way to turn off the preview of ANY GeomteryBase input parameter such as Brep, Surface, Mesh, Etc.

You have to cast whatever parameter you wish to hide to an IGH_PreviewObject interface. If the cast succeeds then you call object.Hidden=True. If the cast doesn't succeed then the parameter doesn't support previewing at all.

All objects on the canvas have InstanceGuids, even input and output parameters to components. However you can also reach these parameters through the GH_Component.Params property, which gives you access to the input+output parameter manager.

--

David Rutten

david@mcneel.com

YES!

thanks david :)

works perfect

m_geo_param = this.Params.Input[0].Sources[0];

IGH_PreviewObject m_geo_prev = m_geo_param as IGH_PreviewObject;

if (m_geo_prev != null)
{
m_geo_prev.Hidden = true;
}

thanks again for your help, mostapha & david :)

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