<?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 use the Alignment method Using # for family Instance in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938454#M12235</link>
    <description>&lt;P&gt;Hi Jeremy .&amp;nbsp;&lt;BR /&gt;Thanks a&amp;nbsp; lot for introducing this method for me .&amp;nbsp; I am trying to align the family instance called newPile to the model Curve however I am getting this error under :&lt;BR /&gt;&lt;STRONG&gt;Autodesk.Revit.Exceptions.ArgumentException: 'The two references are not geometrically aligned so the Alignment cannot be created.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Parameter name: reference2'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have created both the model Curve and the familyinstance in the same level.&lt;BR /&gt;&lt;BR /&gt;This is the code that I am using :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Create a list of curves&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;List&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Floor floor in tunnelFloors.Floors)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Sketch sketch = doc.GetElement(floor.SketchId) as Sketch;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (CurveArray curveArray in sketch.Profile)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curveArray)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p0 = (new XYZ(curve.GetEndPoint(0).X, curve.GetEndPoint(0).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = (new XYZ(curve.GetEndPoint(1).X, curve.GetEndPoint(1).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve c1 = Line.CreateBound(p0, p1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(c1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curves)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ModelCurve m1 = doc.Create.NewModelCurve(curve, sketchPlane);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Move the family instance along the curve by the distance variable&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;double length = curve.Length;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;int count = (int)(length / x);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;for (int j = 1; j &amp;lt;= count; j++)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ point = curve.Evaluate((double)j * x / length, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FamilyInstance newPile = doc.Create.NewFamilyInstance(point, symbol, Level, structuralType);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Reference s= newPile.GetReferenceByName("SS");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the reference plane named "SS" from the family instance&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;//uidoc.Selection.PickObject(ObjectType.PointOnElement);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Dimension alignToLine3 = doc.Create.NewAlignment(viewPlan, m1.GeometryCurve.Reference, s);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 11:21:21 GMT</pubDate>
    <dc:creator>ahmadkhalaf7892</dc:creator>
    <dc:date>2023-05-03T11:21:21Z</dc:date>
    <item>
      <title>How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938054#M12233</link>
      <description>&lt;P&gt;Hi Guys .&lt;BR /&gt;I Need to align a FamilyInstance in which I created using C# to a Line that I also Created Via C# in Revit 2023. For example the First Picture would show a structural column and a ModelCurve which are not aligned together.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Not Aligned.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209818i47BA94085507E05D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Not Aligned.PNG" alt="Not Aligned.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; The second picture would Show How I want my column to be aligned to a ModelCurve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Aligned.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1209819i5D1942EDA0634850/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Aligned.PNG" alt="Aligned.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would greatly apricate if someone can show me just the method of how can I use the alignment method in C# . Here is just a sample code for my script :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Line line = Line.CreateBound(startPoint, endPoint);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Element newPile = doc.Create.NewFamilyInstance(point, symbol, Level, structuralType);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 07:38:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938054#M12233</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-05-03T07:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938215#M12234</link>
      <description>&lt;P&gt;Well, first of all you need to understand how to implement such a constraint manually in the end user interface. I believe you define a dimension between the two objects to do so, and constrain it to a zero distance. The Family API samples may demonstrate how such a constraint can be set up programmatically:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2009/08/the-revit-family-api.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2009/08/the-revit-family-api.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading that myself, I discover that the &lt;U&gt;NewAlignment&lt;/U&gt; method might come in handy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/b3c10008-aba6-9eee-99c9-7e05ace75796.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/b3c10008-aba6-9eee-99c9-7e05ace75796.htm&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Searching this forum for&amp;nbsp;&lt;U&gt;NewAlignment&lt;/U&gt;&amp;nbsp;ought to turn up something useful for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 09:16:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938215#M12234</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-03T09:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938454#M12235</link>
      <description>&lt;P&gt;Hi Jeremy .&amp;nbsp;&lt;BR /&gt;Thanks a&amp;nbsp; lot for introducing this method for me .&amp;nbsp; I am trying to align the family instance called newPile to the model Curve however I am getting this error under :&lt;BR /&gt;&lt;STRONG&gt;Autodesk.Revit.Exceptions.ArgumentException: 'The two references are not geometrically aligned so the Alignment cannot be created.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Parameter name: reference2'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have created both the model Curve and the familyinstance in the same level.&lt;BR /&gt;&lt;BR /&gt;This is the code that I am using :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Create a list of curves&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;List&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Floor floor in tunnelFloors.Floors)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Sketch sketch = doc.GetElement(floor.SketchId) as Sketch;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (CurveArray curveArray in sketch.Profile)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curveArray)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p0 = (new XYZ(curve.GetEndPoint(0).X, curve.GetEndPoint(0).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = (new XYZ(curve.GetEndPoint(1).X, curve.GetEndPoint(1).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve c1 = Line.CreateBound(p0, p1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(c1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curves)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ModelCurve m1 = doc.Create.NewModelCurve(curve, sketchPlane);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Move the family instance along the curve by the distance variable&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;double length = curve.Length;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;int count = (int)(length / x);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;for (int j = 1; j &amp;lt;= count; j++)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ point = curve.Evaluate((double)j * x / length, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FamilyInstance newPile = doc.Create.NewFamilyInstance(point, symbol, Level, structuralType);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Reference s= newPile.GetReferenceByName("SS");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the reference plane named "SS" from the family instance&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;//uidoc.Selection.PickObject(ObjectType.PointOnElement);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Dimension alignToLine3 = doc.Create.NewAlignment(viewPlan, m1.GeometryCurve.Reference, s);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 11:21:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938454#M12235</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-05-03T11:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938574#M12236</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;here is the full constructor in case needed :&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;using System;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using System.Collections.Generic;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using System.Linq;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using System.Text;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using System.Threading.Tasks;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using Autodesk.Revit.DB;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using Autodesk.Revit.DB.Structure;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using Autodesk.Revit.UI;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using Autodesk.Revit.UI.Selection;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;using Document = Autodesk.Revit.DB.Document;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;namespace Tunnel&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;public class SheetPile&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;double meters = 3.28084;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;public SheetPile(Document doc, double x, String PileName, Level Level, TunnelFloors tunnelFloors)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Options options = new Options();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Plane plane = Plane.CreateByNormalAndOrigin(new XYZ(0, 0, 1), new XYZ(0, 0, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;SketchPlane sketchPlane = SketchPlane.Create(doc, plane);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Create a new view plan for Level 1&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the floor plan view family type&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;ViewFamilyType viewFamilyType = new FilteredElementCollector(doc)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.OfClass(typeof(ViewFamilyType))&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.Cast&amp;lt;ViewFamilyType&amp;gt;()&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.FirstOrDefault(v =&amp;gt; v.ViewFamily == ViewFamily.StructuralPlan);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Create a new view plan for Level 1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ViewPlan viewPlan = ViewPlan.Create(doc, viewFamilyType.Id, Level.Id);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Convert input values from feet to meters&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;x = x * meters;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Define the family symbol and structural type&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FamilySymbol symbol = new FilteredElementCollector(doc)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.OfClass(typeof(FamilySymbol))&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.OfCategory(BuiltInCategory.OST_StructuralColumns)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;.FirstOrDefault(e =&amp;gt; e.Name == PileName) as FamilySymbol;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;StructuralType structuralType = StructuralType.Column;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Create a list of curves&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;List&amp;lt;Curve&amp;gt; curves = new List&amp;lt;Curve&amp;gt;();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Floor floor in tunnelFloors.Floors)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Sketch sketch = doc.GetElement(floor.SketchId) as Sketch;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (CurveArray curveArray in sketch.Profile)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curveArray)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p0 = (new XYZ(curve.GetEndPoint(0).X, curve.GetEndPoint(0).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ p1 = (new XYZ(curve.GetEndPoint(1).X, curve.GetEndPoint(1).Y, 0));&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Curve c1 = Line.CreateBound(p0, p1);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;curves.Add(curve);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;foreach (Curve curve in curves)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ModelCurve m1 = doc.Create.NewModelCurve(curve, sketchPlane);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Move the family instance along the curve by the distance variable&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;double length = curve.Length;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;int count = (int)(length / x);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;for (int j = 1; j &amp;lt;= count; j++)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;XYZ point = curve.Evaluate((double)j * x / length, true);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;FamilyInstance newPile = doc.Create.NewFamilyInstance(point, symbol, Level, structuralType);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;newPile.LookupParameter("Top Level").Set("Level 2");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Reference s = newPile.GetReferenceByName("SS");&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the reference plane named "SS" from the family instance&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;//uidoc.Selection.PickObject(ObjectType.PointOnElement);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;doc.Create.NewAlignment(viewPlan, s, curve.Reference);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 12:14:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938574#M12236</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-05-03T12:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938608#M12237</link>
      <description>&lt;P&gt;Did you read the remarks in the Revit API docs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/b3c10008-aba6-9eee-99c9-7e05ace75796.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/b3c10008-aba6-9eee-99c9-7e05ace75796.htm&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;nbsp;These references must be already geometrically aligned (this function will not force them to become aligned).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 12:26:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938608#M12237</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-03T12:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938617#M12238</link>
      <description>Ah Sorry , I have been working on this for hours . I'm loosing my concentration , I didn't pay attention to it .&lt;BR /&gt;Is there any way I can force Them to be aligned using the Revit API?&lt;BR /&gt;I have been trying for the past 4 hours. If it is a dead end please inform me .&lt;BR /&gt;Thanks very much.</description>
      <pubDate>Wed, 03 May 2023 12:29:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938617#M12238</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-05-03T12:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938633#M12239</link>
      <description>&lt;P&gt;Take a rest! Go for a walk!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest way to ensure they are aligned is to create them accordingly in the first place, if they are being generated from scratch. Otherwise, you can use the standard translation and rotation functionality provided by ElementTransformUtils. Or, you can set the location curve via the Location property.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 12:36:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938633#M12239</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-03T12:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938653#M12240</link>
      <description>I will rest for a few then see which approach fits better. I am using a family which is already loaded in the Project and I am placing them on a line with a specific distance . However I want them to rotate according to the Curve or Line they are placed on. I haven't been able to do such thing. I will see what I can do .&lt;BR /&gt;I should use the ElementTransformUtils.Rotate in this case ?&lt;BR /&gt;I really appreciate the help Jeremy</description>
      <pubDate>Wed, 03 May 2023 12:43:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938653#M12240</guid>
      <dc:creator>ahmadkhalaf7892</dc:creator>
      <dc:date>2023-05-03T12:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938667#M12241</link>
      <description>&lt;P&gt;Either&amp;nbsp;&lt;SPAN&gt;ElementTransformUtils.Rotate or just manipulate the LocationPoint or LocationCurve via Rotate, e.g.:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/e1071a1b-b98e-5875-2e13-b673e2b9fef6.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/e1071a1b-b98e-5875-2e13-b673e2b9fef6.htm&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://www.revitapidocs.com/2023/ed4de043-9a60-f6cd-c09b-b13c4612b343.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/ed4de043-9a60-f6cd-c09b-b13c4612b343.htm&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Enjoy your break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 12:47:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11938667#M12241</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-03T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the Alignment method Using # for family Instance</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11969411#M12242</link>
      <description>&lt;P&gt;Thank you for this chat. I hope you got it sorted now and are well rested and satisfied. I shared our conversation on the blog for future reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#4" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 07:29:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-use-the-alignment-method-using-for-family-instance/m-p/11969411#M12242</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-17T07:29:34Z</dc:date>
    </item>
  </channel>
</rss>

