GH Python Compiled Component Custom Preview Display


I’ve been compiling GHpython components as instructed in the following post by @piac:

with particular interest in accessing the DrawViewport functionalities for custom display, similar to the C# component.

When I run the script in procedural mode it works like a charm, but when I compile it the resulting component has its preview disabled (grayed out) and there is no way to switch the preview on. I attach a screenshot and the file with the script.

Any Idea why this might be happening? Any help would be much appreciated. (2.5 KB)

Hi, @dadandroid

There are two issues:

  1. You need to override IsPreviewCapable, otherwise, the default is that output-less parameters are considered without preview.
  2. You must implement a correct bounding box computation. Here I show an example.



Giulio Piacentino
for Robert McNeel & Associates (2.7 KB)


Did the trick! Cheers Giulio!

8 posts were split to a new topic: Code to create an arrow preview in GhPython