08/06/2012

Transform nodes of a loaded model

I'm adding several models to the main model using Autodesk.Navisworks.Api.Application.MainDocument.AppendFile().

Now I would like to find the partition of a specific model and transform a node in it. I searched the attributes of the node but it did not contain any InwOaTransform. How can I add a transform attribute?

Solution

Model creation

Attribute transforms are only applied during model creation - apart from "File Units and Transform" that can also happen after model creation (this adds an InwOaTransform to the Partition.Attributes collection). Attribute transforms are the only transforms that can be applied during model creation.

Post model creation

The only way to apply additional transforms after model creation is via overrides. Either using the API or the GUI. At the moment using the API you can only set/reset the transform override but cannot access its current value.

Since you are using the .NET API, you might as well iterate through the Model's instead of the InwOaPartition's and then find the specific ModelItem you need. Then you can create a COM selection from that and use OverrideTransform to transform the specific node.

Comments

I'm adding several models to the main model using Autodesk.Navisworks.Api.Application.MainDocument.AppendFile().

Now I would like to find the partition of a specific model and transform a node in it. I searched the attributes of the node but it did not contain any InwOaTransform. How can I add a transform attribute?

Solution

Model creation

Attribute transforms are only applied during model creation - apart from "File Units and Transform" that can also happen after model creation (this adds an InwOaTransform to the Partition.Attributes collection). Attribute transforms are the only transforms that can be applied during model creation.

Post model creation

The only way to apply additional transforms after model creation is via overrides. Either using the API or the GUI. At the moment using the API you can only set/reset the transform override but cannot access its current value.

Since you are using the .NET API, you might as well iterate through the Model's instead of the InwOaPartition's and then find the specific ModelItem you need. Then you can create a COM selection from that and use OverrideTransform to transform the specific node.