====== Scripting ======
You can interact with Phänotyp via scripting. Experienced users can use this feature already when studying the Guithub of Phänotyp. This is a minimal example of accessing the functions via the text editor in Blender 3D directly. When structure, supports and profiles are set correctly, this script is doing a simple single thread analysis followed by three sectional optimizations.
import bpy
from phaenotyp import operators
# run single fram analysis
operators.calculate_single_frame()
# run utilization optimization for 3 times
for i in range(3):
operators.optimize_utilization()
You can achieve the same result when running this operations separately.
import bpy
from phaenotyp import basics, calculation, geometry
# get basic variables
scene = bpy.context.scene
frame = scene.frame_current
members = scene[""]["members"]
# calculate new properties for each member
geometry.update_members_pre()
# create a truss object for PyNite
truss = calculation.prepare_fea()
# run singlethread and get results at this frame
feas = calculation.run_st(truss, frame)
# wait for it and interweave results to data
calculation.interweave_results(feas, members)
# do sectional optimizatoin by utilization for three times
for i in range(3):
# get new diameters for each member
calculation.utilization_sectional()
# calculate new properties for each member
geometry.update_members_pre()
# created a truss object of PyNite
truss = calculation.prepare_fea()
# run singlethread and get results
feas = calculation.run_st(truss, frame)
# wait for it and interweave results to data
calculation.interweave_results(feas, members)
# calculate new visualization-mesh
geometry.update_members_post()
# update view
basics.view_vertex_colors()
# print the first members axial value at the first frame at its start
print(members['0']['axial']['1'][0])