Grasshopper

algorithmic modeling for Rhino

Hi everyone!

Is there a way to keep your work as individual C# files on your computer, and import them from a C# component? If I for instance create a class that I want to keep in a .cs file, and then just import it into the C# components where I want to use it?

It seems messy to have to write everything in one single C# component.

Views: 2751

Replies to This Discussion

I think that would be possible to implement; either we could do it or you could compile a new assembly on the fly and use that from a scripting component -- but as your project evolves, you might find yourself building the temporary assembly over and over and that is just sub-optimal.

The way we suggest you develop larger add-ons is using the .Net SDK for Grasshopper. Use the _GrasshopperGetSDKDocumentation command to download it; and get the Visual Studio add-on for Grasshopper to get started.

I hope this helps,

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

As usual, someone thought of yet another good solution. Cool! Thanks for sharing this Naruto.Now and then, you can remove temporary assemblies from the temporary folder, %temp%.

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

Thank you so much, exactly what I wanted! 

One more question, 筑梦NARUTO , what is the script editor you are using in the picture, it is separate from Grasshopper, right? 

First, you need to use VS or sharpdevelop import rhinocommon.dll and grasshopper.dll and GH_IO.dll and GH_Util.dll,

Secondly,  use vs or sharpdevelop create a solution 。

Third, the right C # Script (VBScript) operator, export source;

Fourth, export suffix .cs (.vb) file renaming, covering the first step to save the .cs file;

Fifth, open the project in VS or SD file, add the following statement to go in and save the path link to the F-side plug-in operation;

//<Custom Code>
//</Custom Code>

Sixth, you can write code inside vs or SD

I hope this helps

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