Message 1 of 5

Not applicable
10-03-2018
12:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
We were trying to copy a dimension from a view in a document to same view in other document using `ElementTransformUtils.CopyElements` API, and the dimension that we are trying to copy is between two walls. However after copying, we see that the dimension is getting snapped to a different side of the wall. And we also observed this issue while manually copying the dimension through Revit UI. Please find below image to get better understanding
Source dimension
Dimension after copying
Please find the code that we used:
public void CopyDimensions(Document sourceDocument, Document destinationDocument, Transaction transaction) { var dimensions = new FilteredElementCollector(sourceDocument) .OfClass(typeof(Dimension)) .Cast<Dimension>().ToList(); foreach (var dimension in dimensions) { if (!dimension.ViewSpecific) continue; var targetView = GetViewWithName(destinationDocument, dimension.View.Name); var transform = Transform.CreateTranslation(new XYZ(0, 0, 0)); var copyPasteOptions = GetDefaultCopyPasteOptions(); transaction.Start(); ElementTransformUtils.CopyElements(dimension.View, dimension.Id, targetView, transform, copyPasteOptions); transaction.Commit(_failureHandlingOptions); } }
Thank you!
Solved! Go to Solution.