Skip to main content
added 2 characters in body
Source Link
batFINGER
  • 85.1k
  • 10
  • 114
  • 244

enter image description here enter image description here

Splitting script to bisect first, copy, and then "unfurl" copy and join as shapes

enter image description here Splitting script to bisect first, copy, and then "unfurl" copy and join as shapes

enter image description here

Splitting script to bisect first, copy, and then "unfurl" copy and join as shapes

added 172 characters in body
Source Link
batFINGER
  • 85.1k
  • 10
  • 114
  • 244

enter image description hereenter image description here Splitting script to bisect first, copy, and then "unfurl" copy and join as shapes

Run in edit mode. Select a vertex you wish to be the xy radius to unfurl radius r to XY plane. The height will be the xy radius take r, the Y value the old z value and the x the longitude angle (remember arc length = angle in radians.)

enter image description here

enter image description here

Run in edit mode. Select a vertex you wish to be the xy radius to unfurl radius r to XY plane. The height will be the xy radius take r, the Y value the old z value and the x the longitude angle (remember arc length = angle in radians.)

enter image description here Splitting script to bisect first, copy, and then "unfurl" copy and join as shapes

Run in edit mode. Select a vertex you wish to be the xy radius to unfurl radius r to XY plane. The height will be the xy radius take r, the Y value the old z value and the x the longitude angle (remember arc length = angle in radians.)

enter image description here

Source Link
batFINGER
  • 85.1k
  • 10
  • 114
  • 244

Bmesh script

enter image description here

Similarly to a cylindrical UV projection can "unwrap" a cylinder from cylindrical coordinates to flat.

(Just seen RobinBetts excellent answer, doing much the same.)

Some Pre Pro on mesh

Firstly going to be a lot easier to set origin to geometry (bounds) Can also be done via bounding box

enter image description here

which in this case puts it in pipe centre. The xy coordinate vector of any vertex gives its distance from the pipe axis.

enter image description here

Have also removed the coplanar faces of the "nut end". (Would need to be poked to axis line to unfurl nicely)

The script

Bisects the pipe with a cutting plane.

Have arbitrarily chosen the ZY plane to chop the pipe where locally Y > 0 (the top looking down)

Select a vertex as unfurl radius

Run in edit mode. Select a vertex you wish to be the xy radius to unfurl radius r to XY plane. The height will be the xy radius take r, the Y value the old z value and the x the longitude angle (remember arc length = angle in radians.)

Script. Edit mode select vertex. then run script. (Alters the mesh, so as always backup first / run on copy etc)

import bpy
import bmesh
from mathutils import Vector
from math import copysign, pi

context = bpy.context

ob = context.object
me = ob.data

bm = bmesh.from_edit_mesh(me)
#bm.from_mesh(me)

v_r = bm.select_history.active
r = v_r.co.xy.length

assert(isinstance(v_r, bmesh.types.BMVert), "Select a Vert")
cut = bmesh.ops.bisect_plane(
        bm,
        geom=[f for f in bm.faces if all(v.co.y > 0 for v in f.verts)] + [e for e in bm.edges if all(v.co.y > 0 for v in e.verts)] + [v for v in bm.verts if v.co > 0],
        plane_no=(1, 0, 0),
        )["geom_cut"]
    
for g in cut:
    g.select = True


bmesh.ops.split_edges(
        bm,
        edges=[e for e in cut if isinstance(e, bmesh.types.BMEdge)],
        verts=[v for v in cut if isinstance(v, bmesh.types.BMVert)],
        use_verts=True
        )

    
# now "unfurl"

up = Vector((0, -1))
for v in bm.verts:
    co = v.co.copy()
    angle = -up.angle_signed(v.co.xy)
    if 1 + up.dot(v.co.xy.normalized()) < 1e-4:
        # meridian 
        fv = sum((f.calc_center_median().x 
            for f in v.link_faces)
                 ) / len(v.link_faces)
        v.select_set(True)
        angle = copysign(angle, fv)
    v.co.y = co.z
    v.co.z = co.xy.length - r
    v.co.x = angle * r

  
bmesh.update_edit_mesh(me)