Create Points on Mesh

My goal is to quickly place points on a mesh (ideally specifically named points but they can be named later). The purpose of the point placement is to extract XYZ coordinates at specific locations for use in a database. I have traditionally used the Polylineonmesh command, drawn a polyline over my desired location, and then placed a point on the polyline. I’d then press a button that would give the selected point a particular name. This is a little cumbersome and I’m looking for alternatives. One alternative I’m playing with is to use grasshopper to create template points > pull those points to the mesh > use gumball to move template points > name and bake pulled points into rhino once everything is in the correct location. This is not ideal because moving points around with the gumball is a little clunky.

Is there anyway to just click on the mesh to create a point on it? Any advice would be greatly helpful.

Thanks!

1 Like

Hi mcmucher - it may be that adding the points using the OnMesh or PersistentOnMesh osnap is all you need, or possibly Projecting points onto the mesh.

-Pascal

Hi Pascal,

Are those available for Rhino 5? I can’t find either of those osnap options. I see (END) (NEAR) (POINT) (MID) (CEN) (INT) (PERP) (TAN) (QUAD) (KNOT) (VERTEX) (PROJECT) (DISABLE).

Vertex works closest to what I’d like, but the point location I’m interested in is often between vertices.

Thanks,

-mcmucher

Hi mcmurcher - see the menu Tools > Object snap > On object, Also, you can type in OnMesh or PersistentOnMesh any time Rhino is looking for a point location.

-Pascal

Wow - Thanks so much pascal. I had no idea that the option was available.

Do you know of any mechanism in Rhino/grasshopper that would allow me to place the points in a set order (1,2,3) - and have the objectnames changed automatically (“1”,“2”,“3”)?

Hi mcmurcher - that is probably easier in a script - does it need to be in GH?

-Pascal

Hi Pascal,

Thanks so much for your help so far.

No, it does not need to be in grasshopper. My programming/scripting skills leave something to be desired, and grasshopper has allowed me to do a lot more with rhino, but it’s use isn’t necessary.

Thanks,

-mcmucher

Hi mcmurcher - here’s a Python that may help - use RunPythonScript

or

-RunPythonScript "Full path to py file in double quotes" (command starts with a dash, that can be made into a macro on a button or alias/keyboard shortcut)

PointsOnMesh.py (1.4 KB)

-Pascal

1 Like

Hi Pascal,

You’re the best! This works perfectly!

One more question: How complicated would it be to give the points set names other than numbers? Looking into the script - it doesn’t look like i can just replace values.

First Point = "Tooth 1"
Second Point = "Tooth 2"
Third Point = "Eye_left"
Fourth Point ="Eye_right"
ect.

Thanks again!
-mcmucher

Hi mcmurcher - it is not hard - do you want to just type a whole new name for each point placed?

NamedPointsOnMesh.py (895 Bytes)

-Pascal

Hi Pascal,

I need to place the same number of points on many different but similar meshes. Since the point set will be the same, and the points will be analogous between meshes, I’d like to have the names included in the script. I would also like to be able to just adjust the names in the script when i come up with a different point name list for different projects. However, I don’t want to manually type in the name each time I place a point.

My current point list has 32 points - and each point has a unique name.

If this is more difficult - I could probably just do a select and rename macro which I think would probably work - although less elegant. (ex. Selname “0” Setobjectname “Tooth_1” ect.)

Thanks!
-mcmucher

Hi mcmurcher - it does get more complicated but certainly not hard, I think. What comes to mind is the script would ask for a text file that contains the list of points that you want to use for the project. When you run it, it would go down the list, telling you what the current name is and let you place the point, then move on to the next one. Does that sound about right?

-Pascal

Hi Pascal,

Yes, that sounds like it would work great! If there’s a way to “go back” and redo a point - that would be ideal. I often place a point, don’t like where it went, and want to adjust it slightly.

You’ve helped me more than enough so let me know if that’s too complicated.

Thanks,
-mcmucher

Hi mcmurcher - you can do that using SetPt, I don’t think the script needs to do it. However if you want to make this change while the script is running, i.e. interrupt the script, adjust the placement and then carry on where you left off, then yes, the script will have to be able to be resumed.

-Pascal

Hi Pascal,

I could adjust the points after I’ve placed all of the points.

Is there a way to get SetPt to default to “onmesh”?

I created a button:

-Setpt
Pause
onmesh

but that doesn’t work because I think it wants me to select the mesh. I often run into problems when i need to select an object before moving onto the next step.

I’d use a macro like this for that operation, if I understand:

-SetPt XSet=Yes YSet=Yes ZSet=Yes Pause OnMesh

-Pascal

Hi Pascal,

That works!

Thanks,

-mcmucher

Hi mcmucher - see how this one works - you’ll need text files that have the format

Name1
name 2
NAME_3

etc.

(i.e. one name per line)

NamedPointsOnMeshEx.py (2.9 KB)

@mcmucher

One thing that can be tuned up is that it stops and resumes the name sequence if you exit the script before all the names are used and if the same name file is in use in the same session, but there’s no provision yet for resetting to the start if you want to start over - to do that, use ChangeFile, point to the same file, and that will start over…

-Pascal

Hi Pascal,

This is great. Thank you so much for this.

Just a few notes:

Sometimes when I stop and start - it will resume without asking me for file
Other times it will ask for file
When i change file to same file - it stays in same order as before and nothing changes
If i change to a new file with different landmarks,it either doesn’t run, or it continues on with original landmark list and order.

I should be able to work with it though!

Thanks again,

-mcmucher

OK- some kinks to work out - I’ll take a look.

@mcmucher - please check the the new version updated in my post above - I’d left out a line in the code…Any better?

-Pascal