
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a dimension line that measures the z-component of a sloped detail line. I can do this in Revit but cannot figure out how to do it with the API. I've used Revit Lookup to compare the differences in the dimension lines. The ReferenceArray is the same but the main difference seems to be the Curve property which I'm assuming is set with the Line property when I call NewDimension(Section, Line, ReferenceArray).
Here is my code:
XYZ point3 = new XYZ(417.8, 80.228, 46.8); XYZ point4 = new XYZ(417.8, 80.811, 46.3); Line geomLine3 = Line.CreateBound(point3, point4); Plane geomPlane = new Plane(XYZ.BasisX, XYZ.Zero); using (Transaction tx = new Transaction(doc)) { tx.Start("tx"); SketchPlane sketch = SketchPlane.Create(doc, geomPlane); DetailLine line3 = doc.Create.NewDetailCurve(viewSection, geomLine3) as DetailLine; ReferenceArray refArray = new ReferenceArray(); refArray.Append(line3.GeometryCurve.GetEndPointReference(0)); refArray.Append(line3.GeometryCurve.GetEndPointReference(1)); XYZ dimPoint1 = new XYZ(417.8, 80.118, 46.8); XYZ dimPoint2 = new XYZ(417.8, 80.118, 46.3); Line dimLine3 = Line.CreateBound(dimPoint1, dimPoint2); Dimension dim = doc.Create.NewDimension(viewSection, dimLine3, refArray); tx.Commit(); }
The line I'm sending into NewDimension is along the z-axis, but the dimension line I'm given is sloped parallel to the detail line and gives the length of the detail line when I want just the z-component. Using Revit Lookup I see the Curve Direction has a y- and z-component for Direction (0, 0.759, -0.651). When I create the line I want in Revit itself the Curve has a Direction of (0, 0, 1) and gives just the length of the z-component of the sloped detail line.
Attached is an image of the section with the sloped detail line at the bottom right. It shows the dimension I create with the API (labeled with length of 0' - 9 7/32") and the one I create in Revit that I want to create with the API (labeled as 0' - 6").
Thank you for any help on this problem.
Solved! Go to Solution.