<?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 Direction of Reference (Reference Plane or Reference Line) in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7074163#M58523</link>
    <description>&lt;PRE&gt;FamilyInstance familyInstance = element as FamilyInstance;

IList&amp;lt;Reference&amp;gt; familyInstanceReferences = familyInstance.GetReferences(FamilyInstanceReferenceType.StrongReference);

foreach (Reference familyInstanceReference in familyInstanceReferences)
{
// I want to get direction of reference
}&lt;/PRE&gt;
&lt;P&gt;Hello friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 2018 version i can get the reference in familyinstance directly.&lt;/P&gt;
&lt;P&gt;But i want to get the direction of references(reference planes or reference lines)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can i achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Line line&amp;nbsp;= doc.GetElement(reference).GetGeometryObjectFromReference(reference) as Line;&lt;/PRE&gt;
&lt;P&gt;didnt work for me.&lt;/P&gt;
&lt;P&gt;Thanks in advance...&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2017 11:30:11 GMT</pubDate>
    <dc:creator>desdinova</dc:creator>
    <dc:date>2017-05-10T11:30:11Z</dc:date>
    <item>
      <title>Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7074163#M58523</link>
      <description>&lt;PRE&gt;FamilyInstance familyInstance = element as FamilyInstance;

IList&amp;lt;Reference&amp;gt; familyInstanceReferences = familyInstance.GetReferences(FamilyInstanceReferenceType.StrongReference);

foreach (Reference familyInstanceReference in familyInstanceReferences)
{
// I want to get direction of reference
}&lt;/PRE&gt;
&lt;P&gt;Hello friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 2018 version i can get the reference in familyinstance directly.&lt;/P&gt;
&lt;P&gt;But i want to get the direction of references(reference planes or reference lines)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can i achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Line line&amp;nbsp;= doc.GetElement(reference).GetGeometryObjectFromReference(reference) as Line;&lt;/PRE&gt;
&lt;P&gt;didnt work for me.&lt;/P&gt;
&lt;P&gt;Thanks in advance...&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 11:30:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7074163#M58523</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-05-10T11:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7075321#M58524</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;//Have you tried to get the location and acquire the line from there. 
LocationCurve loc = doc.GetElement(ref).Location as LocationCurve;
XYZ Frst = loc.Curve.GetEndPoint(0);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Ibrahim Naeem&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 18:35:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7075321#M58524</guid>
      <dc:creator>IbrahimNaeem</dc:creator>
      <dc:date>2017-05-10T18:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7075682#M58525</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;I tried.&lt;/P&gt;
&lt;P&gt;it didnt work&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 20:55:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7075682#M58525</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-05-10T20:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7078468#M58526</link>
      <description>&lt;P&gt;Are you sure that these family instances are created as line based &amp;nbsp;?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Ibrahim Naeem&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 20:09:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7078468#M58526</guid>
      <dc:creator>IbrahimNaeem</dc:creator>
      <dc:date>2017-05-11T20:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7080105#M58527</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="e5d6be01-6241-4fb5-a184-fac30804dc07" class="myscreencast-iframe iframe-container active-myscreencast"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/e5d6be01-6241-4fb5-a184-fac30804dc07" width="640" height="590" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;I think&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;there is no need to use line based family&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;my code is&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;
&lt;PRE&gt;try
            {
                Line dimensionLine = null;

                ReferenceArray firstArray = new ReferenceArray();

                FamilyInstance familyInstance = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as FamilyInstance;

                XYZ point = uidoc.Selection.PickPoint("Select first point");

                XYZ difference = new XYZ(200, 0, 0);

                dimensionLine = DimensionUtils.CreateLine(doc, point, difference);

                IList&amp;lt;Reference&amp;gt; familyInstanceReferences = familyInstance.GetReferences(FamilyInstanceReferenceType.StrongReference);

                foreach (Reference familyInstanceReference in familyInstanceReferences)
                {
                    firstArray.Append(familyInstanceReference);
                }

                using (Transaction t = new Transaction(doc, "Add Dimension"))
                {
                    t.Start();
                    Dimension dimension = doc.Create.NewDimension(doc.ActiveView, dimensionLine, firstArray);
                    t.Commit();
                }
            }

            catch(Exception ex)
            {
                TaskDialog.Show("Error", ex.Message);
            }&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV class="myscreencast-iframe iframe-container active-myscreencast"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 May 2017 13:38:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7080105#M58527</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-05-12T13:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7094254#M58528</link>
      <description>&lt;P&gt;I think&amp;nbsp;an adepted version of my answer to&amp;nbsp;the discussion on&amp;nbsp;a&amp;nbsp;&amp;nbsp;&lt;FONT size="2"&gt;Dimension on Hatch Pattern Slab &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/dimension-on-hatch-pattern-slab/m-p/7079252#M22790" target="_self"&gt;https://forums.autodesk.com/t5/revit-api-forum/dimension-on-hatch-pattern-slab/m-p/7079252#M22790&lt;/A&gt; will work for you.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Here's my code&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;FONT size="3"&gt;        public XYZ GetReferenceDirection(Reference ref1, Document doc)
        // returns the direction perpendicular to reference
        // returns XYZ.Zero on error;
        {
            XYZ res = XYZ.Zero;
            XYZ workPlaneNormal = doc.ActiveView.SketchPlane.GetPlane().Normal;
            if (ref1.ElementId == ElementId.InvalidElementId) return res;
            Element elem = doc.GetElement(ref1.ElementId);
            if (elem == null) return res;
            if (ref1.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_SURFACE || ref1.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_LINEAR)
            {
                // make a dimension to a point for direction

                XYZ bEnd = new XYZ(10, 10, 10);
                ReferenceArray refArr = new ReferenceArray();
                refArr.Append(ref1);
                Dimension dim = null;
                using (Transaction t = new Transaction(doc, "test"))
                {
                    t.Start();
                    using (SubTransaction st = new SubTransaction(doc))
                    {
                        st.Start();
                        ReferencePlane refPlane = doc.Create.NewReferencePlane(XYZ.Zero, bEnd, bEnd.CrossProduct(XYZ.BasisZ).Normalize(), doc.ActiveView);
                        ModelCurve mc = doc.Create.NewModelCurve(Line.CreateBound(XYZ.Zero, new XYZ(10, 10, 10)), SketchPlane.Create(doc, refPlane.Id));
                        refArr.Append(mc.GeometryCurve.GetEndPointReference(0));
                        dim = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, new XYZ(10, 0, 0)), refArr);
                        ElementTransformUtils.MoveElement(doc, dim.Id, new XYZ(0, 0.1, 0));
                        st.Commit();
                    }
                    if (dim != null)
                    {
                        Curve cv = dim.Curve;
                        cv.MakeBound(0, 1);
                        XYZ pt1 = cv.GetEndPoint(0);
                        XYZ pt2 = cv.GetEndPoint(1);
                        res = pt2.Subtract(pt1).Normalize();
                    }
                    t.RollBack();
                }
            }
            return res;
        }
&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 22:48:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7094254#M58528</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-05-18T22:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7095111#M58529</link>
      <description>&lt;P&gt;Thank you FAIR59,&lt;/P&gt;
&lt;P&gt;It is working...&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 10:50:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7095111#M58529</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-05-19T10:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7224682#M58530</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Did you modify FAIR59's code or are using the posted version? I am trying to get the direction of the reference but FAIR59's version returns the direction perpendicular direction whilst I am looking for the direction itself (parallel).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 05:57:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7224682#M58530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T05:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7240300#M58531</link>
      <description>&lt;P&gt;I use FAIR59's code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for check the direction, i use this&lt;/P&gt;
&lt;PRE&gt; FamilyInstance familyInstance = element as FamilyInstance;

                            IList&amp;lt;Reference&amp;gt; familyInstanceReferences = familyInstance.GetReferences(FamilyInstanceReferenceType.StrongReference);

                            foreach (Reference familyInstanceReference in familyInstanceReferences)
                            {
                                if (DimensionUtils.GetReferenceDirection(doc, familyInstanceReference).ToString() == XYZ.BasisX.ToString() ||
                                   DimensionUtils.GetReferenceDirection(doc, familyInstanceReference).ToString() == XYZ.BasisX.Negate().ToString())
                                {
                                    firstArray.Append(familyInstanceReference);
                                }
                            }&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2017 21:58:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7240300#M58531</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2017-07-19T21:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7538330#M58532</link>
      <description>&lt;P&gt;Hi FAIR59,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code is returning the perpendicular direction perfectly, but can this be modified to return the parallel direction? I am trying tot modify this but I am stuck at the moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 07:46:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7538330#M58532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-13T07:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7540728#M58533</link>
      <description>&lt;P&gt;to get a 90 degree different direction, you need to establish the plane in which to "rotate".&lt;/P&gt;
&lt;P&gt;The most obvious plane is off course the sketch plane of the view.&lt;/P&gt;
&lt;P&gt;the normal&amp;nbsp;for that plane is: doc.ActiveView.ViewDirection&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return res;&lt;/P&gt;
&lt;P&gt;use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return doc.ActiveView.ViewDirection.CrossProduct(res);&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:05:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7540728#M58533</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-11-13T22:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7541471#M58534</link>
      <description>That easy huh :). Will give it a shot.&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Nov 2017 06:15:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7541471#M58534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-14T06:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7880691#M58535</link>
      <description>&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Sat, 24 Mar 2018 04:20:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/7880691#M58535</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-24T04:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8127480#M58536</link>
      <description>&lt;P&gt;Hey &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt; this code does seem to work well for returning the normal of the reference plane, provided that the reference plane is oriented vertically. But this doesn't seem to work if your reference plane is horizontal. I've looked through it, and I think I somewhat understand how your function is working (somewhat.), but I can't figure out how it could be adapted to truly work in any direction. I suspect it's not possible based on the fact that you're having to use a dimension created in this view, however, I was wondering if you had any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 23:57:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8127480#M58536</guid>
      <dc:creator>mastjaso</dc:creator>
      <dc:date>2018-07-12T23:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8130697#M58537</link>
      <description>&lt;P&gt;The function makes the temporary dimension in the active view. If the active view is a planview, then yes only the vertical planes will be found.&lt;/P&gt;&lt;P&gt;To make the function more general, you could loop through all the views in the document, in the hope of finding a&amp;nbsp;view that gives a result.&amp;nbsp;( no garanties )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IEnumerable&amp;lt;View&amp;gt; views = new FilteredElementCollector(doc)
				.OfClass(typeof(View));
foreach(View v in views)
{
	if (v.IsTemplate) continue;
	XYZ rightdirection = v.RightDirection;
	dim = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, rightdirection.Multiply(10)), refArr);
	if (dim!=null) break;
}
if (dim !=null)
{
     ElementTransformUtils.MoveElement(doc, dim.Id, new XYZ(0, 0.1, 0));
    .....
}&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Jul 2018 22:12:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8130697#M58537</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2018-07-14T22:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8965098#M58538</link>
      <description>&lt;P&gt;Hi desdinova!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to achieve exactly what you wanted to do: get the direction of references in a FamilyInstance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't seem to find the&lt;/P&gt;&lt;PRE&gt;DimensionUtils&lt;/PRE&gt;&lt;P&gt;class in the API.&amp;nbsp;Is this a custom class? If so, can you point me to the right direction on what class or method should I be searching for to get the direction of a reference?&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;Paolo&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 08:25:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8965098#M58538</guid>
      <dc:creator>paolomod3nese</dc:creator>
      <dc:date>2019-08-14T08:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8966505#M58539</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Paolo,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yes it is a custom class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can use&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;public static XYZ GetReferenceDirection(Document doc, Reference reference)
        {
            XYZ res = XYZ.Zero;
            XYZ workPlaneNormal = doc.ActiveView.SketchPlane.GetPlane().Normal;
            if (reference.ElementId == ElementId.InvalidElementId)
            {
                return res;
            }

            Element elem = doc.GetElement(reference.ElementId);
            if (elem == null)
            {
                return res;
            }
            if (reference.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_SURFACE || reference.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_LINEAR)
            {
                XYZ bEnd = new XYZ(10, 10, 10);
                ReferenceArray refArr = new ReferenceArray();
                refArr.Append(reference);
                Dimension dim = null;
                using (Transaction t = new Transaction(doc, "test"))
                {
                    t.Start();
                    using (SubTransaction st = new SubTransaction(doc))
                    {
                        st.Start();
                        ReferencePlane refPlane = doc.Create.NewReferencePlane(XYZ.Zero, bEnd, bEnd.CrossProduct(XYZ.BasisZ).Normalize(), doc.ActiveView);
                        ModelCurve mc = doc.Create.NewModelCurve(Line.CreateBound(XYZ.Zero, new XYZ(10, 10, 10)), SketchPlane.Create(doc, refPlane.Id));
                        refArr.Append(mc.GeometryCurve.GetEndPointReference(0));
                        dim = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, new XYZ(10, 0, 0)), refArr);
                        ElementTransformUtils.MoveElement(doc, dim.Id, new XYZ(0, 0.1, 0));
                        st.Commit();
                    }
                    if (dim != null)
                    {
                        Curve cv = dim.Curve;
                        cv.MakeBound(0, 1);
                        XYZ pt1 = cv.GetEndPoint(0);
                        XYZ pt2 = cv.GetEndPoint(1);
                        res = pt2.Subtract(pt1).Normalize();
                    }
                    t.RollBack();
                }
            }
            return res;
        }&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;It works for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 18:51:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/8966505#M58539</guid>
      <dc:creator>desdinova</dc:creator>
      <dc:date>2019-08-14T18:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Direction of Reference (Reference Plane or Reference Line)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/13034949#M58540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2083518"&gt;@FAIR59&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer + the code you are providing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It isn't altogether clear (to me) what you are doing (and why) in certain parts of your code?&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 08:56:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/direction-of-reference-reference-plane-or-reference-line/m-p/13034949#M58540</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2024-09-21T08:56:37Z</dc:date>
    </item>
  </channel>
</rss>

