algorithmic modeling for Rhino
Tags:
As a quick aside... there's buttons in the top-right of the code editor that insert the Preview methods for you. You don't have to type them yourself, and if you do type them yourself, you have to get it exactly right...
See attached.
David,
Thank you (again). May I ask what is the difference between IGH Preview and Display Pipeline?
I am starting to think that maybe the methods vary outside of the c# component. Much of my code is in Visual Studio and it seems that methods such as 'public override void BeforeRunScript seem to differ...
Should I supply you with a different file from VS to demonstrate Display Pipeline?
DisplayPipeline is a RhinoCommon class that allows you to draw custom geometry into Rhino viewports. IGH_Preview doesn't exist. There are some interfaces that start with those letters, most notably IGH_PreviewData, IGH_PreviewObject and IGH_PreviewArgs.
Anything that starts with GH_ or IGH_ is defined by Grasshopper. In this case all these interfaces are provided to ease the process of drawing geometry in Rhino. So instead of implementing the entire display pipeline logic from scratch, just implement/override the methods that are already available in GH and you get a lot for free.
It is true that there are differences between writing a C# script component and deriving from GH_Component. BeforeRunScript() doesn't exist inside components, you have to use BeforeSolveInstance() instead.
All components already implement IGH_PreviewObject, so you'll have to override the appropriate methods to make it work for components.
David,
After some nosing around I've found this VB example for the use of Display pipeline. I believe I need to implement display pipeline because the preview method doesn't seem to make geometry visible in my particular case (all geometry is determined within the custom component and preview doesn't seem to be able to implement the resulting geometry - tho pipeline does).
Could you provide a C# equivalent example of this code. I've got most of it working but I'm not as confident with the code as I should be.
The example is given in "dotted lines" as taken from this post
I am attaching your original VB file.
Let's start a new discussion about this. Please upload a class representing custom geometry and a component which instantiates this type from inputs and I'll add some preview logic to it.
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