Section Views in Assemblies not placed at specified origin and will not move after

Section Views in Assemblies not placed at specified origin and will not move after

darren.braynard2
Contributor Contributor
373 Views
2 Replies
Message 1 of 3

Section Views in Assemblies not placed at specified origin and will not move after

darren.braynard2
Contributor
Contributor

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.

 

 

darrenbraynard2_0-1731353902180.png

 

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?

0 Likes
374 Views
2 Replies
Replies (2)
Message 2 of 3

darren.braynard2
Contributor
Contributor

In addition, I am able to manipulate the Section View location by calling 

ElementTransformUtils.MoveElement(doc, section.Id, testMove);

 

from outside the transaction group.

0 Likes
Message 3 of 3

darren.braynard2
Contributor
Contributor

Note, a call to 

ElementTransformUtils.MoveElement()

only works from a completely different command. It has no effect if I run in merely a separate transaction. It has to be during a different command execution.  

0 Likes