Is there a quick way (say, a hidden command) to determine whether two objects (e.g., surfaces) are coplanar?

Views: 418

Replies to This Discussion

Hello- here is a quick script, give that a try- 

To use the script, extract and save the .rvb file from the attached zip archive, then drag and drop the saved rvb over an open Rhino V4 or v5 window. This will load the script, set it up to load on startup in the future and register the alias
Coplanar
that will run the script much like a regular command. An alias can be typed or added to a toolbar button or keyboard shortcut (F-key).
Let me know if that does anything like what you need.
-Pascal
pascal@mcneel.com
Attachments:

Thank you! It's quite useful, but has a bug and a shortcoming. The bug is that it sometimes shows coplanar objects as non-coplanar (see object details below), and the shortcoming is that it should also accept points as input.

The following 2 objects (as far as I can tell) both occupy the y=0 plane. The first object is a rectangle, and the second a line whose ends I snapped to the verticals of the rectangle. The Intersect command properly shows the intersections between the objects as being the two points at the ends of the line. I've attached the points diagnostics at the end:

Rhino object: curve
  DEVELOPER DEBUGGING INFORMATION ONLY
  Use the Rhino "What" command.
  name: ""
  id: ...
  layer index: 0
  render material index: -1 (from layer)
  ON_PolylineCurve:  domain = [0,6.08681]
    point[ 0] = (0.063141224897635059, 0, 0.0063141224897635354), 0
    point[ 1] = (2.0331474417038486, 0, 0.0063141224897635354), 1.97001
    point[ 2] = (2.0331474417038486, 0, 1.0797149457495596), 3.04341
    point[ 3] = (0.063141224897635059, 0, 1.0797149457495596), 5.01341
    point[ 4] = (0.063141224897635059, 0, 0.0063141224897635354), 6.08681

Rhino object: curve
  DEVELOPER DEBUGGING INFORMATION ONLY
  Use the Rhino "What" command.
  name: ""
  id: ...
  layer index: 0
  render material index: -1 (from layer)
  ON_NurbsCurve dim = 3 is_rat = 0
          order = 4 cv_count = 7
  Knot Vector ( 9 knots )
  index                     value  mult       delta
      0                        0     3
      3      0.27466432830471249     1      0.2747
      4      0.54932865660942498     1      0.2747
      5      0.82399298491413742     1      0.2747
      6         1.09865731321885     3      0.2747
  Control Points  7 non-rational points
    index               value
    CV[ 0] (0.063141224897635184, 0, 0.58721339154800578)
    CV[ 1] (0.15423143622755453, 0, 0.587213391548005)
    CV[ 2] (0.43124491319523767, 0, 0.587213391548006)
    CV[ 3] (1.0481443333007419, 0, 0.58721339154800567)
    CV[ 4] (1.6650437534062452, 0, 0.58721339154800589)
    CV[ 5] (1.9420572303739285, 0, 0.58721339154800511)
    CV[ 6] (2.0331474417038491, 0, 0.58721339154800578)

 Rhino object: point
  DEVELOPER DEBUGGING INFORMATION ONLY
  Use the Rhino "What" command.
  name: ""
  id: ...
  layer index: 0
  render material index: -1 (from layer)
  ON_Point: (2.0331474417038491, 0, 0.58721339154800578)
 
  Rhino object: point
  DEVELOPER DEBUGGING INFORMATION ONLY
  Use the Rhino "What" command.
  name: ""
  id: ...
  layer index: 0
  render material index: -1 (from layer)
  ON_Point: (0.063141224897635184, 0, 0.58721339154800578)

Hello- 

"the shortcoming is that it should also accept points as input." 

Two points in space will always be coplanar, in a meaningless way. If you want to know whether two points are the same distance from a given plane, say the CPlane, then that is a completely different question to ask. Same with a line- it is two points, it is not planar in the sense of lying in a particular plane like a rectangle or a flat surface. If anything the script, as is, should simply reject lines as input, or, possibly, assume the other object as the plane to check against, assuming the other object is not a line but something planar.

-Pascal

pascal@mcneel.com

I should have been clearer: it is very useful to have a quick way to determine whether a point, simple line, complex curve, or other surface is coplanar with a (planar!) surface.

You can try this script...  Select a reference planar surface or curve (can be a line), then a point, line, planar curve or planar surface to compare...  Just not sure if the lines stuff is working 100%...  It's a bit of a hack...

Note, this script is not designed for drag and drop.   Let me know if it needs fixing.

----H

Attachments:

Thanks. This script fixes the problems I identified in the earlier one, but doesn't allow you to select a subobject of a polysurface (at least not using the usual ctrl/shift approach).

Yes, I surmised that this question would come up; unfortunately, Rhinoscript does  not currently have access to sub-objects, and it would be a lot more coding to make it work conventionally - if the user selects a polysurface as the first object, explode a copy, figure out which surface was picked on, dispose of the rest...  maybe if I have time later on in the week.

----H

Here's my version.  I was working on it periodically today.  Thought I might as well post it.

Attachments:

RSS

Translate

© 2014   Created by McNeel Admin.

Badges  |  Report an Issue  |  Terms of Service