GH Python Compiled Component Custom Preview Display

ghpy

(DavidAndresLeon) #1

Hi

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.

customDisplay.gh (2.5 KB)


(Giulio Piacentino) #2

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.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

customDisplay-fix.gh (2.7 KB)


(DavidAndresLeon) #4

Did the trick! Cheers Giulio!