Grasshopper

algorithmic modeling for Rhino

Hi!

I'm working in a new GrassHopper plugin using C++/Cli language

I create a new GH_Goo type and I need to preview it.

The code compiles and link perfectly, but when GrassHopper is loading from Rhino I have this message

"The method 'DrawViewportWires' in type '....GhVaWall'  doesn't have an implementation"

¿Any idea?. If I don't implement the IGH_PreviewData interface it works fine.

If I implement the IGH_PreviewObject interface in any GH_Component subtype I have not any problems.

Thank's!!!

public ref class GhVaWall : public IGH_GeometricGoo, public IGH_BakeAwareData, public IGH_PreviewData
{
     ... 

property BoundingBox ClippingBox { virtual BoundingBox get(); }
virtual void DrawViewportWires(Rhino::Display::RhinoViewport ^,Rhino::Display::DisplayPipeline ^,System::Drawing::Color,int);
virtual void DrawViewportMeshes(Rhino::Display::RhinoViewport ^,Rhino::Display::DisplayPipeline ^,Rhino::Display::DisplayMaterial ^);

}

/*---------------------------------------------------------------------------*/

BoundingBox GhVaWall::ClippingBox::get()
{
GhVaUtil_debug_str(L"GhVaWall::ClippingBox", 0, true);
return BoundingBox();
}

//----------------------------------------------------------------------------------------------------

void GhVaWall::DrawViewportWires(Rhino::Display::RhinoViewport ^viewport, Rhino::Display::DisplayPipeline ^pipeline, System::Drawing::Color col, int thickness)
{
GhVaUtil_debug_str(L"GhVaWall::DrawViewportWires", 0, true);
// Test
pipeline->DrawArrow(Line(Point3d(0,0,0), Point3d(10,10,10)), col);
}

//----------------------------------------------------------------------------------------------------

void GhVaWall::DrawViewportMeshes(Rhino::Display::RhinoViewport ^viewport, Rhino::Display::DisplayPipeline ^pipeline, Rhino::Display::DisplayMaterial ^material)
{
GhVaUtil_debug_str(L"GhVaWall::DrawViewportMeshes", 0, true);
// TO DO
}

Views: 499

Replies to This Discussion

GH_Component already implements IGH_PreviewObject, so there exists a basic implementation already. If you do this on a GH_Param, you must provide implementations of the defined methods, even if these methods do not do anything. Have a look at IGH_PreviewObject and then implement all the methods and properties as defined in the interface.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Indeed, I have implemented an empty version of the methods and properties required by IGH_PreviewData (the derived class can not compile otherwise).

DrawViewportMeshes
DrawViewportWires
ClippingBox

The project compiles correctly. Is at runtime (loading .gha) when the crash occurs.

Are you sure you're compiling against the same Grasshopper.dll that you're running? The signatures of those DrawViewportWires methods you posted are ancient, it has long since been replaced with a function that looks like:

void DrawViewportWires(IGH_PreviewArgs e)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ohhh yes!

The Grasshopper reference path of my project points to an old version.

Thank you David and sorry for my cluelessness

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service