Grasshopper

algorithmic modeling for Rhino

Custom type after ctrl + c and ctrl + v is casted back to base class.

Hi,

I have question below and attached code of the component.

Why this happens?

Views: 439

Attachments:

Replies to This Discussion

This solved the issue:

DA.SetData(0, new TileGoo( new Tile(obj, plAll.ToArray() ) ) );

instead of :

DA.SetData(0,  new Tile(obj, plAll.ToArray() )  );

But now other thing happened. I implemented  IGH_PreviewData in TileGoo.

The first time I drag and drop the component I do not see anything.

But when I copy paste it I can see it. Why?

The first time I drag and drop the component I do not see anything.

Is there data there already as soon as you drag+drop? I'd have thought you'd also have to add some wires.

I drag and drop and add a mesh. And I see nothing.

After copy paste I see.

Probably I need to implement preview also in TileParameter?

I solved this with using second line istead of first:

//pManager.AddParameter(new Aggregations_Core.Types.TileParameter());
  pManager.AddGenericParameter("T", "T", "T",GH_ParamAccess.item);

Any idea why generic works versus addparameter?

One more question regarding preview, I wrote those lines and mesh preview works perfectly. What would be a technique to show mesh wires? When I press button show mesh wires in grasshopper toolbar they do not apper.

I know that I can display mesh wires in GooTile, but they are shown permanently and I cannot switch the off in toolbar.

        public BoundingBox ClippingBox
        {
            get
            {
                return this.Boundingbox;
            }
        }

        public void DrawViewportMeshes(GH_PreviewMeshArgs args)
        {
            if(Value.Geometry != null)
                args.Pipeline.DrawMeshShaded(Value.Geometry, args.Material);
           
        }

        public void DrawViewportWires(GH_PreviewWireArgs args)
        {

        }

Solved both things. It is a bit tricky to but I got it.

Especially about this:

        public void DrawViewportWires(GH_PreviewWireArgs args)
        {
            bool previewMeshEdges = CentralSettings.PreviewMeshEdges;
            if (Value.Geometry != null && previewMeshEdges)
                     args.Pipeline.DrawMeshWires(Value.Geometry, args.Color);

        }

Probably I need to implement preview also in TileParameter?

Yup. 

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