Each of these three scripts generates a motif appeared in secondary structure of proteins; (1) a flexible (bendable and elastic) alpha-helix using lathe functions and skeleton (2) a beta-sheet by giving a cylindrical NURBS squared corners (3) a beta-sheet using blending technique of patches.
1. Generating an alpha helix
The first script makes a small rectangle at the first. It is used as a cross section of the ribbon-like helix.
Lathe functions extrude a face to 3D helix about an axis. We make a left-handed helix here.
The script adjusts orientation and location and attaches it to a skeleton that has a series of bones. Each joint has DOF (degree of freedom) for rotation about 2 axes and sliding so that we can stretch the skeleton by pulling vertically or can bend flexibly by pulling horizontally.
2. Generating a cylindrical NURBS beta sheet
The second script makes a cylindrical NURBS at the first because there is no API function to make a NURBS cube. In order to simplify the process, it does not have bottom cap.
In addition, trueSpace's "NURBS Cube" button with "One patch" on would probably make a cylinder and change control points in the similar way with the script.
Changes the cylinder into a quadrangular prism by shortening the length of control arrows. If you would like to check the position of the control points, remove "#" from the commented lines near CreateCube().
We call the bottom latitude "the first floor" here. The script widen the control points on the second floor and lift them up to the same level with the 3rd floor.
Narrows the bottom so that it becomes almost a line segment, and adjust its level, etc.
Adds two altitudes just upper and below the inverted "eaves" in stead of unite the 2nd and 3rd floor. They prevent crack at the eaves.
That's the steps that the script makes a beta sheet model. It subsequently pulls some altitudes horizontally, and adjust vertical size, thickness, etc.
You might think rotating 45° and stretching vertically before deforming the NURBS would make the script simpler, but that does not contribute much because the information of rotation and scaling are stored to different place from vertices and the coordinate of control points are unchanged after the object was rotate or scaled.
3. Generating a beta sheet by blending patches
The third script makes a cube at the first and shorted its heights.
Deletes a vertical edge from it to make the arrowhead.
Changes its orientation and adds a NURBS plane with several sections as the bottom panel of the shaft.
Adds more four NURBS planes as the top, side, and end panel of the shaft. Stiches them using blend function.
4. Summary and notes
You get three objects after executed the three scripts, and can deform them flexibly.
(1) The helix (right in the image)
It is not a NURBS object but a plain object + a skeleton. It can be shrunk/extended vertically by right-dragging a bone, and can be bend flexibly by left-clicking a bone. The script specifies degree of freedom (DOF) for each joint.
Please note that the script does not set parameters for muscle and tendon but only bare minimum things. In case you receive glitchy result, adjust values for them before running the script; Right click "Edit muscles" to open "Muscle Properties", and set all five vales to zero. Right click "Edit Tendons" to open "Skinning" panel, and adjust "Tendon Rates" so that you get more preferable results.
(2) The arrow (center)
It's a NURBS object and its latitude and longitude can be moved flexibly without making sharp corners unlike plain objects. After right clicking it, hover your mouse pointer over a latitude or longitude. Click it to select, and move/rotate/scale it. Right clicking the ground ends the edit mode.
(3) The arrow (left)
It's similar to the previous one but you must do multiple selection by ctrl clicking each edge of a latitude before move/rotate/scale it. There might be room for improving the script. Probably trueSpace's "NURBS Cube" button with "One patch" off would do in the similar way, but it allow users to select each latitude by one clicking.
Requirements:
script file 1: ptsxpy 0.0.14 or higher
script file 2 and 3: tS5.1 or higher + ptsxpy 0.0.14 or higher
Alpha helix and Beta sheet (2021)
- 3DfromNULL
- Site Admin
- Posts: 45
- Joined: 2018-Jul-13 9:35
Alpha helix and Beta sheet (2021)
- Attachments
-
- ahelix1_1a.py
- script file 1
- (4.49 KiB) Downloaded 1866 times
-
- bsheet1_cylindrical_1a.py
- script file 2
- (4.23 KiB) Downloaded 1913 times
-
- bsheet2_blend_1a.py
- script file 3
- (4.61 KiB) Downloaded 1894 times