VS:ClosestPoints: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
m (1 revision)
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Finds the closest points between two objects.
Returns the points on two objects where the shortest distance between those objects occurs. Should support all VW primitives, including polylines and NURBS. Would be nice if it supported groups, symbols, and PIOs. Would also be nice if it supported 3D.</desc>
</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<def>
<def>
<funcDef lang="vs">
<funcDef lang="vs">
PROCEDURE ClosestPoints(h1 :HANDLE; h2 :HANDLE; VAR pt1X, pt1Y, pt1Z :REAL; VAR pt2X, pt2Y, pt2Z :REAL; VAR touching :BOOLEAN);
PROCEDURE ClosestPoints(h1:HANDLE; h2:HANDLE; VAR pt1:VECTOR; VAR pt2:VECTOR; VAR touching:BOOLEAN);
</funcDef>
</funcDef>
<funcDef lang="py">
<funcDef lang="py">
Line 33: Line 32:
</line>
</line>
<line>
<line>
pt1X, pt1Y, pt1Z
pt1
REAL
VECTOR
Output parameter.
 
</line>
</line>
<line>
<line>
pt2X, pt2Y, pt2Z
pt2
REAL
VECTOR
Output parameter.
 
</line>
</line>
<line>
<line>
touching
touching
BOOLEAN
BOOLEAN
Output parameter.
 
</line>
</line>
</lineList>
</lineList>
</params>
</params>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<return>
<remark></remark>
</return>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<sample></sample>
 
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<seeAlso></seeAlso>
<code lang="pas">
PROCEDURE Example;
VAR
  x, y    :INTEGER;
  h1, h2  :HANDLE;
  pt1, pt2 :VECTOR;
  ok      :BOOLEAN;
BEGIN
  h1 := FSActLayer;
  SetDSelect(h1);
 
  h2 := FSActLayer;
  SetDSelect(h2);
     
  IF (h1 = NIL) | (h2 = NIL) THEN
      AlrtDialog(&#039;select two objects&#039;)
  ELSE BEGIN
      ClosestPoints(h1, h2, pt1, pt2, ok);
      Locus(pt1.x, pt1.y);
      Locus(pt2.x, pt2.y);
      Message(&#039;Touching=&#039;, ok);
  END; 
END;
RUN(Example);</code>
 
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<version>
<version>
Availability: from All Versions
Availability: from Vectorworks 2014


This is drop-in function.
</version>
</version>
-----------------------------------------------------------------------------------------------------------
<seeAlso>
</seeAlso>


</vwDoc>
</vwDoc>

Latest revision as of 17:35, 18 September 2013

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Returns the points on two objects where the shortest distance between those objects occurs. Should support all VW primitives, including polylines and NURBS. Would be nice if it supported groups, symbols, and PIOs. Would also be nice if it supported 3D.

PROCEDURE ClosestPoints(
h1 :HANDLE;
h2 :HANDLE;
VAR pt1 :VECTOR;
VAR pt2 :VECTOR;
VAR touching :BOOLEAN);
def vs.ClosestPoints(h1, h2):
    return (pt1, pt2, touching)

Parameters

h1 HANDLE
h2 HANDLE
pt1 VECTOR
pt2 VECTOR
touching BOOLEAN

Version

Availability: from Vectorworks 2014