CADLink

CADLink is available as a separate asset in the Unity Asset Store and it is included in the Game4Automation Professional package. CADLink is able to import 3MF files and STEP files into Unity. STEP is a de facto standard for 3D CAD data and more or less all CAD Systems are able to export STEP files.

Advanced tools for working with large assemblies like Selection Window, CAD Checker or CAD Updater are only included in Game4Automation Professional. CADLink as a standalone solution only supports what is described on this page.

Please check also the Youtube video, which demonstrates CADLink: https://youtu.be/yXwn6m8ilHE

After installation, you will find CADLink under Assets>CADLink, if you are using it as a stand-alone asset or you will find it under game4automation>private>CADLink

The folder structure looks like this:

In the folder Samples you find a sample scene which is importing the ToyCar example as a 3MF file and another scene based on a STEP file.

To import 3D data into your scene you need to drag and drop the CADLink prefab into your scene or you can use in Game4Automation Professional the Menu game4automation > Add CADLink (Pro).

You are now able to import your CAD assembly as a sub-hierarchy into the CADLink top node. It is possible to include in one scene multiple CADLink interfaces if needed.

The import is always done into the scene itself as meshes in child objects under the CADLink top node. No prefab is created and the meshes are only present in the scene itself. If you would like to create a prefab you could use Unity’s FBX exporter (see https://docs.unity3d.com/Packages/com.unity.formats.fbx@2.0/manual/exporting.html) after importing into the scene.

CAD Updater (only included in Game4Automation Professional)

With CAD Updater you can update your scene data based on a new version of the CAD file without losing anything that you added to the Gameobjects inside the scene. This is a semi-automated process. Before updating you can check changes that are going to be performed by the update.

CAD Updater is attached and started automatically if there is already something existing under CADLink when you start the CADImport. If you don’t want to perform an update you must manually delete all Data which have been imported before.

For more information please read the section CAD Updater.

Importing STEP files

To import STEP files is the recommended way for reading data of CAD Systems. When importing Step files the tessellation is done within Unity.

STEP file import is only possible in the Unity Editor and not during Unity Play mode.

STEP Import Settings

The STEP import settings are very simple:

File

The file (.stp or .step) to import.

Remove top assembly node

Removes the top assembly node, which is a Gameobject with the name of the imported file.

Import Scale Factor

The scale factor of the import. 0.001 corresponds to one Unity Unity equals 100mm.

Quality

You can select 4 different quality modes for the mesh tesselation (High, Medium, Low and Custom). By selecting Custom a custom angular and chordal deflection can be defined for the Mesh algorithm.

Set and create materials

Usually, the Step import applies a standard material with an Albedo value corresponding to the color in the Step file. Another option is to map the colors defined in the Step files to Unity Materials. To do this it is necessary to define a Material mapping where you need to select the color value of the Step color and the corresponding Material.

Importing 3MF files

Some CAD Systems like Solidworks, Solidedge, ProE / Creo and NX are able to write 3MF Files. Please check your CAD System documentation to see if your system is also able to write 3MF Files.

The advantages of 3MF files are:

  • The tessellation is done by the CAD System which provides usually a very good quality
  • It is the modern tessellation 3D-printing standard - which fits perfect to Unity
  • Assembly structure is included
  • Color and material information is included
  • It is zipped and low sized
  • It includes multiple occurrences only one time - which reduces the file sized

Known Limitations with 3MF files

Solidworks (Dassault)

No known limitations. Solidworks exports everything correct (assembly structure, colors and materials).

Solidedge (Siemens PLM)

No known limitations. Solidedge exports everything correct (assembly structure, colors and materials).

Please use this export options:

Fusion360 (Autodesk)

You can use this solution to write 3mf files:
https://apps.autodesk.com/FUSION/en/Detail/Index?id=9199586017740700165&appLang=en&os=Win64

Colors and assembly structure is not exported correct (flat structure without colors).

ProE / Creo

No known limitations

NX (Siemens PLM)

NX is exporting currently no assembly structure. Colors are exported. We will provide a work around in a NX macro which we are going to release soon.

3MF Import Settings

In the Inspector you can check and change the CADLink settings:

Import CAD

File

You can type in the relative or absolute File path or you can select the file path by pushing on the button Select CAD Import File

Delete before importing

This deletes the old imported data automatically when importing once again.

Remove top assembly node

Removes the top assembly node when importing the CAD data. This means that CADLink object is acting like the top assembly node.

Name Clones Identical

If clones (multiple occurrences of an identical part in the assembly structure) you can name all of the same or you can let the importer add a number in brackets to the imported name.

Import scale factor

The scale factor for the import. Normally, if one unit in Unity means for you 1 meter and you are exporting the 3mf file in millimeters this should be 0.001.

Advanced Settings

Unity recalculate normals

Defines that Unity should recalculate the normals. We recommend to turn that off.

Advanced recalculate normals

Lets the importer to recalculate the normals and - if needed - to combine the separated vertices again to one. The calculation is done based on the angel between the triangle surfaces. If the angle is above the defined angle (in Degrees) an edge is created (with separated vertices). This gives a sharp edge shading. If the angle is below the vertices are combined and a normal is calculated which gives a smooth edge.

See the difference in this pictures.
With recalculated normals:

Without recalculated normals:

Calculate UVs

This option takes some time when importing. So please just turn it on when needed.

You can calculate UVs automatically for mapping material textures on the surface. You can change the UV scale factor.

With scale factor 0.01:

With scale factor 1:

Materials

Usually during the import new materials are created - if not existing - based on the naming of the imported color. You can change these materials if needed.

Another option is to define a Material Mapping. This will map a given material to a certain imported material and color name combination.

You can start the material assignment independent from the import by pushing the button “Update Materials”. In the import process the materials are automatically updated.

Set and Create Materials

If turned of no materials are created during import.

Overwrite Existing Materials

If a material which is currently imported already exists it will be overwritten.

New Material Path

Defines the path where the new imported materials should be created.

Material Mapping

Defines the Material mapping table. You can have in your project multiple material mapping tables. To create a new one and to automatically assign the new one to the CADLink object just press the button Create New Material Mapping

In the Material Mapping settings you can define a color and/or a material name and assign this to a Unity material.

CADLink checks the assignment in the following order:

  • First, assign materials if the Material name and Color name are defined in the table (and if they are not empty).
  • Second, assign materials if the Material name is in the table and the Color name is empty.
  • Third , assign if the Color name is in the table and the Material name is empty.

Import 3MF during runtime

You can import 3MF files also during runtime. During runtime import materials are not created in the Material Assets. For changing materials you must provide before importing during runtime all materials with a corresponding Material Mapping.

Import during runtime :c#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class DemoImportRuntime : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
GetComponent<CADLink>().ImportCad();
}

// Update is called once per frame
void Update()
{

}
}

© 2019 in2Sight GmbH https://game4automation.com - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.