Grasshopper

algorithmic modeling for Rhino

Hallo,

I am trying to build a GH component witch should provide some graph analysis functionality on curve geometry and want to colorize the input geometry according to analysis results directly in my component and not force the user to use the build in custom preview component.

I only find a previewUtil class witch show its results only when I turn off preview on the GH component and hide the rhino geometry.

 

Is there some another way?

Please be patient, its my first compononet a I am little bit confused right now.

 

Thanks a lot

 

Martin

Views: 1853

Replies to This Discussion

Hi Martin,

 

so you want to draw custom geometry from within your component instead of the default geometry drawn by input/output parameters?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

 

 

Hi David,

Yes, that's what i want. I would like have the same functionality as the Custom Preview component has. Is there some way how to achieve it? or can build component witch is using another componets funcionality? I am new in C# (Java before) but i see that RegisterInputParams is protected so i cannot acces it from my class. Or is there some another way how to it?

 

Probably too many questions but I am trying to get a bigger picture how does it work.

Here's what you need to do. On your class that derives from GH_Component, override the methods called ClippingBox, DrawViewportWires and DrawViewportMeshes.

 

The ClippingBox property needs to return a BoundingBox that contains all the geometry you're about to draw. You can draw points, curves and meshes etc. in the DrawViewportXXXX methods.

 

If you want to maintain default component preview behaviour then be sure to place calls to the base class methods as well.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks a lot, its working now! 

Hi David,

I can't see preview icon in component menu when only my GH_Param(T) is registrated  in input method.  Maybe problem is in my T object. Is It possible to set T object as preview-able object and activate this preview icon or do I have to inherit it from other base geometry T objects?

Thanks

Lukas

Hi Lukas,

just try to override the IsPreviewCapable method and set it to true.

 

Martin

Hi David, 

I'm trying to do something similar here, but i'm afraid i'm a bit more unexperienced than the original poster.

I want to preview some Geometry(points/curves) created from inside the component, without having to output them. 

Is it possible to send some "example" code where this is done? 

I don't understand what i have to do after overriding the methods, or how to call them with GH Geometry types such as GH_point type.


Thank you,

Bruno

What programming language? And what sort of things do you want to draw?

Thanks for the quick reply!

I'm building some components in c# .
Right now i'm creating gh_points out of my data to send to the viewport, through an output. These points won't be inputs further on, so they would be just polluting the component...

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