Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning on Grasshopper component #24

Open
Marco-Pellegrino opened this issue Mar 9, 2023 · 3 comments
Open

Warning on Grasshopper component #24

Marco-Pellegrino opened this issue Mar 9, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Marco-Pellegrino
Copy link

Hi Guys!

I am trying to add a warning on my component but it does not work.
Can you please provide an exampke? @teocomi @didimitrie

We are currently using Async in FEM-Design API and your help would definitely be super apreciated.

Parent.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No declared support.");

https://femdesign-api-docs.onstrusoft.com/docs/grasshopper/basics/beta/

@Marco-Pellegrino Marco-Pellegrino added the bug Something isn't working label Mar 9, 2023
@Abstractmachina
Copy link

hello, would like to know the same thing. Any updates on this?
the Parent.AddRuntimeMessage( ) method is not doing anything. Sometimes I get a "not set to an object instance" error, sometimes not, the error message is not showing up in either scenario. thanks!

@AlanRynne
Copy link
Member

Hi there!

Since the AsyncComponent runs a double-solution, any runtimemessages you declared in the DoWork (the first solution) will be removed automatically by Grasshopper before SetData (called in the second solution) runs.

What we've done in other components is just store the RuntimeMessages in a property of the Worker, and call Parent.AddRuntimeMessage inside SetData (and clearing the message list after).

Here are the meaningful lines in our Send component 👇🏼

https://github.com/specklesystems/speckle-sharp/blob/799cdd0e0558fd4fa1da53a01e77e9098f303f35/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs#L378

https://github.com/specklesystems/speckle-sharp/blob/799cdd0e0558fd4fa1da53a01e77e9098f303f35/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs#L707-L708

Hope this helps!

@Abstractmachina
Copy link

Hi there!

Since the AsyncComponent runs a double-solution, any runtimemessages you declared in the DoWork (the first solution) will be removed automatically by Grasshopper before SetData (called in the second solution) runs.

What we've done in other components is just store the RuntimeMessages in a property of the Worker, and call Parent.AddRuntimeMessage inside SetData (and clearing the message list after).

Here are the meaningful lines in our Send component 👇🏼

https://github.com/specklesystems/speckle-sharp/blob/799cdd0e0558fd4fa1da53a01e77e9098f303f35/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs#L378

https://github.com/specklesystems/speckle-sharp/blob/799cdd0e0558fd4fa1da53a01e77e9098f303f35/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs#L707-L708

Hope this helps!

Hey,
Didn't get back to this for a while. But tried your suggestion now, it works great! thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants