Section Views in Assemblies not placed at specified origin and will not move after
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am getting the wrong X position when I create a section view in an assembly. AND, afterwards, I am unable to adjust the location to attempt to correct the incorrect location. This section is meant to render a junction box and conduit intersection. Also, I have tried separating the create, setting of crop box, AND the attempt at adjusting the view into different transactions and assimilated under the same transaction group. This had no effect. I have also called doc.Regenerate() between operations.
The resulting X location is wrong (70.2467), when it was specified to be 70.024. This inaccuracy occurs at random amounts for other assemblies.
Here is my code for creating the section view (I surround the entire call in a TransactionGroup):
using var tx = new Transaction(overallView.Document);
tx.Start("Assembly JB Section Side View");
section = AssemblyViewUtils.CreateDetailSection(info.Model.ActiveAssemblyInstance.Document,info.Model.ActiveAssemblyInstance.Id, orientation);
doc.Regenerate();
tx.Commit();
using var tx2 = new Transaction(overallView.Document);
tx2.Start("Resize JB Section Side View");
section!.Name = info.Name;
//this crop box has the correct X position.
section.CropBox = crop;
section.CropBoxActive = true;
section.get_Parameter(BuiltInParameter.VIEWER_BOUND_OFFSET_FAR).Set(depthOffset);
section.get_Parameter(BuiltInParameter.VIEWER_BOUND_FAR_CLIPPING).Set(2);
tx2.Commit();
//this reports the incorrect X position
var loc1 = section.Origin;
//later (which seems to have no effect):
using var tx3 = new Transaction(overallView.Document);
tx3.Start("Adjust JB Section Side View");
var testMove = new XYZ(1, 1, 1);
ElementTransformUtils.MoveElement(doc, section.Id, testMove);
tx3.Commit();
Is this a bug in the Revit API?