Hello, I fail to remember how to display a simple vector with python in grasshopper ?
So what’s wrong with this code ?
nothing appear in my viewport where it’s supposed to be
import ghpythonlib.components as gh
import Rhino.Geometry as r
I thx for your answer, I use rh6 and I’m not used with the ghlib, i will wait and see a probable answer from @piac, beyond that the ghpythonlib is designed to be be user friendly and there what is happening is not intuitive at all (for me) so may be we are going to see more trough this in few hours.
ghpythonlib is a library that allows to use Grasshopper geometry functionality as a simple functions.
This is intuitively also its limitation: only components that act as pure functions work. If they work for other side effects or purposes (like looping, in Galapagos, or like the Timer, for expiring, or Vector/Text display, for displaying things without returning anything) there will be no useful way to use them.
When available they will actually run, but they run in their own Cluster and nothing will appear.
I personally would suggest to use this functionality to simplify big definitions, or create reusable functions. I would just use normal components for vector display or text tag.
One option I’ve been using since forever in GHPython is the CustomDisplay class. It’s pretty basic and comes with its own issues, but is generally quite functional for a lot of things. I’ve written some helper functions I can share to work around some of the issues, if need be.
Yes, but it’s really an implementation detail, and therefore it’s subject to change. Right now, slightly simplifying, a normal component is placed in a special solution that is not presented in the UI, it’s assigned values and the solution is solved. Then the results are harvested and given as function results. In addition there are some considerations for threading, for Grasshopper DataTrees and for performance in the mix.