def plotOrdinates(self,fScript): x= self.dataLines[self.abscissaName] for ordName in self.ordinateNames: script.comment(fScript,ordName+" ordinates.") y= self.getInterpolatedValues(ordName,x.xData) pts= self.getTrfPoints(y); script.makeLayer(fScript,ordName,"_white") script.pline(fScript,pts)
def plotOrdinates(self,fScript): x= self.dataLines[self.abscissaName] for ordName in self.ordinateNames: script.comment(fScript,ordName+" ordinates.") y= self.getInterpolatedValues(ordName,x.xData) pts= self.getTrfPoints(y) script.makeLayer(fScript,ordName,"_white") script.pline(fScript,pts)
def plotVertLines(self,fScript): script.makeLayer(fScript,"grid","_red") x= self.dataLines[self.abscissaName] y= self.getEnvelope(x.xData) pts= self.getTrfPoints(y) for p in pts: pA= [p[0],0.0] pB= p script.line2D(fScript,pA,pB)
def writeAcadScripts(pointsPiquetage, pointsFileName, textFileName): xMax = 0.0 yMax = 0.0 xMin = 1.0e15 yMin = 1.0e15 for key in pointsPiquetage: p = pointsPiquetage[key] xMax = max(p[0], xMax) yMax = max(p[1], yMax) xMin = min(p[0], xMin) yMin = min(p[1], yMin) Ax = xMax - xMin Ay = yMax - yMin diag = math.sqrt(Ax * Ax + Ay * Ay) hText = math.ceil(diag / 100.0) print xMax print xMin print diag print hText fScriptDrawing = open(pointsFileName, "w") fScriptTableau = open(textFileName, "w") script.snap(fScriptTableau, 1.0e-8) script.makeLayer(fScriptDrawing, "points_piquetage", "_white") i = 1 for key in pointsPiquetage: number = key p = pointsPiquetage[key] x = p[0] y = p[1] z = p[2] msg = 'P' + '{}'.format(number) script.point(fScriptDrawing, x, y, z) script.text(fScriptDrawing, x, y, '_left', hText, 0.0, msg) xLabel = 0 yLabel = -1.5 * i * hText script.text(fScriptTableau, xLabel, yLabel, '_right', hText, 0.0, msg) xLabel = 10.0 * hText msg = '{:.3f}'.format(x) script.text(fScriptTableau, xLabel, yLabel, '_right', hText, 0.0, msg) xLabel = 20.0 * hText msg = '{:.3f}'.format(y) script.text(fScriptTableau, xLabel, yLabel, '_right', hText, 0.0, msg) xLabel = 30.0 * hText msg = '{:.3f}'.format(z) script.text(fScriptTableau, xLabel, yLabel, '_right', hText, 0.0, msg) i += 1 fScriptTableau.close() fScriptDrawing.close() os.system("todos " + pointsFileName) os.system("todos " + textFileName)
def writeAcadScripts(pointsPiquetage,pointsFileName,textFileName): xMax= 0.0 yMax= 0.0 xMin= 1.0e15 yMin= 1.0e15 for key in pointsPiquetage: p= pointsPiquetage[key] xMax= max(p[0],xMax) yMax= max(p[1],yMax) xMin= min(p[0],xMin) yMin= min(p[1],yMin) Ax= xMax-xMin Ay= yMax-yMin diag= math.sqrt(Ax*Ax+Ay*Ay) hText= math.ceil(diag/100.0) print(xMax) print(xMin) print(diag) print(hText) fScriptDrawing= open(pointsFileName,"w") fScriptTableau= open(textFileName,"w") script.snap(fScriptTableau,1.0e-8) script.makeLayer(fScriptDrawing,"points_piquetage","_white") i= 1 for key in pointsPiquetage: number= key p= pointsPiquetage[key] x= p[0] y= p[1] z= p[2] msg= 'P'+'{}'.format(number) script.point(fScriptDrawing,x,y,z) script.text(fScriptDrawing,x,y,'_left',hText,0.0,msg) xLabel= 0 yLabel= -1.5*i*hText script.text(fScriptTableau,xLabel,yLabel,'_right',hText,0.0,msg) xLabel= 10.0*hText msg= '{:.3f}'.format(x) script.text(fScriptTableau,xLabel,yLabel,'_right',hText,0.0,msg) xLabel= 20.0*hText msg= '{:.3f}'.format(y) script.text(fScriptTableau,xLabel,yLabel,'_right',hText,0.0,msg) xLabel= 30.0*hText msg= '{:.3f}'.format(z) script.text(fScriptTableau,xLabel,yLabel,'_right',hText,0.0,msg) i+= 1 fScriptTableau.close() fScriptDrawing.close() os.system("todos "+pointsFileName) os.system("todos "+textFileName)
def plotTexts(self,fScript): script.makeLayer(fScript,"texts","_white") x= self.dataLines[self.abscissaName].xData h= (self.yMX-self.zHorizon)*self.vertScale h= math.ceil(h)*self.textScale y= -2*h if (len(self.rowOrder)==0): for key in self.dataLines: self.rowOrder.append(key) for key in self.rowOrder: script.comment(fScript,key+" numbers.") texts= self.dataLines[key].getTexts(fScript,x) i= 0 for xi in x: pX= xi*self.horizScale pY= y script.text(fScript,pX,pY,"_right",h,0.0,texts[i]) i+=1 y-= 2*h #Horizon xLabelHorizon= h yLabelHorizon= h labelHorizon= "Horizon: {:.1f}".format(self.zHorizon) + " m" script.text(fScript,xLabelHorizon,yLabelHorizon,"_left",h,0.0,labelHorizon) #Labels for each line. script.comment(fScript,"labels.") xLabel= (x[0]-(x[1]-x[0]))*self.horizScale yLabel= -2*h for key in self.rowOrder: script.text(fScript,xLabel,yLabel,"_right",h,0.0,key) yLabel-= 2*h #Title. script.comment(fScript,"title.") xTitle= xLabel yTitle= yLabel-2*h script.text(fScript,xTitle,yTitle,"_left",2*h,0.0,self.title) #Scales. xScales= xTitle yScales= yTitle-2*h denomScaleHoriz= str(int(1.0/self.horizScale)) denomScaleVert= str(int(1.0/self.vertScale)) scaleLabel= '1:' + denomScaleHoriz + ' / 1:' + denomScaleVert script.text(fScript,xScales,yScales,"_left",h,0.0,scaleLabel)