<?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 Adding Closest Grid Point Intersection to object in Revit in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5405827#M74948</link>
    <description>&lt;P&gt;Hi, everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a project in which we want to locate objects with the nearest grids intersection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so i have&amp;nbsp;used the column location mark property to meet my need. the solution is described with the codes belows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using (TransactionGroup transGroup = new TransactionGroup(document,"Transaction Group"))
			{
				transGroup.Start("Upgrade signages identity informations");
				
				foreach (ElementId eid in SelectedElements)
				{
					var e = document.GetElement(eid) as FamilyInstance;
					LocationPoint lp = e.Location as LocationPoint;
					XYZ loc = new XYZ(lp.Point.X,lp.Point.Y,0);
					ElementId levelId = e.LevelId;
					Level level = document.GetElement(levelId) as Level;
					
					Transaction tr1 = new Transaction(document,"Get Coordinates");
					tr1.Start();
					FamilyInstance newPoteau = document.Create.NewFamilyInstance(loc, familySymbol, level, Autodesk.Revit.DB.Structure.StructuralType.Column);
					tr1.Commit();
					
					Parameter p1 = newPoteau.get_Parameter(BuiltInParameter.COLUMN_LOCATION_MARK);
					string locationParam = p1.AsString();
					

					//enlever distance dans la chaine de caractère
					
					int index1= locationParam.IndexOf('(');
					int index2= locationParam.IndexOf(')');
					
					if(index1!=-1)
					{locationParam = locationParam.Remove(index1,index2-index1+1);}
					
					int index3= locationParam.IndexOf('(');
					if(index3!=-1)
					{locationParam = locationParam.Remove(index3);}
					
					locationParam = locationParam.Replace('-',',');
					
					//Take Level Code and Increment number
					Parameter pLevel = level.get_Parameter(levelCodeParam);
					levelCode = pLevel.AsString();
					if(String.IsNullOrEmpty(levelCode))
					{
						levelCode ="??";
					}
					
					Parameter pIncrement = e.get_Parameter(incrementParam);
					increment = pIncrement.AsString();
					if(String.IsNullOrEmpty(increment))
					{
						increment="1";
					}
					
					Parameter pType = document.GetElement(e.GetTypeId()).get_Parameter(signageTypeParam);
					signageType = pType.AsString();

					
					Parameter pID= e.get_Parameter(BuiltInParameter.DOOR_NUMBER);
					signageID = signageType+"-"+levelCode+"-"+locationParam+"-"+increment;
					
					
					
					//Fill Tag
					Transaction tr2 = new Transaction (document,"Fill Tag");
					tr2.Start();
					e.get_Parameter(xyParam).Set(locationParam);
					document.Delete(newPoteau.Id);
					e.get_Parameter(signageLevelCodeParam).Set(levelCode);
					e.get_Parameter(incrementParam).Set(increment);
					e.get_Parameter(BuiltInParameter.DOOR_NUMBER).Set(signageID);
					tr2.Commit();
				}
				
				transGroup.Assimilate();
			}&lt;/PRE&gt;&lt;P&gt;I&amp;nbsp;have to commit a column creation transaction in order to get the COLUMN_LOCATION_MARK property, and then delete the column in a other transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am pretty sure that this is not a good idea to do the thing in this way since there are so many operations on the file. so i am wondering if i can:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. get the things done without commit the transaction in which we have creation and supression of a column object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. if there's a API methode to get the location mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
    <pubDate>Sat, 15 Nov 2014 06:07:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-11-15T06:07:05Z</dc:date>
    <item>
      <title>Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5405827#M74948</link>
      <description>&lt;P&gt;Hi, everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a project in which we want to locate objects with the nearest grids intersection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so i have&amp;nbsp;used the column location mark property to meet my need. the solution is described with the codes belows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using (TransactionGroup transGroup = new TransactionGroup(document,"Transaction Group"))
			{
				transGroup.Start("Upgrade signages identity informations");
				
				foreach (ElementId eid in SelectedElements)
				{
					var e = document.GetElement(eid) as FamilyInstance;
					LocationPoint lp = e.Location as LocationPoint;
					XYZ loc = new XYZ(lp.Point.X,lp.Point.Y,0);
					ElementId levelId = e.LevelId;
					Level level = document.GetElement(levelId) as Level;
					
					Transaction tr1 = new Transaction(document,"Get Coordinates");
					tr1.Start();
					FamilyInstance newPoteau = document.Create.NewFamilyInstance(loc, familySymbol, level, Autodesk.Revit.DB.Structure.StructuralType.Column);
					tr1.Commit();
					
					Parameter p1 = newPoteau.get_Parameter(BuiltInParameter.COLUMN_LOCATION_MARK);
					string locationParam = p1.AsString();
					

					//enlever distance dans la chaine de caractère
					
					int index1= locationParam.IndexOf('(');
					int index2= locationParam.IndexOf(')');
					
					if(index1!=-1)
					{locationParam = locationParam.Remove(index1,index2-index1+1);}
					
					int index3= locationParam.IndexOf('(');
					if(index3!=-1)
					{locationParam = locationParam.Remove(index3);}
					
					locationParam = locationParam.Replace('-',',');
					
					//Take Level Code and Increment number
					Parameter pLevel = level.get_Parameter(levelCodeParam);
					levelCode = pLevel.AsString();
					if(String.IsNullOrEmpty(levelCode))
					{
						levelCode ="??";
					}
					
					Parameter pIncrement = e.get_Parameter(incrementParam);
					increment = pIncrement.AsString();
					if(String.IsNullOrEmpty(increment))
					{
						increment="1";
					}
					
					Parameter pType = document.GetElement(e.GetTypeId()).get_Parameter(signageTypeParam);
					signageType = pType.AsString();

					
					Parameter pID= e.get_Parameter(BuiltInParameter.DOOR_NUMBER);
					signageID = signageType+"-"+levelCode+"-"+locationParam+"-"+increment;
					
					
					
					//Fill Tag
					Transaction tr2 = new Transaction (document,"Fill Tag");
					tr2.Start();
					e.get_Parameter(xyParam).Set(locationParam);
					document.Delete(newPoteau.Id);
					e.get_Parameter(signageLevelCodeParam).Set(levelCode);
					e.get_Parameter(incrementParam).Set(increment);
					e.get_Parameter(BuiltInParameter.DOOR_NUMBER).Set(signageID);
					tr2.Commit();
				}
				
				transGroup.Assimilate();
			}&lt;/PRE&gt;&lt;P&gt;I&amp;nbsp;have to commit a column creation transaction in order to get the COLUMN_LOCATION_MARK property, and then delete the column in a other transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am pretty sure that this is not a good idea to do the thing in this way since there are so many operations on the file. so i am wondering if i can:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. get the things done without commit the transaction in which we have creation and supression of a column object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. if there's a API methode to get the location mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Nov 2014 06:07:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5405827#M74948</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-15T06:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409641#M74949</link>
      <description>&lt;P&gt;Dear Fangchao Gong,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not understand what you are trying to achieve, nor what the code has to do with your brief description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please elaborate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2014 21:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409641#M74949</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2014-11-17T21:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409699#M74950</link>
      <description>&lt;P&gt;Hi，Jeremy, Thanks a lot for your reply. And also thanks a lot for your blog, the articles are very helpful and I&amp;nbsp;have learnt a lot from them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the macro, i want to know the location of all the objects in the project ( the coordinates like X1, Y1). &amp;nbsp;While we are studying the project, we want to find the object rapidly with the grids intersection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In REVIT, only the structural column have a property "COLUMN_LOCATION_MARK" which gives me the possiblity to have this kind of&amp;nbsp;coordinates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is why i have written the codes above to place a structural column and then commit a transaction,after which I&amp;nbsp;can get a&amp;nbsp;&lt;SPAN&gt;"COLUMN_LOCATION_MARK" value. &amp;nbsp;copy and paste it to one of my object properties. and at last, delete the column object.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am wondering if there is a better way to do this thing in Revit since there is so many operations on the model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2014 22:15:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409699#M74950</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-17T22:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409741#M74951</link>
      <description>&lt;P&gt;Dear Fangchao Gong,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your update, appreciation, and more detailed explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say "coordinates like X1, Y1", I must answer that every single object in Revit provides those straight out of the box, with no need whatsoever&amp;nbsp;for the expensive acrobatics you describe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no idea why you think you need a structural column and its COLUMN_LOCATION_MARK property to access this kind of coordinates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, actually, if I attempt a guess, I would surmise&amp;nbsp;that you might be after the coordinates converted from the local project coordinate system to some kind of global coordinate system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, there are much simpler and more direct solutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully, this one will fulfil your needs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2014/11/concrete-setout-points-for-revit-structure-2015.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2014/11/concrete-setout-points-for-revit-structure-2015.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2014 22:29:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409741#M74951</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2014-11-17T22:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409775#M74952</link>
      <description>&lt;P&gt;Hi, Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a picture, i can explain better my propose. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Sorry for my English, i haven't praticed it for a long time. ( France here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To locate a object, i can have a X,Y coordinate. but it's too diffcult to find it if we have only a Dwg and Excel file. so we want to locate it with the grid intersection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for exemple, the red point on the image, i want a value like (A,2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the COLUMN_LOCATION_MARK is not the only solution. i have to read all the grids intersections and calculate the distance between my object and all of them to find the smallest value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Nov 2014 22:44:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5409775#M74952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-17T22:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5410279#M74953</link>
      <description>&lt;P&gt;Dear Fangchao Gong,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your update and helpful sample image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your English is perfectly fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I understand better what you are after.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I would definitely suggest calculating the grid line intersection points and determining the closest one yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That sounds vastly more efficient than asking Revit to create temporary BIM elements and commit transactions to place and query them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could even have additional fun by defining a lexicographical ordering on the grid points&amp;nbsp;and managing them in a .NET dictionary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would make the lookup process extremely fast.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you need any help with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, please provide a complete reproducible case and sample model to play with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck and best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 07:52:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5410279#M74953</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2014-11-18T07:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5417667#M74954</link>
      <description>&lt;P&gt;Hi Chao,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very funny to see you here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &amp;nbsp;&lt;EM&gt;Comment vas-tu&amp;nbsp;?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that everybody is now digging in the Revit API !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The subject you want to deal with is very interesting ! Please let us know if you achieve your goals !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M. V.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Nov 2014 13:30:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5417667#M74954</guid>
      <dc:creator>m.vallee</dc:creator>
      <dc:date>2014-11-20T13:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5418877#M74955</link>
      <description>&lt;P&gt;yes Maxime, it helps a lot the api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and with the help of Jeremy, i have at last the things done .-)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void getNearestIntersectionPoint()
			
		{
			UIDocument uidoc =ActiveUIDocument;
			Document doc = ActiveUIDocument.Document;
			Selection sel = uidoc.Selection;
			ICollection&amp;lt;ElementId&amp;gt; ecol = sel.GetElementIds();
			
			Dictionary&amp;lt;string,XYZ&amp;gt; intersectionPoints = getIntersections(doc);
			string intersection = "??";
			
			foreach(ElementId eid in ecol)
			{
			Element e = doc.GetElement(eid);
			LocationPoint p = e.Location as LocationPoint;
			
			XYZ xyz= new XYZ(p.Point.X, p.Point.Y,0);
			double distanceMin = 0;
			double distance =0;
			
			distanceMin =xyz.DistanceTo( intersectionPoints.First().Value);
			foreach (KeyValuePair&amp;lt;string,XYZ&amp;gt; kp in intersectionPoints)
			{
				distance = xyz.DistanceTo(kp.Value);
				if (distance&amp;lt;distanceMin)
				{distanceMin=distance;
				 intersection = kp.Key;
				}

			}
			
			double distanceInMeter = distanceMin/3.281; 
			MessageBox.Show(intersection);
			}
			
			
		
		}
				
		#region build dictionary
		public Dictionary&amp;lt;string,XYZ&amp;gt; getIntersections(Document doc)
		{
		
		string coordinate = null;
		string coordA= null;
		string coordB= null;
		string coordC = null;
		Dictionary&amp;lt;string,XYZ&amp;gt; intersectionPoints = new Dictionary&amp;lt;string,XYZ&amp;gt;();
		
		
		ICollection&amp;lt;ElementId&amp;gt; grids = new  FilteredElementCollector(doc).WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Grids)).WhereElementIsNotElementType().ToElementIds();
		
		ICollection&amp;lt;ElementId&amp;gt; refgrid = new  FilteredElementCollector(doc).WherePasses(new ElementCategoryFilter(BuiltInCategory.OST_Grids)).WhereElementIsNotElementType().ToElementIds();
		foreach( ElementId eid in grids)
			
		{
			Grid g = doc.GetElement(eid) as Grid;
			
			coordA = g.Name;
			
			Curve c = g.Curve;
			
			refgrid.Remove(eid);
			
			foreach(ElementId eid2 in refgrid)
			{
				Grid g2 = doc.GetElement(eid2) as Grid;
				
				coordB = g2.Name;
				Curve c2 = g2.Curve;
				
				IntersectionResultArray results;
				
    			SetComparisonResult result = c.Intersect(c2, out results);

    			if( result != SetComparisonResult.Overlap )
    			{	}
 		
    			else if( results == null || results.Size != 1 )

    			{}
    			
    			else if (results.Size&amp;gt;0)
    			{
    				for (int i =0; i&amp;lt;results.Size; i ++)
    				{
    					IntersectionResult iresult = results.get_Item(i);
    					coordC = i.ToString();
    					
    					coordinate = coordA+","+coordB+"-"+coordC;
    					
    					XYZ point = iresult.XYZPoint;
    					
    					intersectionPoints.Add(coordinate,point);
    					
    				}
    			}
    			continue;				
			}
		
		}
		return intersectionPoints;
		}
	#endregion&lt;/PRE&gt;&lt;P&gt;and Jeremy, Thank you a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Nov 2014 20:09:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5418877#M74955</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-20T20:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5433373#M74956</link>
      <description>Hi, Maxime &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; nice to see you here!&lt;BR /&gt;&lt;BR /&gt;I can get all I want with my code. But in a not really elegant way;) so jeremy have pointed it out and I am try to iterate all the grids to find the intersection and try to get the distance with my element in order get the small distance.&lt;BR /&gt;&lt;BR /&gt;But it demande much more energies. I am working on it. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Fri, 05 Dec 2014 08:04:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/5433373#M74956</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-05T08:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Closest Grid Point Intersection to object in Revit</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/7059497#M74957</link>
      <description>&lt;P&gt;I'm very interested in this but I'm not so much in the coding side. I go as far as dynamo.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do wish this was a property that Revit just automatically filled out as this would translate very nicely to equipment in BIM 360 field and give an object an actual location.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless of my coding knowledge I still look forward to seeing what you come up with. Maybe it could become an add-on?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 19:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-closest-grid-point-intersection-to-object-in-revit/m-p/7059497#M74957</guid>
      <dc:creator>Steve_Th</dc:creator>
      <dc:date>2017-05-03T19:37:34Z</dc:date>
    </item>
  </channel>
</rss>

