I would like to display meshes with ngons with black edges as ngon outlines.
I have already done this in the following simple code as component (Code of component and screenshot below).
My question: I have a bunch of components that are working with ngons in meshes.
Is there any way to apply this procedure to all of them, without copying this type of code in all the components? I.E. inhereit from some main class, a preview of ngons meshes? If yes how to do this?
Once I did this my creating custom parameter for another grasshopper add-on. But this requires a bit of work to do. I am wondering if there is other way than creating a custom parameter just to solve this tiny display preference of mine.
Create a class that inherits IGH_PreviewObject and implements your visualization, and inherit this class in the components.
When I am going to create many components in the same project, I create a class that inherits GH_Component simply for the constructor to take 3 parameters (name, nickname and description) and thus inherit the category and subcategory in all my components. You could also do this with the display, as GH_Component inherits IGH_PreviewObject.
Would it be possible to get example to understand how this main class that will be inherited looks like?
Since I can already override prieview methods and clipping box.
I will probably need some additional method in that main class that passes meshes used in the solve instance to global parameters (meshes, lines) which will be input for preview override.