meshmash / Plankton

A C# half-edge mesh data structure, and components for using this in Grasshopper/Rhino
http://meshmash.github.io/Plankton
GNU Lesser General Public License v3.0
216 stars 66 forks source link

Using Plankton in a separate component #28

Closed danhambleton closed 9 years ago

danhambleton commented 9 years ago

Hi all,

I'm having some trouble getting a GH component project that uses Plankton set up. Here are some of the errors:

image

image

I guess what would be helpful are some guidelines on how to create a "Hello World" GH component that uses Plankton. I'm sure I'm missing something easy, but since I don't know the library that well, I figured it might be faster to ask the experts :)

pearswj commented 9 years ago

Dan,

Thanks for raising this. We certainly want more people to use Plankton in this way and you've raised some valid points regarding how we can make this easier.

First off, the Add method that you've highlighted is internal.

http://pearswj.co.uk/Plankton/docs/PlanktonFaceList.html#Add

Plankton provides a public AddFace method that takes a list of vertex indices (like you would construct a face-vertex mesh). This is how we ensure the validity of the halfedge data structure.

Is the reason that you're copying files from Plankton because you're having trouble referencing the DLL and GHA? I believe that due to the copyleft clauses in the LGPL license you'd be required to open source your own project (should you release it publicly) if you make changes to ours (including cherrypicking files). Daniel and I would have to have a chat about whether we'd enforce this.

Check out http://github.com/meshmash/MeshMachine for how we've referenced and used Plankton, although we may not have followed our own advice... A HelloPlankton example is a great idea!

You've reminded me that I should document my trick for referencing GHA files in VS...

The second point I can't answer directly, but we have been having issues with the GH casting when COFF loading is turned on.

On 5 Dec 2014, at 18:32, danhambleton notifications@github.com wrote:

Hi all,

I'm having some trouble getting a GH component project that uses Plankton set up. Here are some of the errors:

including the "RhinoSupport", "GH_PlanktonMeshParam" and "GH_PlanktonMesh" classes directly (i.e. by copying them over) gives me some errors. Various methods are not found, others are inaccessible. I have feeling that this has something to do with the extension structure, but I'm not sure.

referencing PlanktonGH as an assembly from within my component will compile successfully, however GH seems to have trouble casting the data types properly.

I guess what would be helpful are some guidelines on how to create a "Hello World" GH component that uses Plankton. I'm sure I'm missing something easy, but since I don't know the library that well, I figured it might be faster to ask the experts :)

— Reply to this email directly or view it on GitHub.

danhambleton commented 9 years ago

Thanks for the info - the MeshMachine project is certainly helpful. However, not being able to "cherry pick" the Rhino/GH support classes and use them in my project means that I'll constantly be overwriting the parameter and PMesh decomposition components on the target machine (since the components are included along with the rhino support files in the PlanktonGH project and get compiled along with everything else. I suppose I could simply not rename the dll to .gha...

Perhaps omitting the demo components from PlanktonGH would help? That way I can just reference the PlanktonGH library when I need Rhino/GH support without worrying about overwriting existing components.

Also, how do you turn off COFF loading? Is that done by disabling the incremental linker option?

Dan-Piker commented 9 years ago

Hi Dan, Why is it you say you'll need to be overwriting the parameter and decomposition components? You just need to reference Plankton and PlanktonGh in your project to use them, including the RhinoSupport - you shouldn't need to actually recompile them.

Anyway, I tend to agree that splitting things up further might be good - Plankton.dll for the core, PlanktonGh.dll for the Rhino/GH support, and Plankton.gha for the actual components.

COFF loading is an option in GrasshopperDeveloperSettings (typed at the Rhino command line)

pearswj commented 9 years ago

@Dan-Piker But you need to reference the GHA if you want to use the Plankton GH parameter.

If you reference the GHA, you shouldn't distribute it as part of your plugin – just ensure that the user has one copy installed.

This will get easier in the future ;)

On 15 Dec 2014, at 01:32, Daniel Piker notifications@github.com wrote:

Hi Dan, Why is it you say you'll need to be overwriting the parameter and decomposition components? Anyway, I tend to agree that splitting things up further might be good - Plankton.dll for the core, PlanktonGh.dll for the Rhino/GH support, and Plankton.gha for the actual components. COFF loading is an option in GrasshopperDeveloperSettings (typed at the Rhino command line)

— Reply to this email directly or view it on GitHub.