Grasshopper

algorithmic modeling for Rhino

Protected Overrides Sub RegisterInputParams(pManager As Grasshopper.Kernel.GH_Component.GH_InputParamManager)


pManager.AddTextParameter("Folder", "D", "Folder", GH_ParamAccess.item, Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\SquidOutput")


pManager.AddTextParameter("Filename", "F", "Filename", GH_ParamAccess.item, "SquidPrint")


pManager.AddBooleanParameter("Tiff", "T", "Save as CMYK Tiff file." & vbCrLf & "Creates additional Alpha channel file.", GH_ParamAccess.item, False)


End Sub

When I compile this component, it seems that the

"Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\SquidOutput"" 

gets hardcoded to 

"C:\Users\Mateusz\Desktop\SquidOutput"

Why does SpecialFolder function don't change the directory on someone else's computer ? I can't really find any clue about that anywhere.

Views: 784

Replies to This Discussion

Well, it isn't compiling that way, since when I use a reflector to view your GHA, it still shows the code as above. When I try to run the squid savefile component, it appears as it should - referring to my desktop. Where are you seeing improper behavior? 

Same for me. When I invoke a new Save component, the folder is correct, but in your example file has your folder. 

I think it's internalised string in the Folder Directory input of your example file, sorry ~
when I used a new Save component, the correct path was found, excuse me for the false alarm

Ah, thanks guys :D

Didn't think about that, yet I've had similar problems already.

The thing is that once you place component on the canvas, .gh file stores information about its parameters. Even if you recompile the .gha, the parameters (inputs and outputs) in this one particular .gh file persist. This is probably some anti-crash mechanism. The only solution for that is to place a new component on the canvas... it seems like only then Grasshopper calls the RegisterInputParams (which explains now that Register means register in the .gh file).

RegisterInputParams is always called, however parameter names, nicknames, descriptions and persistent data is always loaded from existing gh files. So changes made to a parameter name will not be visible when opening old files.

It's not an anti-crash thing, it's mostly that I thought it conceivable that this data could be set by a user, and thus shouldn't be wiped during a save/open cycle.

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