Import text - file not updating

We use an import text component with a .csv file in Grasshopper. What I noticed is that you cannot update the file, unless you rename the file. Which basically only leaves you the option of updating the file in Shapediver. I cannot just update the file in Amazon S3.

Why that limitation? I know you are actually caching the file somewhere, but shouldn’t there be some check to see if the file has changed? That way I don’t have to always 1. rename the file, 2. upload a copy to Amazon S3, 3. log into Shapediver, 4. find the right model, 5. go to edit it, 6. update the URL in the field. Instead I could just overwrite the file in S3 and be done.

Is there any way around this limitation?

It’s like this: We cache results of computations of models. If you request a solution for the exact same parameter values, and a solution for these parameter values has been computed previously, then the answer to your request is the cached solution. This happens individually per “output” of your model. Some outputs might have been computed for the given parameter values, while others still need to be computed.

The contents of the files which you use as input data to your models never get cached by us. This data is forgotten by our servers as soon as the computation in Grasshopper is finished.

In case you want to work around the caching, in principle there are two ways to achieve this:

Both can be automated using our APIs and SDKs. In order to suggest a solution which fits your purpose, I would need to know more about your application.

  • Are you working with your models on our platform?
  • Do you use iframe or direct embedding?

Thank you for following up. The problem is more that I do not see an update of the file while working in Grasshopper:

I overwrite the file in Amazon S3. The file URL stays the same.
I then recompute in Grasshopper, but the output is still that of the old file.

So the question is more why the component in Grasshopper when running locally does not show the new content? It seems to be caching the old contents.

Is there a function in the Shapediver plugin to reset content read via the import text component from a web address?

Ok I see. Our component uses standard .NET functionality for downloading, which for sure also makes use of caching. If you don’t want your files to be cached, setting the Cache-Control HTTP header for your S3 object should help. As an example, set it to no-cache. I have not tested this, but I assume it will work.

I just tried this again and now it actually broke my model. I uploaded a new .csv using the shapediver backend. Suddenly there is no geometry output shown. I then clicked the X next to the file I uploaded, but now it does not revert to the file specified in the Grasshopper file!? If I upload a previously working .csv file it also does not work.

Seems like something about the file upload field is not working right yet.

I also tried clearing the cache, but the model seems broken now, but was working fine when I uploaded it. I could also update the .csv once, but now no matter what I do it remains broken.

So that means I cannot use this mechanism in anything mission critical and instead have to do the old way of always uploading a new model for every tiny change, even from an external file!?

EDIT: It’s now working again. Seems like the Shapediver website doesn’t notice when the shapediver viewer is in an error state even between going back and forth on pages. After Cmd-Shift-R for a hard reload it is working again.

Please explain what exactly broke your model, and how to reproduce the problem. I just tested the geometry input component using the attached test model, and it works as expected.
SS-6746.ghx (121.4 KB)

I think the UX of the file upload is a bit strange. I am actually using a URL as input for the component in Grasshopper, which works well.

Then on Shapediver the parameter field does not show anything. Shouldn’t it show the URL of my file? That way I could just enter a new URL and it would read that file. But instead I can then upload a file directly. Once I upload a new file it says “uploaded file” or something similar in the field. Then I save the model and if I go back to edit the parameters it now says nothing again in the field, so I don’t know if it is taking the newly uploaded file or my originally specified file from the Grasshopper script. That is a big problem, since of course it is very important to know which .csv file it is reading from.

I can then press the X in the field to remove the newly uploaded file!? I am not sure as it does not say anything anywhere. From the screenshot you can see that there is no way to know what the current state is… has it loaded any file? is it the one I specified in Grasshopper or has a new file been uploaded or is there no file set at all currently?

image

My suggestion would be to turn it into 2 components - 1 is for reading a file from a URL and if I edit in Shapediver I get a URL field and I can see the URL I have set in Grasshopper and can change it for a new URL. Another component is for uploading a file and if I edit in Shapediver I can upload a new file and see the current file.

For something that important to the resulting model as changing a file it is reading it needs to be super clear what file it is actually using.

Thanks for any further UX improvements in this area.

The error I was talking about occured exactly during upload a new file or removing the file. The viewer would just display the gif animation when it is loading and it said “no geometry could be generated”. I exited the model, loaded another one and got the same error. Only after I force reloaded the shapediver website (cmd - shift - R), which clears the cache, did everything start working again. If I encounter it again at a similar stage, I will let you know.