algorithmic modeling for Rhino
Dear all,
I have modified several of the Grasshopper.Kernel.Special components including the GH_Number Slider, GH_ValueList and the GH_DialKnob.
I've noticed that when I save a Grasshopper file which contains my custom components and then try to re-open it the file fails to load - I get the errors in the pictures attached.
Why is this the case and what do I have to do to solve this issue?
Many thanks!
Tags:
Put a breakpoint on the first line of your Read function and debug into it. It should then be fairly simple to see where the mistake lies. If that line isn't even called, you may have to put a breakpoint in the constructor instead.
Hi David,
Thanks I did this and it worked, one of my components references another component which is not yet on the canvas yet when the saved file is open.
How do I get around this? Is there a guide somewhere to fix these sort of problems I'm pretty lost here. Thanks!
Don't make that reference until the first solution starts. This is the sort of bookkeeping code that would fit very well inside the BeforeSolution method. It'll be easier to override that than to start registering events.
Thanks for your reply David this is certainly helpful.
However I am still stumped on one issue, in the code that I write in the BeforeSolution method I need the a checklist to know that it is "linked" to the other when it is deserialized. I did this by creating a instance field in the checklist:
public Guid ownerOfThisComponentInstanceGuid = ownerOfThisComponent.InstanceGuid;
This works fine before serialization however after deserialization this Guid is always set back to nothing so the checklist always looses its connection.
Should I expect this Guid to be saved on deserialization? Many other values are. Is there something that I need to place in the read and write function? Many thanks!
David I also realized that other data custom fields such as this is not being stored on deserialization and serialization. How do I go about fixing this?
You must override the Write and Read methods on your component and include those values in the archive.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by