from harmonic.cad.shapes import * from harmonic.cad.manager import * from harmonic.mz.manager import * from java.lang import * class MakeHelix: radius = 1.0 height = 1.0 turns = 3 samplesPerTurn = 64 def make_helix(self): shape = PolylineShape() shape.setName("Helix") angle = 0 z = 0 da = Math.PI*2/self.samplesPerTurn dz = self.height/self.samplesPerTurn i = 0 while i < self.samplesPerTurn*self.turns + 1: x = self.radius*Math.cos(angle) y = self.radius*Math.sin(angle) shape.points.addVert(x, y, z) z += dz angle += da i = i+1 return shape def add_shape(): CAD.addShape(MakeHelix().make_helix()) MZ.modules().loadModule("harmonic.cad.manager.CAD")