<?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: Distance between two 3d Points in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7855661#M51764</link>
    <description>I tried to calculate the distance from DistanceTo and selecting plane each time. But the result is wrong&lt;BR /&gt;I know that distance should be 4000, but when I do my code, distance is just 7&lt;BR /&gt;And I can’t understand how the coordinates of selected points calculated? Is it projection on the plane?</description>
    <pubDate>Thu, 15 Mar 2018 11:12:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-15T11:12:24Z</dc:date>
    <item>
      <title>Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846067#M51748</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I need to find the distance between two different points in 3D view.&lt;/P&gt;&lt;P&gt;And these points placed in different planes.&lt;/P&gt;&lt;P&gt;Are there any solutions for my problem?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 14:00:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846067#M51748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T14:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846264#M51749</link>
      <description>&lt;P&gt;This post does not help you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-points-xyz-along-a-given-vector/td-p/6747568" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-points-xyz-along-a-given-vector/td-p/6747568&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 14:50:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846264#M51749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T14:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846318#M51750</link>
      <description>&lt;P&gt;When you use PickObject you'll get a reference with a global point property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With .PickPoint you'll have to change the active workplane between point selections.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then either use Revit XYZ class:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XYZ.DistanceTo(XYZ)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or Pythagoras (not the guy the theorem by the guy).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 15:08:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846318#M51750</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-12T15:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846334#M51751</link>
      <description>So, it’s better to use PickObject?&lt;BR /&gt;And if I am going to find distance along the vector, what vector it should be? How can I identify vector I need?</description>
      <pubDate>Mon, 12 Mar 2018 15:11:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846334#M51751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T15:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846387#M51752</link>
      <description>&lt;P&gt;The vector would be your choice according to what you want it for i.e. a projection on a surface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you just want the minimum distance between points then XYZ.DistanceTo will give you that and it doesn't need a vector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PickPoint vs PickObject is your choice. Picking an object is not as exact as picking a point (since you are picking somewhere on a curve or face and not a specific point)&amp;nbsp;but perhaps that could be remedied with object snap settings (unsure).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 15:26:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846387#M51752</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-12T15:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846456#M51753</link>
      <description>DistanceTo is not ok for me. It seems like I need to find distance between two planes, cause I want to select points in 3d view. And as far as I understand, distanceTo doesn’t make a reliable measurement in 3d</description>
      <pubDate>Mon, 12 Mar 2018 15:47:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846456#M51753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T15:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846501#M51754</link>
      <description>&lt;P&gt;That's a bad understanding of DistanceTo function since all it is doing is working out distance between two points (probably as below):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3D_Distance = Sqrt((X1 - X2)^2 + (Y1 - Y2)^2 + (Z1 - Z2)^2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want the projected distance onto a plane then that is a different problem but all you've said so far is that you want the distance between two 3D points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 16:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846501#M51754</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-12T16:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846519#M51755</link>
      <description>Yes, I just need to select two points in 3d view and find the distance between. But when I use DistanceTo and PickPoint, the measure is depend on the view. And when I rotate my model and choose these points again, the distance will be different</description>
      <pubDate>Mon, 12 Mar 2018 16:07:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846519#M51755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T16:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846530#M51756</link>
      <description>&lt;P&gt;Is this&amp;nbsp;because you are picking on a flat plane both points&amp;nbsp;and need to switch the plane between each pick?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll never get the Z co-ordinate you need that way and if you could you would just replace the Z coordinate of the&amp;nbsp;points to the Z values of the&amp;nbsp;levels&amp;nbsp;they were&amp;nbsp;actually picked at.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regardless of the calculation the form of picking would be confusing to the user since the object snap icons etc. would be occurring under other&amp;nbsp;3D objects (you need to switch the plane for each pick).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe your problem is you aren't actually picking the same two points, from a different angle other items get in the way and are picked first.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 16:31:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846530#M51756</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-12T16:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846588#M51757</link>
      <description>So, if I will choose the plane for every picked point, I can use DistanceTo, and everything will be ok?</description>
      <pubDate>Mon, 12 Mar 2018 16:29:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846588#M51757</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T16:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846612#M51758</link>
      <description>&lt;P&gt;Yes, I had an addin which did exactly this. Main problem is it is a bit clunky asking the user to pick a plane each time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should also investigate PickObject in conjunction with object snaps. However in a lot of cases in 3D it is hard to ensure the thing you are picking is the thing in the foreground you expect to be picking (hence why they ask you to set a plane in PickPoint).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 16:36:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846612#M51758</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-12T16:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846619#M51759</link>
      <description>Thank you so much! I will try it</description>
      <pubDate>Mon, 12 Mar 2018 16:36:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7846619#M51759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-12T16:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7847635#M51760</link>
      <description>&lt;P&gt;from your description I presume you want to get points on a face or&amp;nbsp;edge&amp;nbsp;of a "real / modelled" Element.&lt;/P&gt;&lt;P&gt;In that case you'd be better off using the Selection.PickObject() method and&amp;nbsp;use the globalPoint of the returned Reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;			Selection sel = uidoc.Selection;
			Reference res = null;
			try{
				res = sel.PickObject(ObjectType.PointOnElement ,new MySelectionFilter(),"pick a point on an element");
			}&lt;BR /&gt;			catch{}
			XYZ point = res.GlobalPoint;&lt;/PRE&gt;&lt;P&gt;These points are&amp;nbsp;not dependent on the workplane,&amp;nbsp;so the distance is point1.DistanceTo(point2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method uses a SelectionFilter, so you can narrow the picked point to certain Elements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A SelectionFilter that accepts all Elements is:&lt;/P&gt;&lt;PRE&gt; public class MySelectionFilter : ISelectionFilter
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool AllowElement(Element elem)
&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; return true;
&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; public bool AllowReference(Reference refer, XYZ pos)
&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; 	return true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:55:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7847635#M51760</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2018-03-12T21:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848099#M51761</link>
      <description>I also need to select points from Point Cloud in linked file. This why I use PickPoint in my code. And I don’t know, how PickObject works with Point Cloud</description>
      <pubDate>Tue, 13 Mar 2018 04:23:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848099#M51761</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-13T04:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848847#M51762</link>
      <description>&lt;P&gt;to pick element from linked file use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sel.PickObject(ObjectType.LinkedElement,new AllSelectionFilter(),"pick something");&lt;/PRE&gt;&lt;P&gt;You'd have to test if you can pick PointCloud points&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 10:47:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848847#M51762</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2018-03-13T10:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848865#M51763</link>
      <description>Ok, thank you !</description>
      <pubDate>Tue, 13 Mar 2018 10:55:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7848865#M51763</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-13T10:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7855661#M51764</link>
      <description>I tried to calculate the distance from DistanceTo and selecting plane each time. But the result is wrong&lt;BR /&gt;I know that distance should be 4000, but when I do my code, distance is just 7&lt;BR /&gt;And I can’t understand how the coordinates of selected points calculated? Is it projection on the plane?</description>
      <pubDate>Thu, 15 Mar 2018 11:12:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7855661#M51764</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-15T11:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7855683#M51765</link>
      <description>&lt;P&gt;This will not help in your problem (I think), but just make sure the units that are sown in the UI are as you expect them to be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;distance = UnitUtils.ConvertFromInternalUnits(distance, DisplayUnitType.DUT_METERS); //make sure it is m&lt;/PRE&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ruben&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 11:20:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7855683#M51765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-15T11:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7856732#M51766</link>
      <description>&lt;P&gt;Yea! It was very helpful! I just did and it works!&lt;/P&gt;&lt;PRE&gt;distance *= 1000;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Mar 2018 15:58:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7856732#M51766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-15T15:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Distance between two 3d Points</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7856738#M51767</link>
      <description>&lt;P&gt;Those are great news! Sometimes simple things can give us a lot of trouble&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 16:01:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/distance-between-two-3d-points/m-p/7856738#M51767</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-15T16:01:10Z</dc:date>
    </item>
  </channel>
</rss>

