Skip to main content
lurking in the shadows
Source Link
Markus von Broady
  • 42.4k
  • 3
  • 37
  • 107

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifermodifier.

It's not very general, and makes some assumptions:

  • The Cylindrical version is circular in XY, up in Z.
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (Thethe script doesn't know the difference between 0 and 360 degrees).
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits.

Select the object in Object Mode, and run this:

import bpy
from math import atan2, sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000float("inf")
    
for v in me.vertices:
    [xx, y,z] z = v.co
    r =  v.co.xy.length
    theta = atan2(x, y)
    v.co = (theta, r, z)
    min_r = min([rr,min_r] min_r)
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,), scaled and located, ready to be bent back by Simple Deform > Bend.

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  v.co.xy.length
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifier.

It's not very general, and makes some assumptions:

  • The Cylindrical version is circular in XY, up in Z.
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy (the script doesn't know the difference between 0 and 360 degrees).
  • The object has all its transforms applied, and its origin is at its XY center.

Select the object in Object Mode, and run this:

import bpy
from math import atan2, sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    bpy.context.collection.objects.link(flt)
    
min_r = float("inf")
    
for v in me.vertices:
    x, y, z = v.co
    r = v.co.xy.length
    theta = atan2(x, y)
    v.co = theta, r, z
    min_r = min(r, min_r)
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue), scaled and located, ready to be bent back by Simple Deform > Bend.

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap, the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

deleted 1 character in body
Source Link
Robin Betts
  • 78.8k
  • 10
  • 79
  • 199

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  sqrt(x*x + y*y)v.co.xy.length
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  sqrt(x*x + y*y)
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  v.co.xy.length
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

added 89 characters in body
Source Link
Robin Betts
  • 78.8k
  • 10
  • 79
  • 199

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  sqrt(x*x + y*y)
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  sqrt(x*x + y*y)
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

This might work..

It's a script which gets as close as I can to inverting the Simple Deform > Bend modifer

It's not very general, and makes some assumptions

  • The Cylindrical version is circular in XY, up in Z
  • That it has a cut gap at min Y around X=0. If there are coincident vertices where the gap is, in the illustration, the result can be usable, but untidy. (The script doesn't know the difference between 0 and 360 degrees)
  • The object has all its transforms applied, and its origin is at its XY center
  • The cylinder's minimum radius is < 100000 BUnits

Select the object in Object Mode, and run this:

import bpy
from math import atan2,sqrt

cyl = bpy.context.object
if cyl:
    flt = cyl.copy()
    me = flt.data.copy()
    flt.data = me    
    
    bpy.context.collection.objects.link(flt)
    
min_r = 100000
    
for v in me.vertices:
    [x,y,z] = v.co
    r =  sqrt(x*x + y*y)
    theta = atan2(x,y)
    v.co = (theta,r,z)
    min_r = min([r,min_r])
       
for v in me.vertices:
    v.co.x *= min_r  
    v.co.y -= min_r

flt.location.y += min_r

Which should produce a straightened version (green, derived from blue,) scaled and located ready to be bent back by Simple Deform > Bend

enter image description here

The Bend modifier uses the bounding box of the straightened object. Because of the gap,the required bend is not quite 360 degrees. In the example .blend, the match is reached at about 356 degrees.

enter image description here

Lurking Pythonistas / bpyists are welcome to improve or correct the style of this script.

Source Link
Robin Betts
  • 78.8k
  • 10
  • 79
  • 199
Loading