Description of the component
The ShapeDiverTextfileImport component is a way to let online users upload a text file that can be used as an input to the Grasshopper definition. There are two ways to import a text file using this component:
- By giving a URL to the URI input parameter (possible locally in Grasshopper and in the online viewer)
- By double-clicking on the button generated by the component, after the file is uploaded to the platform (possible only in the online viewer). The button opens a dialog allowing online users to upload their local files.
Let users set a file URL
You might want to give the possibility for users to enter a public URL where their files are stored instead of uploading local files. The ShapeDiverTextInput component can be connected to the URI input parameter as a way of dynamically changing the location/URL of the image which will be imported.
In Grasshopper, the component can only be tested using the option 1, both with public online URLs and with files stored locally (using the path of the file on the local machine).
The files must be hosted in a publicly accessible online location that allows downloading. Read more about how to store files online and use them in the ShapeDiver viewer.
Importing private files
ShapeDiver Enterprise customers are provided with a private and secure storage space that can be used to store external text files and use them with the ShapeDiver plugin. Learn more about the Enterprise plan here.
The component outputs a Text object.
Double-clicking on this component opens a dialog box with the options to set a maximum file size for the parameter and to enable different file types.
Set at least one file format
Make sure at least one file format is checked, otherwise online users will not be able to upload their files. By default, none of the image file formats is checked.
Supported file formats
The component supports all files with MIME types text/plain (typically .txt files) and text/csv. Let us know through the forum if you need to import more image formats.
Example definition
Download a definition explaining all types of file inputs for ShapeDiver.
Applications
For complex product data logic that your grasshopper definitions may need, this component is ideal to be used along with the JSON components. These JSON components will allow you to access the data stored in your text file to be applied as parameters, restrictions, calculations, etc. If you have a csv format, using common Grasshopper text components will give you access to the data.
Component Reference
- Component name: ShapediverTextfileImport
- Default Nickname: SDTextfileImport
- Inputs:
Name | ID | Description | Type |
---|---|---|---|
URI | U | The default URI to import the image from if no file is uploaded. | Text |
- Outputs:
Name | ID | Description | Type |
---|---|---|---|
Text | T | The imported text. | Text |
- Notes:
- Double-click on the component to define which file types are accepted by the component and a maximum size for the uploaded files.
Comments
0 comments
Article is closed for comments.