# Distorted Cylinder to Regular Cylinder

How can the Blender User reshape a Distorted Cylinder to a Regular Cylinder in a minimum number of steps in situ, no adding or deleting of vertices?

• Requirement. Move only the vertices currently selected in edit mode.

This is in the context of Shape Keys, therefore deleting vertices and adding them back is not allowed since it would affect pre existing shape keys. Assume the connectivity of the starting shape vertex selection in edit mode is topologically equivalent to a cylinder with out caps. The current selection consists only of edge loops in parallel connectivity. In other words the task is possible without adding or deleting any vertices or changing topology. We just need to change position of vertices.

In the image above the left most yellow mesh is the starting point. The second yellow mesh in edit mode depicts the vertices or vertex group whose members may be moved. That is a requirement. Please note 1 or more vertices are NOT selected.

The blue mesh is the goal shape within a constant factor in XYZ dimensions of the edit mode selection, with standard edge loops in circle, other edges parallel to z-axis. In the result, one time user scaling in the XYZ global axis is acceptable. In the result, one time user rotation of (N*90) degrees is acceptable where is N is an integer.

In the image above we see a successful edit. Cyan Shape show results according to the steps below. Edit Mode and Object Mode.

Best candidate at the moment. Minimum of artistic maneuvers was one goal. Assume target cylinder in standard z-axis position.

Edit Mode Vertex Position Steps

• Loop Tools Addon is enabled.
• Edit Mode with valid selection.
• Take note of current selection and with virtual/discussion/[vertex group] name BS0 .. Blender Selection 0.
• Agree that each edge loop in BS0 has a virtual name EL0N. There are integer K > 1 edge loops. N is an integer whose range is [0,K]. EL0N is connected to EL0(N-1) if N > 0. EL00 is the edge loop whose target Z-coordinate is maximum. EL0(K-1) is the edge loop whose target Z-coordinate is the minimum.
• Agree EL00 is the top in target. EL0(K-1) is the bottom in target.
• Select edge loop EL00 of BS0. Scale Z axis to zero.
• Loop Tools Circle to achieve Regular Circle in XY Plane. Keystroke WLC.
• New Selection of one edge loop virtual name EL01 adjacent to EL00. Scale Z-axis 0. Grab/Translate selection on Z-axis so EL01 is below EL00. Loop Tools Circle. These micro steps are to insure predictability in extreme cases with the next step.
• [Vertex Slide] EL01 coincident to EL00. Accept the action. Move EL01 on Z-axis back to some reasonable position visually distinct from EL00.
• Repeat the step above for all adjacent edge loops.
• Explanation. Each edge loop EL0(N) is corrected by EL0(N-1) in the XY coordinates for N in the range [1, K]
• At this point we have a reasonably acceptable cylinder with potentially uneven distance between edge loops.
• Select one edge ring spanning all edge loops of BS0.
• Loop Tools Relax [Linear Parallel] ... Keystroke WLR. Parallel edge loops are equally spaced.

In the image above unselected vertices are hidden for ease of explanation.

Can these steps be streamlined?

Perhaps a Script would be preferable to copy points from a fresh cylinder calculation. Please correct my understanding of the problem in the comments in case I have under specified / over specified requirements.

Low priority Failure category in the context of some current goals

In cheery Winter Mesh colors left to right.

• The 01 green mesh shows a Cast [Cylinder] modifier result.
• The 02 red mesh shows a To Sphere result.
• The 03 green mesh shows a Shrink Wrap Modifier to a cylinder result.
• The 04 red mesh shows a Shrink Wrap Modifier to a sphere result.
• Note the undesirable curved edge rings in some results.
• Proportional Editing
• Custom Normals under low priority consideration
• [Data Transfer] under low priority consideration

Thanks.

• The single answer below does not meet the requirements. Dec 25, 2015 at 5:15
• How was this cylinder created, the verts order(indicies ) could be used in a script ( knowing the diameter and nbr of verts in a circle ) to reshape it, check the default cylinder verts indicies Dec 25, 2015 at 11:09
• Details. Add .. A rotation of 0-360 degrees about the Z-axis is acceptable. Aug 6, 2017 at 15:42
• For the reader, investigate BSE references to LoopTools. For sometime the [vertex slide] above is probably not necessary. I probably did not use all the features of LoopTools at the time of writing. I did not keep track of the history of LoopTools. There are many references to LoopTools by myself and other at BSE. Aug 6, 2017 at 16:01

I'd use a script.

import bpy

objects = bpy.data.objects

origin_obj = objects['Cylinder']
modified_obj = objects['Cylinder.001']  # select verts on this object

def revert_percentage(amount, origin_obj, modified_obj):

bpy.ops.object.mode_set(mode='OBJECT')

origin_verts = origin_obj.data.vertices
for v in modified_obj.data.vertices:
if v.select:
idx = v.index
# linear interpolation between original coordinate
# and modified coordinate. the amount is passed during
# the function call.
v.co = v.co.lerp(origin_verts[idx].co, amount)

bpy.ops.object.mode_set(mode='EDIT')

# between 0.0 and 1.0 of original. 1.0 is total reset of selected verts.
revert_percentage(1.0, origin_obj, modified_obj)


This assumes your modified object is in edit mode, like you said.

becomes this:

• Please excuse the delay. I am not quite sure if I had seen this proposed answer. Memories. Aug 6, 2017 at 15:31

## Join as Shapes

If the two object shares the same number of vertex and similar same edges & polygons list, you should be able to convert a "target shape object" to a Shape Key for an other object.

Obiuvsly "good" results are achievable only if they have matching topologies (e.g. a T shape will not easily became a I even even if the vertex count is the same), but your case seems one of them.

First of all you should create a "basis" shape key for wanted object, just for safety.

After that, pick the "target shape" object and then the other object.

In the drop down menu as shown in the picture above you can find the command that will add the selected object's active shapekey (the basis in this case) to the active object.

Raise the Shape Key influence factor in order to see the change of vertices coordinates.