Distance between surfaces in 2019

When you search for this on the forum, you get a lot of very old answers.

bild

How do you get this in Rhino in 2019?

PointDeviation in V6 is one method. Pick one surface as the object to extact points to test, and then the other surface. Note that the extracted points appear to be based on the render mesh of the object. For more points to test either increase the density of the render mesh, or use Mesh to create a mesh from the surface with the parameters in Mesh adjusted for the desired density.

Pascal Golay once did a rvb script called “Clearance” that does exactly what you are looking for. I used it quite often many years ago with Rhino 4. Not sure if it will work with Rhino 6, though. You can download it from here: Pascal Golay's Scripted Utilities for Rhino [McNeel Wiki]

Edit: Just tried it. It works with Rhino 6. :slight_smile:

2 Likes

Well, first off, that script seems to be 10 years old now, and I said 2019… I hope that’s still not the best we have. :laughing:

Second, I can click on several different locations on my surfaces and get as many results.

Is there really no way to get the maximum and minimum distance points?

Does this one work any better?

It uses the same original function as Pascal tho - I stole it from him - it’s dated 2016…

ClosestPt2Objects.py (3.7 KB)

2 Likes

Thanks, yes that one worked better!

Difference between that and Alias was 0.02mm which is fine (and I see in the code that it might rely on document tolerance as well).

Now, what would it take to make it print the maximum distance as well? (No need for a point.) :slight_smile:

EDIT: Also, since I’m in an icon creation spree lately since I’m building my toolbar, here’s what I put on this one…

ClosestPoint24

1 Like

Awesome! It works just fine. :slight_smile: Thanks!

Is there a way to get this script to either:

  • Accept sub-object selection (ie two faces from two different polysurfaces) or
  • Accept two already existing selections (again created as above)?

Having to extract copy all the time adds quite a few steps…

1 Like

It could probably be modified to do so - basically internally extracting the faces - but the logic might be a bit complicated to accept either top-level objects or sub-level objects or a mix of the two. I don’t really have time to look into it right now unfortunately.

No worries, you’re not a McNeel employee so your script contribution is already appreciated!

However, @Pascal is, so I wonder if he could perhaps help me understand why preselect=True doesn’t seem to work in that script? I’ve compared it to a different script that does take existing input, and I can’t see why it wouldn’t work… unless subobject selection (specifically of a surface within a polysurface) doesn’t work with scripts in Rhino?

GetObjects() does not support sub-objects. GetObject() does (it has an optional argument), but of course that would mean two picks, so you could not preselect sub-object select two surfaces beforehand.

So to do what you want in a script, a custom object getter function is required, which means it has to be written in RhinoCommon.

Hey @Helvetosaur,

Your script works really well.
You wouldn’t happen to have a FurthestPt2Object.py
Using it to check maximum plate deviation, basically recreating surface, need to check accuracy is within a reasonable tolerance.
Nice to know that this works for polysurfaces too.

Thanks for your time,

So, three years on… is the above still the best we have?

Forcing you to go into blocks and extracting surfaces for every measurement?

Why can’t the built-in Analyze Distance menu option allow surfaces for selections, regardless of whether they’re in blocks or not?

This should be very basic stuff, so how have Rhino users been doing this for the last couple of decades? Is everyone relying on user generated scripts in forums? (I know I have literally 50 in my own Rhino folder right now, but that’s not great discoverability for new users… never seen that for other CAD packages, but a coworker who uses 3D Studio Max does have a similar amount of scripts, so not unheard of I guess.)

1 Like