By Adam Nagy
When you are inside an assembly then you can right-click on any of the components in the model tree and inside the iProperties dialog you can set their offset:
In the API you get/set that information through the Transformation matrix of the Occurrence. That has the component's position and alignment.
If you simply want to set all the offsets to zero and orient them the same way as the assembly then you just have to use an identity matrix (default of CreateMatrix()) as their Transformation.
This is what the code could look like in iLogic:
Dim doc As AssemblyDocument doc = ThisApplication.ActiveDocument Dim tr As TransientGeometry tr = ThisApplication.TransientGeometry Dim occ As ComponentOccurrence For Each occ In doc.ComponentDefinition.Occurrences ' If it's suppressed we cannot do ' anything with it If Not occ.Suppressed Then Call occ.SetTransformWithoutConstraints( _ tr.CreateMatrix()) occ.Grounded = True End If Next