Move a point and keep lines and faces connected to it

dynamo

#1

Hi,

Is there a way to translate a point away from a surface divided by a grid, so that the faces that share that point (I know in reality it’s not shared, but just for the sake of explanation) and their edges stay connected to that translated point?

In other words, I’m trying to achieve something that can easily be achieved in most 3D software packages. Let’s take 3Ds Max as an example, there if you have a surface with subdivisions, you can convert to mesh, and when you move any of the points on that mesh, the surrounding geometry changes to stay connected to that point. What’s a simple way to do that in dynamo? (or if there isn’t a simple way, what’s the complicated way)

I tried looking into meshes in dynamo and how to create them from a surface, and I converted a surface to a mesh, but that didn’t really get me anywhere.

Any suggestions would be appreciated!


#2

like this?


#3

Can it be done without the physics?


#4

Like this? https://knowledge.autodesk.com/search-result/caas/screencast/Main/Details/1e63d442-1ff2-4639-b7e5-9e95e3a35b2b.html


#5

Not exactly :smile:
Sorry guys, I thought I was clear.

I’ve recorded below what I want to achieve with the result I get in 3DsMax and Dynamo. The result in max is what I’m looking to get in dynamo (my dynamo recording is a simplified example).

I guess my question is how can you preserve the relationship between components of faces, so that when you move a shared point, it outputs the resulting geometry directly, instead of just outputting the translated point and having to reconstruct the geometry from zero using that new point location.

Dynashape looks promising in that regard, except it’s built using physics (as far as I know), and it does more than just conform the connected geometry to manipulation.

Note: It’s not about mouse interaction. I don’t care if it’s done using a slider or just numbers.


#6

The example I gave was more or less that. Build a polysurface from a series of points, pull around the points as shown, polysurface will adjust.

I’ll try to find time to make a video of this today.


#7

You can make a polysurface from points? Do you mean a nurbs surface? I want to avoid using nurbs unless there’s a way to convert it back to a regular surface with straight edges.


#8

You can make a surface by points, and you can make a polysurface from surfaces, so I don’t see why not.


#9

Moving the point before constructing the surface/s should resolve the issue.
mesh.dyn (14.0 KB)

//Point Translation
q = ((x-1)*List.Count(p[0]))+y;
r = List.GetItemAtIndex(List.Flatten(p,-1),q).Translate(Vector.ZAxis(),z);
s = List.Chop(List.Insert(List.RemoveItemAtIndex(List.Flatten(p,-1),q),r,q),List.Count(p<1>));

//Surfaces
t = List.DropItems(List.Sublists(s<1>,0..1,1)<1>,-1);
u = List.AddItemToFront(List.DropItems(List.DropItems(s,-1)<1>,-1)<1><2>,List.DropItems(t,1)<1><2>);
v = List.AddItemToFront(List.DropItems(List.DropItems(s,1)<1>,1)<1><2>,List.DropItems(t,-1)<1><2>);
w = Surface.ByPerimeterPoints([u,v]);

#10

Of if you’d like to be able to move any point in 3d space… construct each point from xyz values, set up your mesh using mesh toolkit or similar to attempt to mimic another shape…

Quite obviously this doesn’t scale very well.

But for small data sets it’s doable… Just not necessarily the best idea.

Adjusting a mesh manually.dyn (98.4 KB)

Nurbs surfaces are a bit easier to build as you don’t have to worry so much about the indexing. You could always turn them into a mesh after the fact too.


#11

@Vikram_Subbaiah That’s amazing. You are a designscript god! It will take me ages to understand what you did there.

@JacobSmall This looks easier to implement, but you’re right about the scalability. I found it versatile though, as it looks like I can do all sorts of operations on a mesh. Where can I learn how indexing in meshes works? I would need to learn that to really use the mesh method myself.

Do you have any suggestion on how I could use any of your methods on a preexisting surface?
I would imagine I would first have to divide the surface and extract the points, make my necessary edits to the points, then construct a surface/mesh from the new points. Is it a good approach?


#12

@Vikram_Subbaiah That’s amazing. You are a designscript god!

Agreed :slight_smile:

I find rewriting DS in Nodes a useful exercise to really understand whats going on when @Vikram_Subbaiah does something like that!

FYI just to check that you’re aware that you can right click on the nodes and Node To Code?

PS @JacobSmall is also a DS guru :smiley: did you see this? Closed vs Open Surfaces in Dynamo and retriving their UVs

Cheers,

Mark


#13

did a grid of lines sticking out of the XY plane and the intersect on an existing surface to gave me the points.
like a pincusion sort of thing.
from there i created a surface, turned that into a mesh


#14

Not sure, but I would study an existing mesh. Make sure you have mesh toolkit for this as the additional tools will help.

You have the right idea. You can also save out the mesh and re-import it using mesh toolkit. This could allow you to edit it elsewhere as Dynamo isn’t ideal for this.


#15

There is also a few ways to turn geometry directly into a mesh. Checkout mesh toolkit for a review.


#16

@JacobSmall
Does it depend on the type of geometry?
Imported from program X?
.SAT
.3DM

  • long list here

#17

Sorry. The definition below should be easier to follow.

If the surface is built in Dynamo, Surface.PointAtParameter should mostly provide you with a proper points grid as in the example below.
Also extended the definition to enable multiple projections of varying heights (calculated normal to the surface)


surfaceGrid.dyn (14.2 KB)

 //Sample Surface
n1 = NurbsCurve.ByPoints(Point.ByCoordinates([0,10,20,50],[55,60,52,48],[5,12,-3,6]));
n2 = NurbsCurve.ByPoints(Point.ByCoordinates([-5,15,40,50],[5,10,2,8],[15,10,-3,0]));
sr = Surface.ByLoft([n1,n2]);

//[[u index, v index, elevation]]
sr =[[5,7,-5],[9,4,-25],[2,8,-5]];

//Point Translation
s3 = trnz (sr,10,10,uvw);

//Surface paneling
t1 = List.Sublists(s3<1>,0..1,1);
t2 = List.DropItems(t1<1>,-1);
u1 = List.DropItems(s3,-1);
u2 = List.DropItems(u1<1>,-1);
u3 = List.DropItems(t2,1);
u4 = List.AddItemToFront(u2<1><2>,u3<1><2>);
v1 = List.DropItems(s3,1);
v2 = List.DropItems(v1<1>,1);
v3 = List.DropItems(t2,-1);
v4 = List.AddItemToFront(v2<1><2>,v3<1><2>);
w1 = Surface.ByPerimeterPoints([u4,v4]);

//Function: Surface Grid - Multiple Point Translation

//sr : Surface
//uc : Surface divisions (U)
//vc : Surface divisions (V)
//u in uvw : Index of point to be translated (U)
//v in uvw : Index of point to be translated (V)
//w in uvw : Normal distance to be translated

def trnz (sr,u,v,uvw:var[]..[])
{
	p = Surface.PointAtParameter(sr<1>,
	(0..1..#u)<2>,(0..1..#v)<3>);
	a = [Imperative]
	{
		ct = List.Count(p[0]);
		pt = p;
		for (i in uvw)
		{
			q1 = ((i[0]-1)*ct)+i[1];
			r1 = List.Flatten(pt,-1);
			r2 = List.GetItemAtIndex(r1,q1);
			r3 = sr.NormalAtPoint(r2);
			r4 = r2.Translate(r3,i[2]);
			r5 = List.Flatten(pt,-1);
			s1 = List.RemoveItemAtIndex(r5,q1);
			s2 = List.Insert(s1,r4,q1);
			pt = List.Chop(s2,ct);
		}
		return = pt;
	}
	return = a;
};

#18

Mesh is a mesh so it should work. That said, I don’t have a personal repository to test with. :slight_smile: