#!/usr/bin/python # GENERA POLIGONI REGOLARI AD n VERTICI IN FORMATO FBD # produce vertici, linee e superfici, pronto da meshare # Copyright (C) 2005 - Ing. Giorgio Griffon - Venezia # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import math from math import sin,cos,pi ###################################################### #PARAMETRI: INDICARE I VALORI DESIDERATI nomef="figura.fbd" xc=0.0# x centro yc=0.0# y centro rx=0.025#semiasse x ry=0.025#semiasse y z0=0.0#figure sul piano x-y (z=z0) nv=12# n. vertici ldiv='04'# divisioni ld delle linee nomeset="s1"# nome del set in cui vengono inclusi tutti gli elementi ###################################################### doc=open(nomef,'w') doc.write('PNT P0 '+str(xc)+' '+str(yc)+' '+str(z0)+'\n') i=1 while i<=nv: x=xc+rx*cos(2*pi*i/nv) y=yc+ry*sin(2*pi*i/nv) doc.write('PNT P'+str(i)+' '+str(x)+' '+str(y)+' '+str(z0)+'\n') i=i+1 #linee perimetrali: i=1 while i