<?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: Use of Align function programatically to change the alignment of Tiles for floor in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/11252999#M67953</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.dim, create referencePlane can work fine in 3d view&lt;/P&gt;&lt;P&gt;but!&lt;/P&gt;&lt;PRE&gt; XYZ direction = (_dimension.Curve as Line).Direction;&lt;/PRE&gt;&lt;P&gt;this direction may not first gridLine to his offset gridLine, it may also the oppside.if it happend,item2 and item3 are not couple! the referencePlane is not aligned with reference of hatch line!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.NewAlignment() in 3d view don't work well,Create a section view for the wall.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2022 04:13:49 GMT</pubDate>
    <dc:creator>gls_whdev8</dc:creator>
    <dc:date>2022-06-23T04:13:49Z</dc:date>
    <item>
      <title>Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6008184#M67935</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;&lt;BR /&gt;(Revit Arch)&lt;BR /&gt;&lt;BR /&gt;I have used Ceiling Tile 600 x 600 as a material for&amp;nbsp; Structure for Floor.&lt;BR /&gt;&lt;BR /&gt;We can change the alignment by using Revit Command (Modify | Floors -&amp;gt; Align option&lt;BR /&gt;&lt;BR /&gt;Is there any way to do this activity programatically ?&lt;BR /&gt;&lt;BR /&gt;Where is the alignement property for floor&amp;nbsp;stored?&lt;BR /&gt;&lt;BR /&gt;Is there any way to extract the present value of alignment and change it programatically (GET and SET property)&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your kind support&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rajesh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 06:29:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6008184#M67935</guid>
      <dc:creator>MehtaRajesh</dc:creator>
      <dc:date>2016-01-27T06:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016653#M67936</link>
      <description>Dear MehtaRajesh,&lt;BR /&gt;&lt;BR /&gt;do you mean you want to align floor with some level or grid?&lt;BR /&gt;you can do that via API:&lt;BR /&gt;1. first move the floor to the correct position (exact position after alignment IMPORTANT!) by calling ElementTransformUtils.MoveElement(s)&lt;BR /&gt;2. align the floor with the target by calling Document.Create.NewAlignment method</description>
      <pubDate>Mon, 01 Feb 2016 03:56:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016653#M67936</guid>
      <dc:creator>Aaron.Lu</dc:creator>
      <dc:date>2016-02-01T03:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016857#M67937</link>
      <description>&lt;P&gt;Hi Aaron,&lt;BR /&gt;&lt;BR /&gt;We need to align surface Pattern (At present it is 600 x 600 square) of floor such a way to minimize the wastage of tiles and need to make sure that the size of each tile area should be more than 50 % of the complete tile as far as possible.&lt;/P&gt;&lt;P&gt;At presently we are able to do it by using&amp;nbsp; "Revit Command (Modify | Floors -&amp;gt; Align option"&lt;BR /&gt;&lt;BR /&gt;We are in process to automate this task.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rajesh&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 08:48:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016857#M67937</guid>
      <dc:creator>MehtaRajesh</dc:creator>
      <dc:date>2016-02-01T08:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016874#M67938</link>
      <description>Sorry, I'm not Revit experts, would you please give me more context on this?&lt;BR /&gt;like how to accomplish your task in UI: select floor &amp;gt; click Align &amp;gt; then ....&lt;BR /&gt;&lt;BR /&gt;and also would you please provide some example rvt file?&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Feb 2016 09:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6016874#M67938</guid>
      <dc:creator>Aaron.Lu</dc:creator>
      <dc:date>2016-02-01T09:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6019144#M67939</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The manual process is as under,&lt;BR /&gt;Data -&amp;nbsp;Square floor family&amp;nbsp;having (Property - Construction -&amp;gt; Structure - &amp;gt;&amp;nbsp; Finish1 -&amp;gt; Material (Ceiling Tile 600 x 600&amp;nbsp;))&lt;BR /&gt;&lt;BR /&gt;Input&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;___________________ A&lt;BR /&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 300&lt;/P&gt;&lt;P&gt;|________ |_________| B&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;|&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 600&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;|_________|________ |&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;|________ |_________|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 300&lt;BR /&gt;&lt;BR /&gt;Step 1: Select Floor&lt;BR /&gt;Step 2:&amp;nbsp; Under menu Modify | Floor --&amp;gt; Select Align (AL) Button&lt;BR /&gt;&lt;BR /&gt;Step 2.1:&lt;BR /&gt;&lt;BR /&gt;Prompt: Please select line or point reference for alignment:&lt;BR /&gt;Select &lt;STRONG&gt;A&lt;/STRONG&gt; horizontal line&lt;BR /&gt;&lt;BR /&gt;Step 2.2:&lt;BR /&gt;&lt;BR /&gt;Prompt: Please select an entity to align (it will move into alignment with)&lt;BR /&gt;Select &lt;STRONG&gt;B&lt;/STRONG&gt; horizontal line&lt;BR /&gt;&lt;BR /&gt;Output: Tiles are properly aligned&lt;/P&gt;&lt;P&gt;__________________&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 600&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;|&amp;nbsp;________|_________|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 600&lt;/P&gt;&lt;P&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;/P&gt;&lt;P&gt;|_________|________|&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 10:07:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6019144#M67939</guid>
      <dc:creator>MehtaRajesh</dc:creator>
      <dc:date>2016-02-02T10:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6019457#M67940</link>
      <description>&lt;P&gt;Dear Mehta rajesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can functionally align two elements in revit through API programming. &amp;nbsp;if and only if these are geometrically aligned. API function not forced to Align . For more details you can view this post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/aec/2014/12/revitapi-align-2-pipes-through-center-lines.html" target="_self"&gt;http://adndevblog.typepad.com/aec/2014/12/revitapi-align-2-pipes-through-center-lines.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of alignment of two pipes. You can view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As i know, you can chose NewfamilyInstance option for better placement. for more detail if you share me an example rvt file then i will look on this once.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:06:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6019457#M67940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-02T13:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6021178#M67941</link>
      <description>&lt;P&gt;Hi Manish,&lt;/P&gt;&lt;P&gt;Rajesh is not looking to align elements. He wants to align the floor surface pattern (hatch) such that one of the hatch lines is aligned with the edge of the floor object. Imagine large floor tiles in you bathroom; the pattern starts (aligns) with at least one, probably two walls. This is manually possible in&amp;nbsp;Revit by selecting the align tool, then one of the hatch cross lines, and aligning with the edge of the floor slab object. I cannot find anything in Snoop to indicate the geometry/location/origin of the surface pattern. This is a very good question. Regards, Dale.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 06:32:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6021178#M67941</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2016-02-03T06:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6021496#M67942</link>
      <description>&lt;P&gt;Tnx Dale,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are absolutely right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i try&amp;nbsp;to&amp;nbsp;give information&amp;nbsp;about&amp;nbsp;&lt;SPAN&gt;Document.Create.NewAlignment() method in API.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Manish&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 11:19:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6021496#M67942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-03T11:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6025530#M67943</link>
      <description>Thanks, unfortunately the is no such API yet, so I've logged a wish: &lt;BR /&gt;CF-3928 - case 11459435: API ability to align floor hatch line with floor's edge</description>
      <pubDate>Fri, 05 Feb 2016 08:10:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6025530#M67943</guid>
      <dc:creator>Aaron.Lu</dc:creator>
      <dc:date>2016-02-05T08:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6344817#M67944</link>
      <description>&lt;P&gt;Any word on when this API access will be added?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 20:18:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6344817#M67944</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-23T20:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6349931#M67945</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Chris,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query, both here and in your own subsequent thread&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;&lt;A href="http://forums.autodesk.com/t5/revit-api/api-access-to-surface-pattern-alignment/m-p/6344811" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/api-access-to-surface-pattern-alignment/m-p/6344811&lt;/A&gt;&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;I cannot say when the wish list item &lt;U&gt;&lt;STRONG&gt;CF-3928&lt;/STRONG&gt;&lt;/U&gt; [case 11459435: API ability to align floor hatch line with floor's edge] will be addressed.&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;Please submit a business case to help underline its importance, as I suggested in my answer to your new thread.&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!&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;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 07:56:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/6349931#M67945</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-05-26T07:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7340842#M67946</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any update on this wish?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We work on large floor plans and automating the Ceiling Tile set out&amp;nbsp;would be of great benefit to us.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Mehdi&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 02:17:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7340842#M67946</guid>
      <dc:creator>mehdi.blanchard</dc:creator>
      <dc:date>2017-08-31T02:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7350967#M67947</link>
      <description>&lt;P&gt;The references to the hatch-lines are available via the API, see &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/dimension-on-hatch-pattern-slab/m-p/7078368#M22785" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/dimension-on-hatch-pattern-slab/m-p/7078368#M22785&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With those references you can move the lines indirectly, by aligning them to a reference plane and moving that plane.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here's&amp;nbsp;my test-code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;			Element elem = doc.GetElement(sel.GetElementIds().FirstOrDefault());
			Floor floor = elem as Floor;
		    Reference r = HostObjectUtils.GetTopFaces(floor).FirstOrDefault();
		    PlanarFace face = elem.GetGeometryObjectFromReference(r) as PlanarFace;
		    XYZ corner = null;
		    foreach( Curve cv in face.GetEdgesAsCurveLoops().FirstOrDefault())
		    {
		    	corner = cv.GetEndPoint(0);
		    	break;
		    }
		    var HatchLines = AnalyzeHatch(elem,r);
			sb.AppendLine ("elem  "+ elem.Id);
			sb.AppendLine();
			using (TransactionGroup tg = new TransactionGroup(doc,"align2RefPlane"))
			{
				tg.Start();
				foreach (var HLine in HatchLines)
			    {
					ReferencePlane pl = null;
					using (Transaction t = new Transaction(doc,"CreateRefPlane"))
					{
						t.Start();
						pl = doc.Create.NewReferencePlane(HLine.Item3.Add(HLine.Item4.Multiply(3)),HLine.Item3,face.FaceNormal.Multiply(3),doc.ActiveView);
						pl.Name = string.Format("{0}_{1}","ref", Guid.NewGuid());
						t.Commit();
					}
					string stableRef = string.Format("{0}:0:{1}",pl.UniqueId,"SURFACE");
					Reference ref2Plane = Reference.ParseFromStableRepresentation(doc,stableRef);
					using (Transaction t = new Transaction(doc,"align2RefPlane"))
					{
						t.Start();
						doc.Create.NewAlignment(doc.ActiveView,ref2Plane,HLine.Item2);
						t.Commit();
					}
					using (Transaction t = new Transaction(doc,"MovePlane"))
					{
						t.Start();
						XYZ translation = HLine.Item3.Subtract(corner);
						ElementTransformUtils.MoveElement(doc,pl.Id,translation);
						t.Commit();
					}
			    }
				tg.Assimilate();
			}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with the helpermethod:&lt;/P&gt;
&lt;PRE&gt;	/// &amp;lt;summary&amp;gt;
	/// Analyse the hatch
	/// &amp;lt;/summary&amp;gt;
	/// &amp;lt;param name="elem"&amp;gt;An element with surface hatch.&amp;lt;/param&amp;gt;
	/// &amp;lt;param name="hatchface"&amp;gt;The reference to the face to analyse.&amp;lt;/param&amp;gt;
	/// &amp;lt;returns&amp;gt;Returns:
	///  foreach hatchline in hatchpattern	
	///  item1 = index of hatchline in hatchpattern
	///  item2 = reference to the hatchline
	///  item3 = point on hatchline
	///  item4 = direction of hatchline.&amp;lt;/returns&amp;gt;
		List&amp;lt;Tuple&amp;lt;int,Reference,XYZ,XYZ&amp;gt;&amp;gt; AnalyzeHatch(Element elem, Reference hatchface)
		{
			//check for model surfacepattern
			List&amp;lt;Tuple&amp;lt;int,Reference,XYZ,XYZ&amp;gt;&amp;gt; res = new List&amp;lt;Tuple&amp;lt;int,Reference,XYZ,XYZ&amp;gt;&amp;gt;();
			Document doc = elem.Document;
			PlanarFace face = elem.GetGeometryObjectFromReference(hatchface) as PlanarFace;
            Material mat = doc.GetElement(face.MaterialElementId) as Material;
            FillPatternElement patterntype = doc.GetElement(mat.SurfacePatternId) as FillPatternElement;
            if (patterntype== null)    return  res;
            FillPattern pattern =  patterntype.GetFillPattern();
            if (pattern.IsSolidFill || pattern.Target == FillPatternTarget.Drafting) return res;            

            
			// get number of gridLines in pattern                
			int _gridCount = pattern.GridCount;

			// construct StableRepresentations and find the Reference to HatchLines
            string StableRef = hatchface.ConvertToStableRepresentation(doc);
            using ( Transaction t = new Transaction(doc,"analyse hatch"))
			{
            	if (!doc.IsModifiable)
            	{
            		t.Start();
            	}
            	
            	for (int hatchindex =0; hatchindex&amp;lt;_gridCount; hatchindex++)
            	{
            		ReferenceArray _resArr = new ReferenceArray();
            		for (int ip = 0; ip &amp;lt; 2; ip++)
                	{
            			int index = (hatchindex+1) + (ip * _gridCount *2);
                	    string StableHatchString = StableRef + string.Format("/{0}", index);
                	    Reference HatchRef = null;
                	    try
                	    {
                	        HatchRef = Reference.ParseFromStableRepresentation(doc, StableHatchString);
                	    }
                	    catch
                	    { }
                	    if (HatchRef == null) continue;
                	    _resArr.Append(HatchRef);
                	}
					// 2 or more References =&amp;gt; create dimension
                	if (_resArr.Size&amp;gt;1)
                	{
                	    using (SubTransaction st = new SubTransaction(doc))
                	    {
                	        st.Start();
                	        Dimension _dimension = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, new XYZ(10, 0, 0)), _resArr);
							// move dimension a tiny amount to orient the dimension perpendicular to the hatchlines
							// I can't say why it works, but it does.
                	        ElementTransformUtils.MoveElement(doc, _dimension.Id, new XYZ(.1, 0, 0));

                	        Reference r1 = _dimension.References.get_Item(0);
                	        XYZ direction =( _dimension.Curve as Line).Direction;
                	        XYZ hatchDirection = direction.CrossProduct(face.FaceNormal).Normalize();
                	        XYZ origin = _dimension.Origin.Subtract(direction.Multiply((double) _dimension.Value/2)) ;
                	        res.Add ( new Tuple&amp;lt;int,Reference,XYZ,XYZ&amp;gt;(hatchindex,r1,origin,hatchDirection));
                	        st.RollBack();
                	    }
                	}
            	}
			}
            return res;
		}
&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Sep 2017 20:27:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7350967#M67947</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-09-03T20:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7351593#M67948</link>
      <description>&lt;P&gt;Hi Fair59, That is significant work to publish, thank you very much. I haven't tested yet but will endeavour to do so over the next while. Kind regards, Dale&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 04:47:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/7351593#M67948</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-09-04T04:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for f</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9235565#M67949</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed to do alignments on a series of walls, so created a Python solution in Dynamo with the help of Alban de&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;Chasteigner the link is here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;&lt;A href="https://forum.dynamobim.com/t/align-surface-patterns-to-wall-edge/44646/5?u=mark.ackerley" target="_blank"&gt;https://forum.dynamobim.com/t/align-surface-patterns-to-wall-edge/44646/5?u=mark.ackerley&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;The bulk of (Alban's) work is this...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#thanks to Alban de Chasteigner (Genius Loci) and Fair59
import clr
import sys

pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

import string

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# toProtoType etc.
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
from System import Guid

walls = UnwrapElement(IN[0])
refPlanesWall = UnwrapElement(IN[1])
indexRefs = IN[2]

refDimensions = []
for wall, refPlanes, indexes in zip(walls, refPlanesWall, indexRefs ):
	#get the external face reference of the wall as an array
	extFaceRefList = HostObjectUtils.GetSideFaces(wall,ShellLayerType.Exterior)
	#for (the array containing) the external face reference, get it's geometry
	for extFaceRef in extFaceRefList:
		extFace = wall.GetGeometryObjectFromReference(extFaceRef)
		#get the external face surface edges as lines, get the first line (the bottom)
		for	bottomEdgeCurve in extFace.GetEdgesAsCurveLoops()[0]:
			#get the finish point of the line
			corner = bottomEdgeCurve.GetEndPoint(1)
		#Check for model surfacepattern
		material = doc.GetElement(extFace.MaterialElementId)
		patterntype = doc.GetElement(material.SurfacePatternId)
		pattern = patterntype.GetFillPattern()
		#Get number of gridLines in pattern                
		gridCount = pattern.GridCount		
		#Construct StableRepresentation to top face reference
		stableRef = extFaceRef.ConvertToStableRepresentation(doc)
		
		#we want horizontal and vertical refs so we want 2 arrays
		refList = []
		refAll = []
		for hatchindex in range(0, gridCount):
			refAr = ReferenceArray()
			ip=0
			while ip&amp;lt;2:
				#generate an index for each hatch reference
				index = (hatchindex+1) + (ip * gridCount *2)
				#create a string for each hatch reference using the face reference and hatch index
				stableHatchString = stableRef + str.Format("/{0}", index)
				#generate a new reference for each hatch reference using the string
				HatchRef = Reference.ParseFromStableRepresentation(doc, stableHatchString)
				#the hatch reference is both 
				refAr.Append(HatchRef)
				ip += 1
			#refList contains arrays, each containing a pair of references
			#we only want 2 arrays, a horizontal and a vertical
			refAll.append(refAr)
		#we use the index we returned from the reference plane to
		#determine the index we need of the references... there aren't
		#any properties or methods of the reference to determine orientation
		for i in indexes:	
			refList.append(refAll[i])

	#for each wall, we run each refPlane against each reference, 1 hor, 1 vert
	for refAr, refPlane in zip(refList, refPlanes):
		#start a transaction
		TransactionManager.Instance.EnsureInTransaction(doc)
		refDim = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, XYZ(10, 0, 0)), refAr)		
		ElementTransformUtils.MoveElement(doc, refDim.Id, XYZ(.1, 0, 0))			
		r1 = refDim.References.get_Item(0)
		direction = refDim.Curve.Direction
		hatchDirection = direction.CrossProduct(extFace.FaceNormal).Normalize()
		origin = refDim.Origin.Subtract(direction.Multiply(refDim.Value/2))
		#end transaction
		TransactionManager.Instance.TransactionTaskDone()
		
		stableRef = str.Format("{0}:0:{1}",refPlane.UniqueId,"SURFACE")
		ref2Plane = Reference.ParseFromStableRepresentation(doc,stableRef)
		
		#start a transaction
		TransactionManager.Instance.EnsureInTransaction(doc)
		doc.Create.NewAlignment(doc.ActiveView,ref2Plane,r1)
		#end transaction
		TransactionManager.Instance.TransactionTaskDone()
		
		#start a transaction
		TransactionManager.Instance.EnsureInTransaction(doc)
		translation = origin.Subtract(corner)
		ElementTransformUtils.MoveElement(doc,refPlane.Id,-translation)
		#end transaction
		TransactionManager.Instance.TransactionTaskDone()
		
		refDimensions.append(refDim)

#we don't need the dimensions or reference planes any more
#start a transaction		 
TransactionManager.Instance.EnsureInTransaction(doc)
for refDim in refDimensions:
	doc.Delete(refDim.Id)
for refPlanes in refPlanesWall:
	for refPlanes in refPlanes:
		doc.Delete(refPlanes.Id)
#finish transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = walls&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Align Wall Material.gif" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/714054iCCF1ABF464015263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Align Wall Material.gif" alt="Align Wall Material.gif" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;Hopefully that's of interest,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="first username"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 15:05:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9235565#M67949</guid>
      <dc:creator>Mark.Ackerley</dc:creator>
      <dc:date>2020-01-07T15:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9965127#M67950</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thanks for the amazing work here!&lt;/P&gt;&lt;P&gt;I'm trying to use it in the context of ceilings, and it is not working.&lt;/P&gt;&lt;P&gt;This is what my ceiling looks like in Revit:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="noamgatCXBC7_0-1609146760817.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/860402i2F83D185093DF6FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="noamgatCXBC7_0-1609146760817.png" alt="noamgatCXBC7_0-1609146760817.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to&lt;/P&gt;&lt;P&gt;1) Get a pointer to the ceiling object&lt;/P&gt;&lt;P&gt;2) Get the top face of it and try to analyse:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var topFaces = HostObjectUtils.GetTopFaces(c);
var top = topFaces[0];
var analysis = AnalyzeHatch(c, top);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the line&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            FillPatternElement patterntype = doc.GetElement(mat.SurfaceForegroundPatternId) as FillPatternElement;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;of AnalyseHatch() returns null, and therefore an empty result is returned. What can I do to use this with ceilings?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 09:15:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9965127#M67950</guid>
      <dc:creator>noamgatCXBC7</dc:creator>
      <dc:date>2020-12-28T09:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9971605#M67951</link>
      <description>&lt;P&gt;For ceilings, I found I had to get the hatch pattern from the bottom face. You can check out my Python code that is used to align ceiling grids with light fixtures at the link below, but here's a brief excerpt that might help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[ceiling_down_face] = HostObjectUtils.GetBottomFaces(ceiling)
face = ceiling.GetGeometryObjectFromReference(ceiling_down_face)

// ...

try:
    material = doc.GetElement(face.MaterialElementId)
    pattern = doc.GetElement(material.SurfacePatternId).GetFillPattern()
except (AttributeError, InvalidOperationException):
    failed.append(ceiling)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/zachcmathews/pyRevitBoost/blob/f89bd147eb8eafa81601304e0251c6c4627817d9/pyRevitBoost.extension/pyRevitBoost.tab/Architectural.panel/AlignCeilings.pushbutton/script.py#L151" target="_blank" rel="noopener"&gt;https://github.com/zachcmathews/pyRevitBoost/blob/f89bd147eb8eafa81601304e0251c6c4627817d9/pyRevitBoost.extension/pyRevitBoost.tab/Architectural.panel/AlignCeilings.pushbutton/script.py#L151&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Zachary Mathews&lt;/P&gt;&lt;P&gt;Maintainer of &lt;A href="https://github.com/zachcmathews/pyRevitBoost" target="_blank" rel="noopener"&gt;pyRevitBoost&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Electrical Designer I &amp;amp; BIM Manager Intern&lt;/P&gt;&lt;P&gt;Southern A&amp;amp;E, LLC&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 21:03:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/9971605#M67951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-31T21:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/10758467#M67952</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have been playing around with Fair59 hack for a while but got stuck. What I&amp;nbsp; am trying to achieve is:&lt;/P&gt;&lt;P&gt;- make method possible to use in 3d and for wall different wall orientation&lt;/P&gt;&lt;P&gt;- adjust hatches on side faces of the wall especially on openings&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first objective seems to be accomplished. I am able to create ref planes from 3d view. The other however seems more tricky.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, when I got the face from the opening even if it is painted it is returning Category Material (id 24) obviously no hatch pattern so no further action. I did a small workaround and set the category parameter to be one with hatch. In this case, I am able to create ref planes for those faces. Unfortunately, I can't align those references with hatch ref down the road. Please help I run out of ideas on how to approach it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The snippet got quite long but it should work pasted into command. All utilities included in the region.&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;LI-CODE lang="general"&gt;    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]

    public class WallHatch : IExternalCommand
    {
        #region Command
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements
        )
        {
            var uiapp = commandData?.Application;
            var uidoc = uiapp?.ActiveUIDocument;
            var app = uiapp?.Application;
            var doc = uidoc?.Document;

            List&amp;lt;Tuple&amp;lt;int, Reference, XYZ, XYZ&amp;gt;&amp;gt; res = new List&amp;lt;Tuple&amp;lt;int, Reference, XYZ, XYZ&amp;gt;&amp;gt;();

            Selection _selection = uidoc.Selection;
            ICollection&amp;lt;ElementId&amp;gt; selIds = _selection.GetElementIds();
            List&amp;lt;Element&amp;gt; elems = new List&amp;lt;Element&amp;gt;();
            foreach (var id in selIds)
            {
                elems.Add(doc.GetElement(id));
            }

            List&amp;lt;PlanarFace&amp;gt; wallFaces = GetSideFaces(elems[0] as Wall);
            var WallHatchLine = AnalyzeWallHatch(doc,wallFaces);
            List&amp;lt;PlanarFace&amp;gt; WallFront = GetWallMainFaces(elems[0], ShellLayerType.Exterior);                  
            XYZ corner = GetPointAtCorner(WallFront.FirstOrDefault());

            try
            {
                using (TransactionGroup tg = new TransactionGroup(doc, "align2RefPlane"))
                {
                    tg.Start();
                    foreach (var HLine in WallHatchLine)
                    {
                      ReferencePlane pl = null;
                        //Ctreate Ref Plane from Hatch
                        using (Transaction t = new Transaction(doc, "CreateRefPlane"))
                        {
                            t.Start();
                            pl = doc.Create.NewReferencePlane(HLine.Item3.Add(HLine.Item4.Multiply(3)), HLine.Item3, HLine.Item5.Multiply(3), doc.ActiveView);
                            pl.Name = string.Format("{0}_{1}", "ref", Guid.NewGuid());
                            t.Commit();
                        }
                        
                        //Align Ref Plane to Hatch Ref
                        string stableRef = string.Format("{0}:0:{1}", pl.UniqueId, "SURFACE");
                        Reference ref2Plane = Reference.ParseFromStableRepresentation(doc, stableRef);
                        using (Transaction t = new Transaction(doc, "align2RefPlane"))
                        {
                            t.Start();
                            doc.Create.NewAlignment(doc.ActiveView, ref2Plane, HLine.Item2);
                            t.Commit();
                        }

                        //Move Hatch
                        using (Transaction t = new Transaction(doc, "MovePlane"))
                        {
                            t.Start();
                            XYZ translation = HLine.Item3.Subtract(corner);
                           ElementTransformUtils.MoveElement(doc, pl.Id, translation);
                            t.Commit();
                        }               
                    }
                    tg.Assimilate();
                }
                    return Result.Succeeded;
                }
                catch (System.Exception e)
                    return Result.Failed;
                }
         }

        #endregion Command


        #region Utils

        /// &amp;lt;summary&amp;gt;
        /// Get Side  Faces of the wall
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="wall"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;

        /// &amp;lt;summary&amp;gt;
        /// Analyse the hatch
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="elem"&amp;gt;An element with surface hatch.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="hatchface"&amp;gt;The reference to the face to analyse.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;Returns:
        ///  foreach hatchline in hatchpattern	
        ///  item1 = index of hatchline in hatchpattern
        ///  item2 = reference to the hatchline
        ///  item3 = point on hatchline
        ///  item4 = direction of hatchline.&amp;lt;/returns&amp;gt;
        ///  item5 = face normal
		
		//added item5 for debug reasons
        List&amp;lt;Tuple&amp;lt;int, Reference, XYZ, XYZ, XYZ&amp;gt;&amp;gt; AnalyzeWallHatch(Document doc, List&amp;lt;PlanarFace&amp;gt; wallFaces) {
            List&amp;lt;Tuple&amp;lt;int, Reference, XYZ, XYZ, XYZ&amp;gt;&amp;gt; res = new List&amp;lt;Tuple&amp;lt;int, Reference, XYZ, XYZ, XYZ&amp;gt;&amp;gt;();
            List&amp;lt;XYZ&amp;gt; faceCorners = new List&amp;lt;XYZ&amp;gt;();

            foreach (PlanarFace face in wallFaces)
            {
                Material mat = doc.GetElement(face.MaterialElementId) as Material;

                    //In no hatch pattern assgined
                    FillPatternElement patterntype = doc.GetElement(mat.SurfaceForegroundPatternId) as FillPatternElement;
                    if (patterntype == null) continue;
                    FillPattern pattern = patterntype.GetFillPattern();
               //     if (pattern.IsSolidFill || pattern.Target == FillPatternTarget.Drafting) continue;
                 
                    // get number of gridLines in pattern    
                    // grid count indicated no of direction in hatch pattern
                    // null - no hatch, 1 one direction (vertical or horizontal), 2 two directions , 3 directions
                    int _gridCount = pattern.GridCount;
                    // construct StableRepresentations and find the Reference to face - info for further hack
                    string StableRef = face.Reference.ConvertToStableRepresentation(doc);

                using (var transaction = new Transaction(doc, "Wall align hatch"))
                {
                    if (!doc.IsModifiable)
                    {
                        transaction.Start();
                    }
                        //Get Reff arrays from hatch directions indicates line of the hatch
                        for (int hatchDirectionIndex = 0; hatchDirectionIndex &amp;lt; _gridCount; hatchDirectionIndex++)
                        {
                            ReferenceArray _resArr = new ReferenceArray();
                            for (int ip = 0; ip &amp;lt; 2; ip++)
                            {
                                int index = (hatchDirectionIndex + 1) + (ip * _gridCount * 2);
                                //Merege string reperenetation of hatch to get hatch line reference from face hatch
                                string StableHatchString = StableRef + string.Format("/{0}", index);
                                Reference HatchRef = null;
                                try
                                {
                                    HatchRef = Reference.ParseFromStableRepresentation(doc, StableHatchString);
                                }
                                catch
                                { }
                                if (HatchRef == null) continue;
                                _resArr.Append(HatchRef);
                            }
                            // 2 or more References =&amp;gt; create dimension
                            if (_resArr.Size &amp;gt; 1)
                            {
                                using (SubTransaction st = new SubTransaction(doc))
                                {
                                    //setup sketch plane to be face
                                    st.Start();

                                    SketchPlane skpPln = SketchPlane.Create(doc, face.Reference);
                                    doc.ActiveView.SketchPlane = skpPln;
                                    XYZ othercorner = GetPointAtOpositeCorner(face);

                                    Curve LowestEdge = GetLowestEdge(face);

XYZ dirvec = LowestEdge.GetEndPoint(1).Subtract(LowestEdge.GetEndPoint(0));

//Modified dimension line to be lower edge of the face
                                      Dimension _dimension = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(LowestEdge.GetEndPoint(0), LowestEdge.GetEndPoint(1)), _resArr);


//seems not working in 3d view
// move dimension a tiny amount to orient the dimension perpendicular to the hatchlines
// I can't say why it works, but it does.
//ElementTransformUtils.MoveElement(doc, _dimension.Id, new XYZ(.1, 0, 0));
// ElementTransformUtils.MoveElement(doc, _dimension.Id, dirvec.Normalize()*20);

                                Reference r1 = _dimension.References.get_Item(0);
                                    XYZ direction = (_dimension.Curve as Line).Direction;
                                    XYZ hatchDirection = direction.CrossProduct(face.FaceNormal).Normalize();
                                    XYZ origin = _dimension.Origin.Subtract(direction.Multiply((double)_dimension.Value / 2));
                                    res.Add(new Tuple&amp;lt;int, Reference, XYZ, XYZ, XYZ&amp;gt;(hatchDirectionIndex, r1, origin, hatchDirection, face.FaceNormal));
                                    //st.RollBack();
                                    st.Commit();
                                }
                        }
                    }
                   transaction.Commit();
                }
            }
            return res;
        }

        public static List&amp;lt;PlanarFace&amp;gt; GetWallMainFaces(Element elem, ShellLayerType faceside = ShellLayerType.Exterior)
        {
            List&amp;lt;PlanarFace&amp;gt; wallFaces = new List&amp;lt;PlanarFace&amp;gt;();
            Wall wall = elem as Wall;
            IList&amp;lt;Reference&amp;gt; rs = HostObjectUtils.GetSideFaces(wall, faceside);
            foreach (Reference r in rs)
            {
                wallFaces.Add(elem.GetGeometryObjectFromReference(r) as PlanarFace);

            }
            return wallFaces;
        }

        public static List&amp;lt;PlanarFace&amp;gt; GetSideFaces(Wall wall)
        {

            List&amp;lt;PlanarFace&amp;gt; lineAngl = new List&amp;lt;PlanarFace&amp;gt;();
            LocationCurve locationCurve = wall.Location as LocationCurve;
            Line line = locationCurve.Curve as Line;

            XYZ locVector = line.Direction;
            List&amp;lt;PlanarFace&amp;gt; wallfaces = GetFaces(wall);

            foreach (PlanarFace f in wallfaces)
            {
                XYZ faceNorm = f.ComputeNormal(new UV(0.5, 0.5));
                if (IsParallel(locVector, faceNorm) == true)
                {
                    lineAngl.Add(f);
                }
            }
            return lineAngl;
        }

        public static List&amp;lt;PlanarFace&amp;gt; GetFaces(Wall wall)
        {
            List&amp;lt;PlanarFace&amp;gt; faclst = new List&amp;lt;PlanarFace&amp;gt;();
            Options opt = new Options();
            opt.ComputeReferences = true;
            opt.DetailLevel = ViewDetailLevel.Fine;
            opt.IncludeNonVisibleObjects = true;
            GeometryElement geomElem = wall.get_Geometry(opt);
            foreach (GeometryObject geomObj in geomElem)
            {
                Solid geomSolid = geomObj as Solid;
                if (null != geomSolid)
                {
                    int faces = 0;
                    double totalArea = 0;
                    foreach (PlanarFace geomFace in geomSolid.Faces)
                    {
                        faclst.Add(geomFace);
                    }
                }
            }
            return faclst;
        }

        const double _eps = 1.0e-9;
        public static bool IsParallel(XYZ a, XYZ b)
        {
            double angle = a.AngleTo(b);
            return _eps &amp;gt; angle || System.Math.Abs(angle - System.Math.PI) &amp;lt; _eps;
        }

        public static XYZ GetPointAtCorner(PlanarFace face)
        {
            XYZ corner = null;
            foreach (Curve cv in face.GetEdgesAsCurveLoops().FirstOrDefault())
            {
                corner = cv.GetEndPoint(0);
                break;
            }
            return corner;
        }

        public static XYZ GetPointAtOpositeCorner(PlanarFace face)
        {
            XYZ corner = null;
            foreach (Curve cv in face.GetEdgesAsCurveLoops().FirstOrDefault())
            {
                corner = cv.GetEndPoint(1);
                break;
            }
            return corner;
        }

        public static Curve GetLowestEdge(PlanarFace face)
        {
            XYZ corner = null;
            double midmin = xxx-xxxxxxxx;
            Curve lowEdge = null;
            foreach (Curve cv in face.GetEdgesAsCurveLoops().FirstOrDefault())
            {
                XYZ midpoint = (cv.GetEndPoint(0) + cv.GetEndPoint(1)) / 2;
                if (midpoint.Z &amp;lt; midmin)
                {
                    midmin = midpoint.Z;
                    lowEdge = cv;
                }
            }
            return lowEdge;
        }
    }
}&lt;/LI-CODE&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>Mon, 15 Nov 2021 17:15:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/10758467#M67952</guid>
      <dc:creator>konradzaremba</dc:creator>
      <dc:date>2021-11-15T17:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/11252999#M67953</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.dim, create referencePlane can work fine in 3d view&lt;/P&gt;&lt;P&gt;but!&lt;/P&gt;&lt;PRE&gt; XYZ direction = (_dimension.Curve as Line).Direction;&lt;/PRE&gt;&lt;P&gt;this direction may not first gridLine to his offset gridLine, it may also the oppside.if it happend,item2 and item3 are not couple! the referencePlane is not aligned with reference of hatch line!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.NewAlignment() in 3d view don't work well,Create a section view for the wall.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 04:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/11252999#M67953</guid>
      <dc:creator>gls_whdev8</dc:creator>
      <dc:date>2022-06-23T04:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Align function programatically to change the alignment of Tiles for floor</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/11657200#M67954</link>
      <description>&lt;P&gt;no official API yet for model hatch pattern?&lt;/P&gt;&lt;P&gt;we have similar case -&amp;gt; align model hatch pattern lines in 2 curtain panels in same curtain wall, ideally in different curtain walls too, i believe it's doable using&amp;nbsp;&lt;SPAN&gt;Fair59's workaround even though not yet tried, any thought?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:26:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/use-of-align-function-programatically-to-change-the-alignment-of/m-p/11657200#M67954</guid>
      <dc:creator>Ning_Zhou</dc:creator>
      <dc:date>2023-01-04T17:26:35Z</dc:date>
    </item>
  </channel>
</rss>

