Document toolboxDocument toolbox

Best practices: CAD file workflow

Description

When working with CAD-files in your Prespective project having a proper workflow is strongly advised. In this article we share some tips and best practices to help you setup and organize your CAD-files. Before you import your CAD-files we recommend determining the goal of your project early on. This will help you with decisions regarding optimizing and managing your CAD-files.

 


Introduction

We strongly recommend using Pixyz to import all your CAD-files into Unity. Pixyz is a third-party plugin supported by Unity3D. You can download Pixyz from the Unity Asset Store, or via their website. When discussing import-settings in this article, we are using Pixyz.

Before you start importing any Cad files make sure you know which file types are most usable. To help you out choosing a proper file we recommend you to take a look in this document Choosing a proper 3D-file

Performance of a project on your system is essential for running Prespective simulations. We will show you how to keep your project manageable and accessible for these simulations.

Because a computer does not have infinite computing power, it is important to know which quality level fits your project and system the best.

When importing CAD-files the first step is to define the quality level of the 3d model. You can choose between a high, medium or low quality for your CAD-files. A lower quality will generate a model that has the same measurements, but less triangles and detail as a higher quality model. This is most obvious in circular and spherical shapes.

Low Quality : Generates less detailed models. Using a low quality model may be necessary to enhance performance for large CAD-files, or those with a lot of details.

Medium Quality : A good model that works well in combination with Prespective. This setting can be used on a single detailed machine. We recommend this preset for most cases. This preset does not reduce the details too much and is performance friendly.

High Quality : A highly detailed model is generated. This preset is mainly used for simple objects and high quality visualization.


Step 1 : Import and verify your CAD files with Pixyz

For more documentation on Pixyz’s import settings, please visit their documentation page.

When importing your CAD files, choose a “Mesh Quality“ level that matches the goal of your project. As shown in the introduction above. In most cases the default import preset gives a good result as shown below.

  • Make sure the Z-up direction matches that of your CAD-files.

  • Make sure the Left Handed matches that of your CAD-files. Otherwise your model will be mirrored.

Generate UVs on import

  • Make sure to check the “Create Ch.0 UVs“ to create an unwrap of all generated mesh files so you can add materials later on.

Verify the Cad model

  • Check whether the model has been imported with the correct scale, rotation and position in the Inspector as seen below.

  • Check the model on data loss / missing parts.

  • Create a “Cube“ from the top menu “GameObject->3D Object->Cube“ in order to compare if the scale is correct or not.

  • Look for the usability such as a complete Hierarchy tree.

  • Usable pivots. Set your “Tool Handle” on the top left of your screen to “Pivot and Local”

  • To check the usability of pivots you can select an parent or object that already has a rotation. If the if the pivot gizmo aligns with the selected object you probably got a usable 3D Model

  • To Check if the Unwrap has worked out well you can create an material. Put an “Checker texture“ in the “Albedo” channel of the created material. Drag and hover over several objects to make it appear as shown in the image below.

  • When it did not worked out well it shows you an solid color.

  • You can fix UV unwraps by going to Pixys->Toolbox->UVs->Create UVs and press on ”Execute”


Step 2 : Optimize and redo topology and hierarchy

In this step we will clean up the imported model for better performance and visibility of the simulated objects.

Hide irrelevant objects

Using the https://unit040.atlassian.net/wiki/spaces/PUD/pages/280986090 feature of Prespective you can easily select smaller parts of the model that are irrelevant for the simulation and hide them.

For instance, you can easily select all nuts and bolts.

  • And hide them when not needed in the Inspector or by pressing (Alt+Shift+A).

By hiding all the unnecessary meshes you gain performance for using it as a simulation. Hidden parts are not lost, and can easily be retrieved when you need them.

Clean up hierarchy

Cleaning up your hierarchy helps you manage your project and find objects more easily.

  • Start giving groups and parents logic names. To start with you can create an empty game object with the name StaticMeshes. Put everything that is not moving into this parent.

  • To check if your game object contains everything you need you can toggle the game object on and off using Alt+Shift+A.

Optimize hierarchy

  • By using the https://unit040.atlassian.net/wiki/spaces/PUD/pages/280986090 You are able to take all the objects that contain mesh renderers from parent objects. You can put them into an empty parent and give it a group name to create a less cluttered structure. It also gains performance when unity has to calculate lesser parent objects.

  • Don't forget to delete te remaining empty game objects after moving the meshes.

The first thing you should do is organize all objects that need to be rigged with Prespective.

Before deleting any Parent objects make sure that the pivot point of an object or its parents that you want to rig later is positioned and rotated correctly. These objects can help you rig the model with Prespective later and should not be deleted. Make sure to set your “Tool Handle” on the top left of your screen to “Pivot and Local” to check that. If there are there any pivot points that are not aligned to an object or having a bad rotation. This we handle on later in this document.

  • If you have multiple objects that always move together you can use a single parent. Simply place all the objects within the parent and give it a recognizable name. In our example we use a piston cylinder with its rings and place all the objects under a single parent, and delete the remaining empty objects.

Group objects

  • For the best user experience we recommend naming the parents (and subsequent parents) with easily recognizable names.

  • After organizing your hierarchy for all moving objects there are still many static objects left. These should also be organized using recognizable parent names so they can easily be hidden when you don’t need them.


Export as Collada

When you are finished cleaning up the model, You can export it as a Collada (.dae) file. Before you export make sure you have checked that everything that you need is not hidden in the scene. Once exported, this model will be the base of your Prespective project.

  1. Select in your hierarchy the optimized and organized model.

  2. In the Prespective menu go to Utilities->Export Collada File.

  3. Choose an output path for your Collada file.

  4. Keep a copy of this scene as a form of backup for your model at this version will still have all the hidden objects.

  5. Within your scene hierarchy you can now delete the model you have exported as Collada.

 

Step 3 : Prepare the model and create kinematics

Import as Collada

Go back to the Prespective menu to Utilities->Import Collada File, select your recently created Collada file and store it on importing in a recognizable map name.

Your Assets folder now should contain this structure in order to easily find back your imported model to work with.

Static meshes

  • For the objects under te parent name StaticMeshes
    Its important to check the checkbox “Static” on the right side of the Inspector so Unity doesn't calculates every thick what its position rotation and scale is. When a popup window appears and asking you to include all the children on static as well press “Yes”

Align objects

It sometimes happens that objects need to be (re)aligned. The reason can be because you loaded two seperated assemblies a top and a bottom. This can be easyly fixed by using the https://unit040.atlassian.net/wiki/spaces/PUD/pages/281051436/V2020.1.56.3+Alignment+Tool

Pivot movement

Pivots are the main points for objects and parents. This is where the objects rotates around and defines its main position and rotation from. In order to check wheter the pivot is good or not make sure your “Tool Handle“ is set to Pivot and Local as shown in the image below.

To create the most precize measurement and movement with kinematics for instance The pivots need to be in the right position. If they are not you can change them by using the .

 

Prespective Documentation