The Import Geometry component is a way to let online users upload a CAD file that can be used as an input to the Grasshopper definition. There are two ways to import geometry 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 images are stored instead of uploading local files. The Direct Text Input component can be connected to the URI input parameter as a way of dynamically changing the location/URL of the file 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 CAD files and use them with the ShapeDiver plugin. Learn more about the Enterprise plan here.
The component outputs a list of geometry objects extracted from the imported file.
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, all of the geometry file formats are checked.
Supported file formats
At the moment, the ShapeDiver plugin can import two file types:
OBJ (MIME type: application/wavefront-obj) - 3D meshes
DXF (MIME type: application/dxf) - 2D drawings
For the DXF format, the following entities are supported (other entities will be ignored):
If you need to import other file formats, we suggest you switch to the Rhino 7 version of the plugin.
Export OBJ files from Rhino
When exporting OBJ files from Rhino, a dialog with several options for export opens. If the goal is to use these files for importing them in ShapeDiver in Rhino 6, make sure the option "Wrap long lines" from the Formatting tab is unchecked, otherwise the viewer will not be able to parse them.
In Rhino 7, most of the formats available for importing in Rhino (command
_Import) are also available with the Import Geometry component. Double-click on the component to see the full list.
Using the ShapeDiver attribute system, all objects imported from an external file come with attributes that contain metadata about those objects in their source document, including such information as name, layer, color or material. Read more about our “Attribute” components and the attribute system.
One possible application for importing geometry is to offer a web applet that lets users upload their own files and run them through an online algorithm, therefore providing an Algorithm as a Service. Consider below a basic example definition that lets users upload meshes with a number of holes and simply fills all the holes to output a watertight mesh.
Once online, this definition includes a text box for users to link external CAD files and see the algorithm's results in the 3D viewer. The final definition also includes an export component for downloading the closed output mesh.
Upload floor plans
A great use case in the field of architectural product configurators is to allow users to upload floor plans (in the DXF 2D file format, for example) as an input for architectural products.