Skip to main content
Skip table of contents

Import Geometry

Premium feature

File imports are only available to users with a paid ShapeDiver subscription

The Import Geometry component is a way to let online users upload a CAD file that can be used as input to the Grasshopper definition. The component outputs a list of geometry objects extracted from the imported file.

This component is one of several components of the ShapeDiver plugin that can be used to import files in online ShapeDiver models. Read more about the general principles of all ShapeDiver Import components.

Example

Download the Grasshopper definition of this example here.

The example below includes an Import Geometry component that lets online users upload their own OBJ files. The simple definition then lets users scale the uploaded mesh in the x, y, and z directions before displaying it in the online viewer.

The URI input of the Import Geometry component is fed the static URL of a remotely stored, publicly accessible obj file (https://shapediverdownloads.s3.amazonaws.com/staticassets/bunny.obj). By default, the component outputs the geometry included in this file before users of the online model upload their own.

Supported file formats

Define which file formats are allowed as inputs using the right-click context menu of the component.

Rhino 6

At the moment, the ShapeDiver plugin can import two file types, with the following objects supported:

File type

MIME type

Entities supported

OBJ

application/wavefront-obj

All (meshes)

DXF

application/dxf

  • Points

  • Lines

  • Polylines

  • LwPolylines

  • Arcs

  • Circles

  • Splines

  • Meshes

  • PolyfaceMeshes

  • Faces3d

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.

Rhino 7

In Rhino 7, most of the formats available for importing in Rhino (command _Import) are also available with the Import Geometry component. Right-click on the component to see the full list in the context menu.

Unit System

In Rhino 7, the component imports the files using the currently active system in the Rhino viewport. When using the component locally, make sure the unit system of your Rhino session corresponds to the dimensions you are expecting in Grasshopper. When uploading the file, you can force the online servers to use a specific unit system by using the “Tolerance Settings” component.

Import geometry including document properties

Download here the final Grasshopper definition, and here the 3dm file containing the imported geometry from this example.

The Import Geometry component imports in Grasshopper any geometry contained in a specified file input. Depending on the input file format, a set of document properties are stored in the geometry objects in Grasshopper as attributes after they are imported. The current set of document properties imported as attributes are the following: name, layer, color, plotcolor, plotweight, material.

Consider the following object in Rhino:

It has a defined name (“example box”), layer (“example layer”) and color (“Red”). When saving it to a 3dm file (or any other file format which support the concepts of names, layers and object colors) and then using the Import Geometry component to import it in Grasshopper, those three properties can be extracted from the imported object using the attribute components. This can be tested locally be referencing the local 3dm file:

Once the definition is uploaded, the same behavior will be available when one uploads the same file to the input corresponding to the Import Geometry component. Let’s add a data output for each of the attributes we want to see on the platform:

Once uploaded, the ShapeDiver model contains a file input. Any user can then upload their own 3dm file. When the file containing the box is selected as input, one can verify that the data outputs show the corresponding attribute values:

Import geometry including stored user text

Download here the final Grasshopper definition, and here the 3dm file containing the imported geometry from this example.

The Import Geometry component imports in Grasshopper any geometry contained in a specified file input. In Rhino, it is possible to defined so-called User Text key-value pairs for each object in a document. This User Text is then stored with the objects when saving them as a 3dm file, as well as some other file formats which map User Text to similar properties of their own. Consider the following object in Rhino, where we have stored two key-value pairs:

When saving it to a 3dm file (or any other file format which support custom properties that Rhino can map to User Text) and then using the Import Geometry component to import it in Grasshopper, those two user text key-value pairs can be extracted from the imported object using the attribute components.

Make sure to check the option “Save Plugin Data” before exporting, to make sure User Text is included in the file.

This can be tested locally be referencing the local 3dm file:

Once uploaded, the ShapeDiver model contains a file input. Any user can then upload their own 3dm file. When the file containing the box is selected as input, one can verify that the data outputs show the corresponding attribute values:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.