Grasshopper

algorithmic modeling for Rhino

Would it be possible to assign a list of points to an output parameter without having the preview? I know I could make a string, but I would rather have the list. I am programming in C#.

Also I would like to preview a list spheres without assigning it to an output parameter.

Gr,

Peter

Views: 703

Replies to This Discussion

Hi Peter,

in a compiled component or in a VB/C# script component?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

I am working on compiled components.

Gr,

Peter

In that case you can set the preview of input/output parameters while registering them.For example, inside RegisterInputParameters:

Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_Component.GH_InputParamManager)
  pManager.Register_CurveParam("Curve", "C", "Curve something or other")
  pManager.HideParameter(0)

End Sub

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thx. I got it.

And what if I want a preview but no visible output parameter?

Gr,

Peter

If you want to draw preview geometry that is not stored inside an input or output parameter, then you need to override the preview methods in the component itself.

IsPreviewCapable should be overridden and always return True.

ClippingBox needs to be overridden and it should return the base class Box unioned with the boundingbox of your own geometry.

DrawViewportMeshes and/or DrawViewportWires need to be overridden and you can draw your custom stuff here. Be sure to call the base class methods otherwise you'll short-circuit the parameter preview.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

This will take a bit more then my current programming skills. But I will try anyway. Do you happen to have an example for this?

Gr,

Peter

Finded (one of) the problem with my custom sprite component!!! Thanks!

ClippingBox needs to be overridden and it should return the base class Box unioned with the boundingbox of your own geometry.

Hi David,

THX! I got it working for lines and text. How could I make it work for text dots? I would like to identify nodes in a list.

Gr,

Peter

Hi David,

Is this what you mean here? I am I trying to preview a list of curves stored in 'strips'. The curves do show in black when I have a output parameter for it and curves assigned to it. Otherwise the curves do not show. Maybe it's my clippingbox? I'm not sure how to union.

public override bool IsPreviewCapable
{
    get
    {

        return true;
    }
}

public override BoundingBox ClippingBox
{
    get
        {
            return base.ClippingBox;
        }
}

public override void DrawViewportWires(IGH_PreviewArgs args)
{
    base.DrawViewportWires(args);

    for (int i = 0; i < strips.Count; i++)
    {
        args.Display.DrawCurve(strips[i], Color.Black);
    }
}

I think I found it. I returned the bounding box of my curve in stead of base.Clippingbox. Now it works.

Hi David, would it be possible also in a VB/C# script component? ;-)

Cheers

FF

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service