Search Unity

Design, build, and operate faster with the PiXYZ plugin for AEC

January 30, 2019 in Industry | 14 min. read
Share

Is this article helpful for you?

Thank you for your feedback!

In collaboration with PiXYZ, you can now host your AEC projects in Unity. This post explains how to use the PiXYZ Plugin for Unity and what you can achieve in real-time.

For architects, engineers, and construction (AEC) professionals, Unity is the ideal platform to host your creative projects. Whether you are creating photorealistic walkthroughs of environments allowing customers to envision spaces, getting everyone on the same page regardless of their background or skill level, or catching mistakes that cost time and money, you can make the right decisions before a yard of concrete is poured. Now we’re taking it one step further in order to make your lives even easier in Unity 2018.3.

As you may know, we’ve been closely collaborating with PiXYZ. For example, with the PiXYZ Plugin and PiXYZ Studio for Unity, you can now import IFC BIM files into Unity. So in this post, we’ll demonstrate how to do that, as well as walk you through the other new features and visualization enhancements. Also, we’ll show you how to easily make adjustments in real-time.

Note that the 2018.3 versions of these PiXYZ products are available today from the Unity Store.

New to PiXYZ? No problem!

The PiXYZ Plugin for Unity is part of a software suite created by PiXYZ that is designed to edit, optimize, and import CAD files and Building Information Modeling (BIM) data straight into Unity.

Until recently, the PiXYZ Plugin was mainly used to integrate CAD models into Unity. With the Preview release of PiXYZ 2018.2 and full rollout in PiXYZ 2018.3, you can now use the Industry Foundation Class (IFC) format to import your BIM data. This bridge allows you to harness the power of BIM metadata, and optimize and create real-time renderings of CAD models using numerous Unity features.

To get more details about PiXYZ and to see a live demonstration, check out their presentation from last year’s Unite Los Angeles, where they provided a comprehensive showcase of the product. In addition to their session, you can watch a shorter walkthrough of a demo Project featuring Unity’s own Mike Geig, Head of Evangelism Content. In his presentation, Mike highlights the steps involved to import the data, perform spot corrections by merging geometries, use rules, adjust materials and lighting with Prefabs, and do a bit of post-processing.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Importing into Unity

This section walks you through how to import a CAD file into Unity with the PiXYZ Plugin using the .ifc file format, demonstrating how CAD data can be imported into Unity from your favorite design application. While this focuses on exporting from Autodesk Revit, note that with the IFC format, BIM data can be imported from any program that supports IFC, such as Civil 3D, Tekla, and ArchiCAD.

Within the Unity Editor, choosing PiXYZ expands the drop-down menu (see the first image below). Please note, a license is required to use all the features shown in this blog post. Follow this link to obtain a trial version or the full license of PiXYZ.

When you have access to PiXYZ, you can bring a CAD model into Unity by choosing PiXYZ > Import Model as seen in the image below. The Import CAD window lets you choose parameters that determine the overall output of the imported model.

Importing parameters

Next, we’re going to walk through a few import parameters to consider when importing a CAD model.

Scale

  • This determines the size of the imported model in Unity. For this example, meters was chosen as the unit of measurement in Autodesk Revit.

Z-up

  • Autodesk products use “Z for Up,” whereas Unity uses “Y for Up.” Stating that Z is Up ensures that your imported model will retain the correct orientation.

Metadata

  • If active, metadata integrated into the model will be imported into Unity. More information on how this is stored can be found in the section on BIM Metadata below.
  • Note: Without this parameter set to Active, Unity will not import the crucial BIM data that enables the use of the Rule Engine feature.

Create Ch.0 UVs

  • Create a new primary UV set: Channel .0. Ensure that this parameter is enabled, so textures map correctly in Unity.

Generate Lightmap UVs

  • This is only available once you have enabled the generation of Ch.0.

Override Shader

  • If left as Default (None (Shader)), the PiXYZ Plugin will use the current render pipeline shader to create the materials imported into Unity. Therefore, if you want to use a specific shader for your imports, simply drag it onto this property.

Create Prefab

  • This generates a Prefab in a designated folder within the Project. Additionally, the New Improved Prefab workflow will be accessible within this Prefab, only available in Unity 2018.3 or later.
  • By default, PiXYZ will produce a folder called “3D Models” and store the Prefab inside. The generated folder containing the Prefabs can be changed in Project Preferences (Edit > Preferences > PiXYZ).

Live Sync

With Live Sync active, multiple parameters are accessible within the Preferences of the current Project. Under “Live Sync Beta,” three Update Mode preferences are available:

  • Ask on Change: When a File is overwritten or edited, Unity prompts you to confirm any edits before updating.
  • Auto Update: Automatically updates a model without a prompt when a model is altered.
  • Manual: Manually requires resynchronizing.
  • It’s generally good practice to create a Prefab of the model, as this not only retains a copy of the model in your Project folders but enables the PiXYZ Live Sync Feature.
  • In the next section, we’ll do a deeper dive into Live Sync.

Once you’ve set all the relevant parameters, choose Import, and the file will be added to your current scene as a Prefab. For additional information regarding the Import CAD window, see this documentation from PiXYZ.

Deep dive into Live Sync

Live Sync, when activated, is a valuable feature for maintaining synchronization with small to medium-sized models and your Unity scene. This updates models within a Unity project with any edits made to the imported file, saving you a lot of time in this quick and efficient solution. Also, Live Sync is compatible with any file format PiXYZ can import (for example, .IFC, .OBJ). Let’s walk you through it.

Status symbols

Within the designated folder, some noticeable changes will be prominent. At the top left of the Models/Prefabs icon, a status symbol indicates the current state of the Prefab as seen below.

  • Green Tick: Prefab is in sync with File and the Model is up to date.
  • Yellow Arrows: Prefab is not in sync with File, and the Model needs to be resynchronized.
  • Red X: Model does not exist.

Sync settings

Remember, the Live Sync Settings can be found by clicking the button on the top right of the Model/Prefab icon.

A pop-up window appears with information such as File Path of the Model on the machine. As well, it contains two fields where you can assign assets created for use within the Rule Engine.

See the Rule Engine section below for more information about the use of both Preset and Rules Interaction fields.

Handling the BIM metadata

Once you’ve imported your model into the project – in this case, an IFC containing BIM data – you can find the Prefab in both the Project folder and the Hierarchy, as mentioned. By expanding the Prefab within the Hierarchy window (hold ALT and click; the drop-down arrow to the right of the Prefab in the Hierarchy expands all children), all of the meshes of the imported model are children of empty GameObjects.

The meshes themselves don’t contain any BIM data, they simply have a Mesh Renderer component and the material imported from Revit. It’s the empty parent GameObjects that contain the BIM data.

When interacting with empty parent GameObjects, the Inspector displays a table containing any BIM data exported from Autodesk Revit or other BIM software packages. The BIM data displayed corresponds to BIM data within Autodesk Revit. For example “/Reference” is the name of an object’s Type Properties in Autodesk Revit.

Type Properties, Family” (Revit)    = “/Name” (Unity)

Type Properties, Type” (Revit)       = “/Reference” (Unity)

You can then use this data within a Rule for imported objects within a Scene.

Armed with plenty of tools in the toolbox

Introduced in Unity 2018.3, the PiXYZ Toolbox provides you with a process to amplify and optimize geometry in an efficient manner. A tool within the Toolbox can be applied to any currently selected object within the Scene by simply right-clicking within the scene Window. With the Toolbox, you can easily manipulate objects without needing a RuleEngine Rule Set.

Note: Once the Toolbox applies an action, it cannot be undone.

Additionally, you can use the Toolbox on any GameObject within the Scene, including cameras and light emitters. To access the Manual Toolbox, right-click the selected objects either within the Scene window or within the Hierarchy.

For more information regarding the use of each Toolbox tool, see the PiXYZ documentation.

Stick to the rules in the PiXYZ Rule Engine

Unlike the Toolbox’s manual process, the Rule Engine enables an automated process of applying a set of Rules that determine the output of a model either during import or In-Editor automatically through user-defined preferences. Upon running a Rule, it is administered sequentially according to custom Rules.

Also, you can form a Rule in Unity and state what its function is and, when applied, it carries out the functions to a selected model. In this case, an IFC containing BIM data from Revit. For example, a Rule could replace the material of the model, replace the model, and even add to what is already there. Most importantly, this is all done with one click. Let’s walk through the steps below.

Using the Rule Engine

To create a new Rule Engine Set, either choose Create > PiXYZ > RuleEngine Rule Set

Or choose PiXYZ > Rule Engine > Create New Rule Set

Once a New Rule Set has been generated within a designated folder, clicking it will enable new Rules to be constructed within the Inspector. Clicking the Plus (+) icon produces the foundation for a Rule.

At the start of every Rule, you need to specify what is being included in the Rule. Click the Plus icon and select Get. There are three options:

  • All Game Objects: The Rule includes all GameObjects in the Scene (light emitters, cameras, etc).
  • Imported Models: The Rule incorporates all imported models in the Scene.
  • Latest Imported Model: The Rule includes the most recently imported model in the Scene.

The Rule can now be further expanded since the user has full access to the Toolbox Actions within the Rule. This facilitates a Unity Project to become the platform for real-time commercial architectural visualizations. Treated as a foundation project, Rules can be reused for varying models.

By utilizing preset naming conventions established in Autodesk Revit or BIM software packages, which sync up with Rules established within Unity, visualizations can be easily instated by running a Rule once.

Additionally, you can integrate a custom script into the PiXYZ Toolbox and use it within a Rule.

For a breakdown of each action for use within a Rule, see this PiXYZ documentation.

Import Settings Asset

In addition to generating a Rule Set, implementing an Import Settings Asset will provide a vast array of import preferences, all retained within an Asset. The Asset contains the same parameters found within the Import CAD window, excluding Post-Processing and the Preset selection box.

Both the Import Settings and Rule Assets can be used in two ways:

  • Either as the principal preset and Rule for the importing options when applied as the preset within the Import CAD window.
  • Or as the Preset and Rule for Resynchronization of the imported model when using Live Sync.

Playing by the Material Rules

Now that you have a firm grasp of the Rule Engine, let’s create a Rule that replaces imported materials with Unity Materials. Here are two ways of doing this.

Replace Material Rule #1

To create a New RuleEngine Rule Set, choose Create > PiXYZ > RuleEngine Rule Set.

Next, add a Start node to determine what is being influenced by the Rule. Click the Plus icon and select Get then:

All Game Objects

Or

Import Models

Or

Latest Imported Model

Within Autodesk Revit, naming conventions were established within the object’s Type Properties. The object’s Type name has been replaced with a custom name that exports into Unity as “/Reference” within the IFC.

Then, in order to access the relevant BIM data within the project, we need to filter through the data. Click the Plus icon, then select Filter > On Property.

Under Property Name, input the name of the data type you want to filter through. As mentioned in the “Handling the BIM metadata” section, the Type Properties, Type name has been replaced with a custom name in Autodesk Revit, which imports into Unity as “/Reference”.

Under Property Value, input the custom name or a word from the custom name that is unique to that type of object(s) in the project. For example, replacing the imported material for an interior window with a Unity material.

Due to the naming conventions established, “Interior-Window” is only present within the name of transparent windows within the model. This enables Interior_Window to be used as a Property value. The name used for this example is “Btn_02_Interior_Window_01”.

Now the Rule will filter through all the BIM data in the project, under the Property Name “Reference,” looking for any names containing “Interior_Window”.

Currently, this rule only locates the empty GameObjects within the hierarchy as they are storing the BIM data, so you need to then click the Plus icon and select Get > Children. Make sure to enable “Recursive,” as this will ensure all child meshes are included, no matter the quantity.

Finally, click the Plus icon and select Set > Material.

Set with a Unity Material by either clicking the Selection box button on the far right or by dragging a new Material into the box.

At the bottom of the Inspector, click Run to apply all Rules within the RuleEngine Rule Set.

Note: Rules are applied sequentially, from top to bottom.

This Rule was structured so it can be used for other processes than just to replace material. Now the Rule calls imported objects with defined BIM data types, and further Rules can be applied to extend the functions.

Replace Material Rule #2

Add a Start node to determine what is being influenced by the Rule.

Next, click the Plus icon, then select Modify > Switch Materials.

Extend Switch Materials by clicking the 3-dot icon in the far-right corner. A drop-down menu with multiple options for the Rule appears:

  • Add Selected Materials: Adds any materials that are currently selected in the Scene.
  • Fill With All Materials In Scene: Takes all materials currently in the Scene.

By choosing “Fill With All Materials In Scene,” the Rule Engine takes all the materials and deposits them in a table within the Rule. This results in an efficient means of replacing materials simply by placing Unity materials within the blank Selection boxes.

Finally, simply Run the resulting Rule to replace Materials within the Scene.

What’s on the horizon

So that was a detailed walkthrough of the updated PiXYZ features in 2018.3, including importing BIM data, setting the necessary parameters, covering Live Sync, Toolbox, Rule Engine, and finally, learning how to Replace Material Rules. We hope you enjoyed learning how to use the PiXYZ Plugin to import Revit data into Unity. This is the result of a very close collaboration between Unity and PiXYZ, in order to significantly improve the import process and save you a lot of time.

I’d like to remind you to watch the PiXYZ presentation from last year’s Unite Los Angeles, as it is a valuable walkthrough of the capabilities. Also, check out Mike Geig’s walkthrough of a Project that highlights how to import, perform spot corrections, and do a bit of post-processing.

Frequent readers of the Unity blog may also have noticed our previous post, which discusses the plan to import Revit directly into Unity. Check out our announcement during the AEC Keynote at Autodesk University, starting at minute 2:22. Stay tuned for more news on this exciting new feature coming later this year.

We’re always listening to customers, and encourage you to post your ideas and requests in the comment section below. Or, if you want to talk with us directly or get access to a trial version, please contact us. If you want to get started now, please visit our store to purchase PiXYZ.

Finally, check out my Twitter @KieranColenutt for ongoing Unity tips, tricks and future AEC content.

January 30, 2019 in Industry | 14 min. read

Is this article helpful for you?

Thank you for your feedback!