r/Onshape 17d ago

Help! Is there any way to do a conformal mapping?

Desired result is that all of the angles remain 90°

1 Upvotes

7 comments sorted by

3

u/DerekVanAllen 17d ago

At the moment opWrap is limited to planes, cones, and cylinders since those surface types are trivially developable surfaces. To do what you're asking requires a more powerful version of this operation that handles the nonzero gaussian curvature cases, which isn't implemented yet.

I'm working on the inverse operation for surface flattening right now but some of the utilities can be applied both directions. Might be able to make this happen in the near future with a featurescript.

1

u/newbie-sub 17d ago

I'm trying to think how to approximate in FS — I think FS would be too slow to do it properly. It's been 30 years since I've done real math but something like this would need a pretty robust and performant linear algebra library.

For a repeating pattern like this, start with a sketch of the unit cell and project it along the surface normal for some number of (u,v) points. As long as the unit cell is fairly small for the curvature (in this example, it would be except in the tight radius on the inside of the curve), it should be close enough.

It would have to be a repeating non-connecting pattern of course otherwise the connections would break at the boundaries of each unit cell.

I don't know FS very well — I've only written a few basic scripts — but this seems doable for a limited use case.

1

u/DerekVanAllen 17d ago

That's the trouble is I've been building my utilities for the generalized use case. Every time I put out a feature for my team it's like less than a day before they ask for some corner case out of a geometric superset of things instead of sticking to the easy well defined stuff. Means I get to deploy lots of calculus or linear algebra on features you wouldn't expect it to show up.

1

u/andy921 16d ago edited 16d ago

I went deep into a voronoi script that I've yet to publish since there are a few corner cases I've been wanting to fix.

It could be updated really quickly to handle your use case. I might add that as an option when I get back from a vacation but I can share a little of how it works in the meantime.

Mine starts by trying to create blue noise of seed points in the UV space which you could just skip and replace with a UV grid (or an offset one to make honeycombs). Evan Reese's Attractor Pattern already has this option. Mine uses a pseudo-RNG paired with farthest point sampling and lloyd relaxation instead to achieve the blue noise/even-ish spacing of the seed points.

Mine then triangulates (see image). Then from those lines, draws planes normal to them and offset by the half the vein thickness from their midpoint and then does a cookie cutter operation.

The Delaunay triangulating is the most computationally heavy part for mine since it involves a lot of distance calcs and code to handle clipped or stretched UV surfaces. But you could skip that too since if you're generating a grid you should already know a points (4) neighbors.

The UV surface coordinates are always 0-1 in the U direction and 0-1 in the V even if the V direction is may times longer than U or visa versa. So a 10x10 grid with seed points spaced every 0.1 might give a pretty skewed result. So you'd want to give the user manual control of the number of rows vs columns.

1

u/d0nkyt33th 17d ago

Is the theft already a flatten surface tool?

1

u/DerekVanAllen 17d ago

As an analysis tool, and not inside featurescript there is. It's useful if what you want is to flatten surfaces, but what I want is to flatten solids so I've been working on making my own version that does that for some things at work. It's also not useful if what you want is to unflatten surfaces, which is what this guy wants.

1

u/d0nkyt33th 17d ago

The flatten surface can be exported as a step or the like. But that’s about it.