<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to retrieve a Dimension's (segment) geometry ? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7152740#M57806</link>
    <description>&lt;P&gt;Dear Jonathan,&lt;BR /&gt; &lt;BR /&gt;Thank you for your confirmation and appreciation.&lt;BR /&gt; &lt;BR /&gt;Can you please provide a minimal sample model containing a macro to demonstrate how it all works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, an external add-in would also be useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For documentation purposes and to enable others to make use of this also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt; &lt;BR /&gt;Jeremy&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2017 18:09:24 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2017-06-14T18:09:24Z</dc:date>
    <item>
      <title>How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7145688#M57792</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to retrieve the geometry of a Dimension : for each Dimension's segment, I'd like to have start, end points and text position and direction. I'm able to obtain the text position and the text string by looping on segments array :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;foreach(DimensionSegment segment in dimension.Segments)
{
   //segment.TextPosition
   //segment.ValueString
}&lt;/PRE&gt;
&lt;P&gt;But, I don't understand how to obtain the segment's points and direction. I tried&amp;nbsp;&lt;EM&gt;get_geometry&lt;/EM&gt; and looping on references array, but no success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;foreach(Reference reference in dimension.References)
{
    reference.GlobalPoint; // ---&amp;gt; always null
}&lt;/PRE&gt;
&lt;P&gt;I don't find any samples.&lt;/P&gt;
&lt;P&gt;Any suggestion is welcomed.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:50:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7145688#M57792</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-12T13:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147027#M57793</link>
      <description>&lt;P&gt;Can you add an image to clarify exactly what you are after, and what dimension segment means? Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 20:47:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147027#M57793</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-12T20:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147625#M57794</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an image to clarify what I tried to explain :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revit_dimension_geometry.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/366440iD1B669871CEAD70C/image-size/large?v=v2&amp;amp;px=999" role="button" title="revit_dimension_geometry.png" alt="revit_dimension_geometry.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have a dimension with 3 parts. My goal is to obtain this :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Segment A : from point x to point y, text = "30" and text position = t1&lt;/LI&gt;
&lt;LI&gt;Segment B : from point y to point z, text = "2.695" and text position = t2&lt;/LI&gt;
&lt;LI&gt;Segment C : from point z to point w, text = "305" and text position = t3&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I wrote "segments" beacause API, I found the method "Dimension.Segments" :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;foreach(DimensionSegment segment in dimension.Segments)
{
   //segment.Origin : not the point I'm looking for
   //segment.LeaderEndPosition : not the point I'm looking for
   //segment.TextPosition : OK
   //segment.ValueString: OK
}&lt;/PRE&gt;
&lt;P&gt;I hope my question is now clearer.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 06:09:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147625#M57794</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-13T06:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147818#M57795</link>
      <description>&lt;P&gt;Dear Jonathan,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, that helps a lot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you looked at the Revit API help documentation on the Dimension class?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2017/210f88be-e3c5-26a4-7dd8-3296f6725cce.htm" target="_blank"&gt;http://www.revitapidocs.com/2017/210f88be-e3c5-26a4-7dd8-3296f6725cce.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doesn't the sample code presented there provide exactly what you are asking for via&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;dimension.Curve&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 07:49:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147818#M57795</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-13T07:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147871#M57796</link>
      <description>&lt;P&gt;Thank you for your reply. Before sending my post, I searched this forum and I looked in the API samples and your blog, but without success.&lt;/P&gt;
&lt;P&gt;In my example, the Dimension's is unbound : &lt;EM&gt;dimension.Curve.IsBound = false&lt;/EM&gt;; So I have, an infinite line defined by a point and a direction. Maybe I need to project anything on it ? Maybe I habe to look references ?&lt;/P&gt;
&lt;P&gt;I tried a lot of variants, but without success.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:07:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147871#M57796</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-13T08:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147887#M57797</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Jonathan,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for testing and reporting this. How weird. How useless.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Funnily enough, a colleague of mine apparently ran into this very same issue yesterday and raised a development team issue for it:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We have an existing change request number &lt;U&gt;&lt;STRONG&gt;REVIT-115341&lt;/STRONG&gt;&lt;/U&gt; [API Wish: Get end points of a linear dimension] for this issue, which will require exploration and possibly a modification to our software. Please make a note of this number for future reference. I have added a note of your request to this item in order to make the development team aware of its importance.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This issue is important to me. What can I do to help?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This issue needs to be assessed by our engineering team, and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;Impact on your application and/or your development.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;The number of users affected.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;The potential revenue impact to you.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;The potential revenue impact to Autodesk.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Realistic timescale over which a fix would help you.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You workaround ideas sounds eminently doable to me, e.g., use the ReferenceIntersector class to determine the appropriate element intersections and project them onto the unbounded dimension line. However, I do not see why this is required.&lt;BR /&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:25:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147887#M57797</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-13T08:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147934#M57798</link>
      <description>&lt;P&gt;Ok thank you for your answer. I will wait for a future API changes.&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:37:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7147934#M57798</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-13T08:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148001#M57799</link>
      <description>&lt;P&gt;while I agree that the API should provide the points of a DimensionLine, you can calculate them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;StringBuilder sb = new StringBuilder();				&lt;BR /&gt;Dimension dim = doc.GetElement(sel.GetElementIds().FirstOrDefault()) as Dimension;
				Line dimLine = dim.Curve as Line;
				if (dimLine==null) return;
				dimLine.MakeBound(0,1);
				XYZ pt1 = dimLine.GetEndPoint(0);
				XYZ pt2 = dimLine.GetEndPoint(1);
				XYZ direction = pt2.Subtract(pt1).Normalize();
				sb.AppendLine(string.Format("point1  {0}",pt1));
				if (dim.Segments.Size == 0)
				{
					pt2 = pt1.Add(direction.Multiply((double) dim.Value));
					sb.AppendLine(string.Format("point2  {0}",pt2)) ;
				}
				else
				{
				XYZ segmentPt0 = pt1;
				foreach( DimensionSegment seg in dim.Segments)
				{
					XYZ segmentPt1 = segmentPt0.Add(direction.Multiply((double) seg.Value));
					sb.AppendLine(string.Format("pt  {0},  value  {1}",segmentPt1,(double) seg.Value));
				    segmentPt0 =segmentPt1;
				}
				}
				TaskDialog.Show("debug",sb.ToString());
&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 09:18:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148001#M57799</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-13T09:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148290#M57800</link>
      <description>&lt;P&gt;sorry, I was too hasty.&amp;nbsp;my solution won't work, pt1 is not the starting Point of the DimensionLine;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 11:11:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148290#M57800</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-13T11:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148378#M57801</link>
      <description>&lt;P&gt;I am trying your solution and I also noticed that there is a position issue.&lt;/P&gt;
&lt;P&gt;Using the direction vector with the segment value is still a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few comments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Line line = dim.Curve as Line;

dimLine.MakeBound(0,1);
XYZ pt1 = dimLine.GetEndPoint(0); // ---&amp;gt; = line.Origin
XYZ pt2 = dimLine.GetEndPoint(1); // not needed
XYZ direction = pt2.Subtract(pt1).Normalize(); // ---&amp;gt; = line.Direction
&lt;/PRE&gt;
&lt;P&gt;Last thing:&lt;/P&gt;
&lt;PRE&gt;segment.Origin&lt;/PRE&gt;
&lt;P&gt;gives another point, but still not the correct position (start point).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dimensions in Revit API, is really not clear to me.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 11:42:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148378#M57801</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-13T11:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148531#M57802</link>
      <description>&lt;P&gt;I think that in most cases this will get the startpoint of the dimensrion&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;				XYZ dimStartPoint=null;
				XYZ pt1 = dimLine.GetEndPoint(0);
				XYZ pt2 = null;
				foreach (Reference ref1 in dim.References)
				{
					XYZ refPoint = null;;
					Element el = doc.GetElement(	ref1.ElementId);
					GeometryObject obj = el.GetGeometryObjectFromReference(ref1);
					if (obj==null) 
					{
						// element is Grid or ReferencePlane or ??
						ReferencePlane refPl = el as ReferencePlane;
						if (refPl!= null) refPoint = refPl.GetPlane().Origin;
						Grid _grid = el as Grid;
						if (_grid!= null) refPoint = _grid.Curve.GetEndPoint(0);
					}
					else
					{
						// reference to Line or Plane 
						// or Point?
						Line l = obj as Line;
						if (l!=null) refPoint = l.GetEndPoint(0);
						PlanarFace f = obj as PlanarFace;
						if (f!=null) refPoint = f.Origin;
					}
					if (refPoint!=null) 
					{
						Plane WorkPlane = doc.ActiveView.SketchPlane.GetPlane();
						XYZ normal = WorkPlane.Normal.Normalize();
						// project the "globalpoint" of the reference onto the sketchplane
						XYZ refPtonPlane = refPoint.Subtract(normal.Multiply(normal.DotProduct(refPoint-WorkPlane.Origin)));
						XYZ LineNormal = normal.CrossProduct(direction).Normalize();
						// project the result onto the dimensionLine
						dimStartPoint = refPtonPlane.Subtract(LineNormal.Multiply(LineNormal.DotProduct( refPtonPlane-pt1)));
					}
					break;
				}&lt;BR /&gt;				
&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 12:40:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148531#M57802</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-13T12:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148598#M57803</link>
      <description>&lt;P&gt;Perfect, thank you. You are faster than me &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;
&lt;P&gt;Last challenge is to obtain the two "pointing points" (in AutoCAD : xLinePoint1, xLinePoint2 and dimLinePoint).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="revit_dimension_dimline.png" style="width: 685px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/366625iC9C67778C08DF76E/image-size/large?v=v2&amp;amp;px=999" role="button" title="revit_dimension_dimline.png" alt="revit_dimension_dimline.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 13:02:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7148598#M57803</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-13T13:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7150185#M57804</link>
      <description>&lt;P&gt;I don't see a solution to your last question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS, I think the Origin of a segment is the MidPoint of that segment on the dimensionLine, so you can use the Origin of the first segment to find the startPoint of the dimension&amp;nbsp;&amp;nbsp;[ Origin.Subtract (direction.Multiply(segment.Value /2) ]&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 21:18:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7150185#M57804</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-13T21:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7150882#M57805</link>
      <description>&lt;P&gt;I'm looking to do something with property &lt;EM&gt;LeaderEndPosition&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I confirm that the segment's origin is the middle of the segment. So we don't need to iterate through references to fix point1.&lt;/P&gt;
&lt;P&gt;Once again, thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 06:15:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7150882#M57805</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2017-06-14T06:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7152740#M57806</link>
      <description>&lt;P&gt;Dear Jonathan,&lt;BR /&gt; &lt;BR /&gt;Thank you for your confirmation and appreciation.&lt;BR /&gt; &lt;BR /&gt;Can you please provide a minimal sample model containing a macro to demonstrate how it all works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, an external add-in would also be useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For documentation purposes and to enable others to make use of this also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt; &lt;BR /&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:09:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7152740#M57806</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-14T18:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7153221#M57807</link>
      <description>&lt;P&gt;Wouldn't it be safer to use the dim.View instead of doc.ActiveView?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 21:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7153221#M57807</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-14T21:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7153324#M57808</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i tested your code with a dimension spanning a sequence of three parallel walls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;running it, i see the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;`el` is a wall.&lt;/LI&gt;
&lt;LI&gt;`obj` is a valid geometry object, but neither a line nor a face, so the start point ends up remaining undefined.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how would you suggest handling this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;should i make use of `e'`? how?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the code is checked in to The Building Coder samples in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdGetDimensionPoints.cs" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdGetDimensionPoints.cs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;because the start point is undefined, the command currently prints out the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;pt  (6.285955083, -4.935853072, 0.000000000),  value  3.28083989501312
pt  (9.566794978, -4.935853072, 0.000000000),  value  3.28083989501312
Start at , points (3.01,-4.94,0),(6.29,-4.94,0),(9.57,-4.94,0).&lt;/PRE&gt;
&lt;P&gt;the start point before the comma is missing...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any idea?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 22:25:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7153324#M57808</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-14T22:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154037#M57809</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The obj is probably an Edge, so you need to adapt the code to get a Point from that Edge. In my testing I only considered Lines and PlanarFaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, as I said in a previous post, you can find the startPoint of the dimensionline using the Dimension.Origin or DimensionSegment.Origin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 08:15:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154037#M57809</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-15T08:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154439#M57810</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&amp;nbsp;thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i implemented it in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdGetDimensionPoints.cs" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdGetDimensionPoints.cs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The entire&amp;nbsp;code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    List&amp;lt;XYZ&amp;gt; GetDimensionPoints( Dimension dim )
    {
      Line dimLine = dim.Curve as Line;
      if( dimLine == null ) return null;
      List&amp;lt;XYZ&amp;gt; pts = new List&amp;lt;XYZ&amp;gt;();

      dimLine.MakeBound( 0, 1 );
      XYZ pt1 = dimLine.GetEndPoint( 0 );
      XYZ pt2 = dimLine.GetEndPoint( 1 );
      XYZ direction = pt2.Subtract( pt1 ).Normalize();
      pts.Add( pt1 );
      if( dim.Segments.Size == 0 )
      {
        pt2 = pt1.Add( direction.Multiply( (double) dim.Value ) );
        pts.Add( pt2 );
      }
      else
      {
        XYZ segmentPt0 = pt1;
        foreach( DimensionSegment seg in dim.Segments )
        {
          XYZ segmentPt1 = segmentPt0.Add( direction.Multiply( (double) seg.Value ) );
          Debug.Print( "pt  {0},  value  {1}", segmentPt1, (double) seg.Value );
          pts.Add( segmentPt1 );
          segmentPt0 = segmentPt1;
        }
      }
      return pts;
    }

    XYZ GetDimensionStartPointFirstAttempt(
      Dimension dim )
    {
      Document doc = dim.Document;

      Line dimLine = dim.Curve as Line;
      if( dimLine == null ) return null;
      dimLine.MakeBound( 0, 1 );

      XYZ dimStartPoint = null;
      XYZ pt1 = dimLine.GetEndPoint( 0 );

      // dim.Origin throws "Cannot access this method
      // if this dimension has more than one segment."
      //Debug.Assert( Util.IsEqual( pt1, dim.Origin ),
      //  "expected equal points" );

      foreach( Reference ref1 in dim.References )
      {
        XYZ refPoint = null;
        Element el = doc.GetElement( ref1.ElementId );
        GeometryObject obj = el.GetGeometryObjectFromReference(
          ref1 );

        if( obj == null )
        {
          // element is Grid or ReferencePlane or ??
          ReferencePlane refPl = el as ReferencePlane;
          if( refPl != null ) refPoint = refPl.GetPlane().Origin;
          Grid grid = el as Grid;
          if( grid != null ) refPoint = grid.Curve.GetEndPoint( 0 );
        }
        else
        {
          // reference to Line, Plane or Point?
          Line l = obj as Line;
          if( l != null ) refPoint = l.GetEndPoint( 0 );
          PlanarFace f = obj as PlanarFace;
          if( f != null ) refPoint = f.Origin;
        }

        if( refPoint != null )
        {
          //View v = doc.ActiveView;
          View v = dim.View;
          Plane WorkPlane = v.SketchPlane.GetPlane();
          XYZ normal = WorkPlane.Normal.Normalize();

          // Project the "globalpoint" of the reference onto the sketchplane

          XYZ refPtonPlane = refPoint.Subtract(
            normal.Multiply( normal.DotProduct(
              refPoint - WorkPlane.Origin ) ) );

          XYZ lineNormal = normal.CrossProduct(
            dimLine.Direction ).Normalize();

          // Project the result onto the dimensionLine

          dimStartPoint = refPtonPlane.Subtract(
            lineNormal.Multiply( lineNormal.DotProduct(
              refPtonPlane - pt1 ) ) );
        }
        break;
      }
      return dimStartPoint;
    }

    XYZ GetDimensionStartPoint(
      Dimension dim )
    {
      XYZ p = null;

      try
      {
        p = dim.Origin;
      }
      catch( Autodesk.Revit.Exceptions.ApplicationException ex )
      {
        Debug.Assert( ex.Message.Equals( "Cannot access this method if this dimension has more than one segment." ) );

        foreach( DimensionSegment seg in dim.Segments )
        {
          p = seg.Origin;
          break;
        }
      }
      return p;
    }

    public Result Execute(
      ExternalCommandData commandData,
      ref string message,
      ElementSet elements )
    {
      UIApplication uiapp = commandData.Application;
      UIDocument uidoc = uiapp.ActiveUIDocument;
      Document doc = uidoc.Document;
      Selection sel = uidoc.Selection;

      ISelectionFilter f
        = new JtElementsOfClassSelectionFilter&amp;lt;Dimension&amp;gt;();

      Reference elemRef = sel.PickObject(
        ObjectType.Element, f, "Pick a dimension" );

      Dimension dim = doc.GetElement( elemRef ) as Dimension;

      XYZ p = GetDimensionStartPoint( dim );
      List&amp;lt;XYZ&amp;gt; pts = GetDimensionPoints( dim );

      int n = pts.Count;

      Debug.Print( "Dimension origin at {0} followed "
        + "by {1} further point{2}{3} {4}",
        Util.PointString( p ), n,
        Util.PluralSuffix( n ), Util.DotOrColon( n ),
        string.Join( ", ", pts.Select(
          q =&amp;gt; Util.PointString( q ) ) ) );

      List&amp;lt;double&amp;gt; d = new List&amp;lt;double&amp;gt;( n );
      foreach( XYZ q in pts )
      {
        d.Add( q.X - p.X );
        p = q;
      }

      Debug.Print(
        "Horizontal distances in metres: "
        + string.Join( ", ", d.Select( x =&amp;gt;
          Util.RealString( Util.FootToMetre( x ) ) ) ) );

      return Result.Succeeded;
    }&lt;/PRE&gt;
&lt;P&gt;However, when running it in this scenario:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dimension three walls" style="width: 390px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/367606iF9580DEC635AE751/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-06-15 at 13.39.10.png" alt="Screen Shot 2017-06-15 at 13.39.10.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In that scenario, the current code prints:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dimension origin at (0.04,-4.94,0) followed by 3 further points: 
  (3.01,-4.94,0), (6.29,-4.94,0), (9.57,-4.94,0)

Horizontal distances in metres: 0.9, 1, 1&lt;/PRE&gt;
&lt;P&gt;I guess that means that the '3 further points' really are the dimension points of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is, what is the 'start point'?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it arbitrary?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, it seems best to simply ignore it...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 11:46:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154439#M57810</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-06-15T11:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a Dimension's (segment) geometry ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154496#M57811</link>
      <description>&lt;P&gt;the arbitrary point is the point pt1 in GetDimensionPoints&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest&lt;/P&gt;
&lt;PRE&gt;List&amp;lt;XYZ&amp;gt; GetDimensionPoints( Dimension dim )
    {
      Line dimLine = dim.Curve as Line;
      if( dimLine == null ) return null;
      List&amp;lt;XYZ&amp;gt; pts = new List&amp;lt;XYZ&amp;gt;();

      dimLine.MakeBound( 0, 1 );
      XYZ pt1 =  GetDimensionStartPoint( dim );
      XYZ pt2 = null;
      XYZ direction =  dimLine.Direction.Normalize();
      pts.Add( pt1 );

etc..&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 12:11:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-retrieve-a-dimension-s-segment-geometry/m-p/7154496#M57811</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-06-15T12:11:59Z</dc:date>
    </item>
  </channel>
</rss>

