def main(): alpha = 2 * pi / 5 r_outer = 1 r_inner = r_outer * cos(alpha) / cos(alpha / 2) #r_inner = 0.5 P_outer = 5 * [0] P_inner = 5 * [0] pentagram = [] pentagram_star = [] for idx in range(5): theta_outer = pi / 2 + idx * alpha P_outer[idx] = r_outer * array([cos(theta_outer), sin(theta_outer), 0]) theta_inner = -pi / 2 - 2 * alpha + idx * alpha P_inner[idx] = r_inner * array([cos(theta_inner), sin(theta_inner), 0]) pentagram_star.append(P_outer[idx]) pentagram_star.append(P_inner[idx]) pentagram_star.append(P_outer[0]) pentagram_star.append(P_inner[0]) pentagram = [ P_outer[0], P_outer[3], P_outer[1], P_outer[4], P_outer[2], P_outer[0] ] obj = GWLobject() obj.setVoxels([ P_outer, P_inner, pentagram_star, pentagram, ]) obj.writeGWL('pentagram.gwl') return 0
def block_example(): main_obj = GWLobject() size = 10 height = 5 width = 2 angle_deg = 170 e3_horiz = numpy.cos(numpy.radians(angle_deg)) e3_vert = -1 * numpy.sin(numpy.radians(angle_deg)) distFromCentre = 0.5 * size - 0.5 * e3_horiz * height obj = Parallelepiped() obj.e1_vec3 = [0, 1, 0] obj.e2_vec3 = [1, 0, 0] obj.e3_vec3 = [-e3_horiz, 0, e3_vert] obj.size_vec3 = [size, width, height] obj.center_vec3 = [distFromCentre, 0, 0] obj.computePoints() obj.writeGWL('blockxp.gwl') main_obj.addGWLobject(obj) obj = Parallelepiped() obj.e1_vec3 = [0, 1, 0] obj.e2_vec3 = [1, 0, 0] obj.e3_vec3 = [e3_horiz, 0, e3_vert] obj.size_vec3 = [size, width, height] obj.center_vec3 = [-distFromCentre, 0, 0] obj.computePoints() obj.writeGWL('blockxm.gwl') main_obj.addGWLobject(obj) obj = Parallelepiped() obj.e1_vec3 = [1, 0, 0] obj.e2_vec3 = [0, 1, 0] obj.e3_vec3 = [0, -e3_horiz, e3_vert] obj.size_vec3 = [size, width, height] obj.center_vec3 = [0, distFromCentre, 0] obj.computePoints() obj.writeGWL('blockyp.gwl') main_obj.addGWLobject(obj) obj = Parallelepiped() obj.e1_vec3 = [1, 0, 0] obj.e2_vec3 = [0, 1, 0] obj.e3_vec3 = [0, e3_horiz, e3_vert] obj.size_vec3 = [size, width, height] obj.center_vec3 = [0, -distFromCentre, 0] obj.computePoints() obj.writeGWL('blockym.gwl') main_obj.addGWLobject(obj) main_obj.writeGWL('tilted_box.gwl') return
def main(): if len(sys.argv) > 4: INFILE = sys.argv[1] OUTFILE = sys.argv[2] LP0 = float(sys.argv[3]) K = float(sys.argv[4]) else: print('Usage: ' + sys.argv[0] + ' INFILE OUTFILE LP0 K', file=sys.stderr) sys.exit(-1) obj = GWLobject() obj.readGWL(INFILE) obj.addPowerCompensation(LP0, K) obj.writeGWL(OUTFILE)
#!/usr/bin/env python3 import sys from GWL.GWL_parser import GWLobject obj = GWLobject() obj.readGWL(sys.argv[1]) obj.writeGWL(sys.argv[2])
#% for $phi = 0 to $pitches * $twopi step $twopi / 24 #% #%% LineDistance $LD #%% LineNumber $LN #% #% % Mathematical expressions can contain the basic arithmetic operators +, -, *, /, #% % parenthesis to indicate precedence, and the special functions listed in the manual #% set $xr = $offx - $r * cos($phi) #% set $yr = $offy - $r * sin($phi) #% set $zr = ($pitch / $twopi) * $phi #% #% % Emit computed coordinates #% % Note: coordinates can be literal numbers or variable identifiers only but not mathematical expressions. #% #% $xr $yr $zr #% % Terminate inner for-loop #% end %phi #% #% % Terminate polyline #% Write #% end %offy #%end %offx #% Done obj.writeGWL('foo.gwl') #sim.writeGeoFile('foo.geo') #sim.writeInpFile('foo.inp') sim.writeTorqueJobDirectory('.') print(obj.getLimits())
def writeGWL(self, filename, writingOffset=[0, 0, 0, 0]): self.computePoints() GWLobject.writeGWL(self, filename, writingOffset) return
def writeGWL(self, filename, writingOffset=[0, 0, 0, 0]): print('TubePapa.writeGWL') self.computePoints() GWLobject.writeGWL(self, filename, writingOffset) return
def writeGWL(self, filename, writingOffset=[0, 0, 0, 0]): print('SpiralParabola.writeGWL') self.computePoints() GWLobject.writeGWL(self, filename, writingOffset) return