pyNastran
0.5.0
pyNastran BDF Reader/Writer, OP2 Parser, and GUI
|
00001 ## GNU Lesser General Public License 00002 ## 00003 ## Program pyNastran - a python interface to NASTRAN files 00004 ## Copyright (C) 2011-2012 Steven Doyle, Al Danial 00005 ## 00006 ## Authors and copyright holders of pyNastran 00007 ## Steven Doyle <mesheb82@gmail.com> 00008 ## Al Danial <al.danial@gmail.com> 00009 ## 00010 ## This file is part of pyNastran. 00011 ## 00012 ## pyNastran is free software: you can redistribute it and/or modify 00013 ## it under the terms of the GNU Lesser General Public License as published by 00014 ## the Free Software Foundation, either version 3 of the License, or 00015 ## (at your option) any later version. 00016 ## 00017 ## pyNastran is distributed in the hope that it will be useful, 00018 ## but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 ## GNU General Public License for more details. 00021 ## 00022 ## You should have received a copy of the GNU Lesser General Public License 00023 ## along with pyNastran. If not, see <http://www.gnu.org/licenses/>. 00024 ## 00025 00026 from __future__ import division, print_function 00027 import os 00028 import platform 00029 00030 import wx 00031 import vtk 00032 #from numpy import zeros, ones 00033 00034 import pyNastran 00035 version = pyNastran.__version__ 00036 00037 #from pyNastran.gui.mouseStyle import MouseStyle 00038 from pyNastran.gui.actionsControl import pyWidget 00039 from pyNastran.gui.nastranIO import NastranIO 00040 from pyNastran.converters.cart3d.cart3dIO import Cart3dIO 00041 from pyNastran.converters.LaWGS.wgsIO import LaWGS_IO 00042 from pyNastran.converters.panair.panairIO import PanairIO 00043 00044 def getScreenCorner(x, y): 00045 #print "wx.GetDisplaySize() = ",wx.GetDisplaySize() 00046 (xScreen,yScreen) = wx.GetDisplaySize() 00047 xCorner = (xScreen-x)//2 00048 yCorner = (yScreen-y)//2 00049 return(xCorner, yCorner) 00050 00051 class Pan(wx.Panel, NastranIO, Cart3dIO, LaWGS_IO, PanairIO): 00052 def __init__(self, *args, **kwargs): 00053 isEdges = kwargs['isEdges'] 00054 self.isNodal = kwargs['isNodal'] 00055 self.isCentroidal = kwargs['isCentroidal'] 00056 del kwargs['isEdges'] 00057 del kwargs['isNodal'] 00058 del kwargs['isCentroidal'] 00059 wx.Panel.__init__(self, *args, **kwargs) 00060 NastranIO.__init__(self) 00061 Cart3dIO.__init__(self) 00062 #isEdges = False 00063 print("isEdges = %s" %(isEdges)) 00064 self.isEdges = isEdges # surface wireframe 00065 self.widget = pyWidget(self, -1) 00066 00067 window = self.widget.GetRenderWindow() 00068 self.iren = vtk.vtkRenderWindowInteractor() 00069 00070 if platform.system=='Windows': 00071 self.iren.SetRenderWindow(window) 00072 00073 self.iText = 0 00074 self.textActors = {} 00075 self.gridResult = vtk.vtkFloatArray() 00076 00077 def createTriAxes(self): 00078 pass 00079 00080 def DisplayEdges(self, event): 00081 self.isEdges = not(self.isEdges) 00082 if 0: 00083 self.getEdges() 00084 00085 try: 00086 hasEdgeActor = hasattr(self, edgeActor) 00087 except: 00088 return 00089 00090 if hasEdgeActor: 00091 prop = self.edgeActor.GetProperty() 00092 #print "dir(prop) = ",dir(prop) 00093 print("visible = %s" %(prop.GetEdgeVisibility())) 00094 if self.isEdges: 00095 prop.EdgeVisibilityOn() 00096 print("edges are now on\n") 00097 else: 00098 prop.EdgeVisibilityOff() 00099 print("edges are now off\n") 00100 prop.Modified() 00101 #prop.Update() 00102 self.edgeActor.Modified() 00103 #self.edgeActor.Update() 00104 if 0: 00105 print("dir(widget) = %s" %(dir(self.widget))) 00106 00107 actors = self.widget._CurrentRenderer.GetActors() 00108 numActors = actors.GetNumberOfItems() 00109 actors.InitTraversal() 00110 for i in xrange(0, numActors): 00111 print("iactor = %i" %(i)) 00112 actor = actors.GetNextItem() 00113 00114 try: 00115 if self.isEdges: 00116 actor.getProperty().EdgeVisibilityOn() 00117 else: 00118 actor.getProperty().EdgeVisibilityOff() 00119 print("set the edges...") 00120 except: 00121 raise 00122 #actor.GetProperty().SetLineWidth(0.0) 00123 window = self.widget.GetRenderWindow() 00124 window.Render() 00125 self.widget.Render() 00126 self.widget.Update() 00127 00128 def onSetToWireframe(self, event): 00129 if self.bdfFileName is not None: 00130 self.widget.Wireframe() 00131 self.widget.Update() 00132 00133 def onSetToSurface(self, event): 00134 if self.bdfFileName is not None: 00135 self.widget.Surface() 00136 self.widget.Update() 00137 00138 def onSetToFlatShading(self, event): # Flat 00139 if self.bdfFileName is not None: 00140 actors = self.widget._CurrentRenderer.GetActors() 00141 numActors = actors.GetNumberOfItems() 00142 actors.InitTraversal() 00143 for i in xrange(0, numActors): 00144 actor = actors.GetNextItem() 00145 actor.GetProperty().SetInterpolationToFlat() 00146 self.widget.Render() 00147 ### 00148 00149 def onSetToGouraudShading(self, event): # Gouraud 00150 if self.bdfFileName is not None: 00151 actors = self.widget._CurrentRenderer.GetActors() 00152 numActors = actors.GetNumberOfItems() 00153 actors.InitTraversal() 00154 for i in xrange(0, numActors): 00155 actor = actors.GetNextItem() 00156 actor.GetProperty().SetInterpolationToGouraud() 00157 self.widget.Render() 00158 ### 00159 00160 def onSetToPhongShading(self, event): # Phong 00161 if self.bdfFileName is not None: 00162 actors = self.widget._CurrentRenderer.GetActors() 00163 numActors = actors.GetNumberOfItems() 00164 actors.InitTraversal() 00165 for i in xrange(0, numActors): 00166 actor = actors.GetNextItem() 00167 actor.GetProperty().SetInterpolationToPhong() 00168 self.widget.Render() 00169 ### 00170 00171 def getColors(self): 00172 pass 00173 #Merger = vtk.vtkMergeFilter() 00174 #Filter = vtk.vtkGeometryFilter() 00175 #Filter.SetInput(self.aQuadGrid) 00176 00177 #Filter = vtk.vtkRotationFilter() 00178 #Filter.SetCenter(0., 0., 0.) 00179 #Filter.SetNumberOfCopies(1) 00180 #Filter.SetInput(aQuadGrid) 00181 #Filter.Update() 00182 00183 def getEdges(self): 00184 edges = vtk.vtkExtractEdges() 00185 00186 edges.SetInput(self.grid) 00187 self.edgeMapper = vtk.vtkPolyDataMapper() 00188 self.edgeMapper.SetInput(edges.GetOutput()) 00189 #edges.GetOutput().ReleaseDataFlagOn() 00190 #self.edgeMapper.EdgeVisibilityOff() 00191 00192 self.edgeActor = vtk.vtkActor() 00193 self.edgeActor.SetMapper(self.edgeMapper) 00194 self.edgeActor.GetProperty().SetColor(0, 0, 0) 00195 prop = self.edgeActor.GetProperty() 00196 #prop.SetLineWidth(0.0) 00197 if self.isEdges: 00198 prop.EdgeVisibilityOn() 00199 else: 00200 prop.EdgeVisibilityOff() 00201 00202 self.rend.AddActor(self.edgeActor) 00203 00204 print("visible = %s" %(prop.GetEdgeVisibility())) 00205 #self.edgeActor.Update() 00206 00207 00208 def addGeometry(self): 00209 print("addGeometry") 00210 self.aQuadMapper = vtk.vtkDataSetMapper() 00211 self.aQuadMapper.SetInput(self.grid) 00212 00213 #lut = vtk.vtkLookupTable() 00214 #aQuadMapper.SetLookupTable(lut) 00215 00216 #aQuadMapper.SetInput(Filter.GetOutput()) 00217 geometryActor = vtk.vtkActor() 00218 #geometryActor.GetOutput().ReleaseDataFlagOn() 00219 geometryActor.SetMapper(self.aQuadMapper) 00220 #geometryActor.AddPosition(2, 0, 2) 00221 #geometryActor.GetProperty().SetDiffuseColor(0, 0, 1) # blue 00222 prop = geometryActor.GetProperty() 00223 #prop = geometryActor.GetProperty() 00224 #prop.SetColor(0.9, 0.9, 0.9) 00225 #prop.SetColor(1., 1., 1.) 00226 #prop.SetAmbient(0.9) 00227 #prop.SetDiffuse(0.1) 00228 #prop.SetSpecular(0.1) 00229 00230 prop.SetDiffuseColor(1, 0, 0) # red 00231 #prop = geometryActor.SetBackfaceProperty(prop) 00232 00233 #geometryActor.GetProperty().SetBackfaceProperty(1, 0, 0) # red 00234 #geometryActor.GetProperty().BackfaceCullingOn() # hidges elements that have normals not facing camera 00235 #geometryActor.GetProperty().SetLineWidth(0.5) 00236 self.rend.AddActor(geometryActor) 00237 #self.rend.TwoSidedLightingOn() 00238 #self.rend.LightFollowCameraOn() 00239 00240 def addAltGeometry(self): 00241 print("addAltGeometry") 00242 aQuadMapper = vtk.vtkDataSetMapper() 00243 aQuadMapper.SetInput(self.grid2) 00244 #aQuadMapper.SetInput(Filter.GetOutput()) 00245 geometryActor = vtk.vtkActor() 00246 geometryActor.SetMapper(aQuadMapper) 00247 #geometryActor.AddPosition(2, 0, 2) 00248 #geometryActor.GetProperty().SetDiffuseColor(0, 0, 1) # blue 00249 geometryActor.GetProperty().SetDiffuseColor(1, 1, 0) # green 00250 self.rend.AddActor(geometryActor) 00251 vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset() 00252 00253 def buildLookupTable2(self): 00254 scalarBar = vtkScalarBarActor() 00255 scalarBar.SetLookupTable(mapper.GetLookupTable()) 00256 scalarBar.SetTitle("Title") 00257 scalarBar.SetNumberOfLabels(4) 00258 00259 # Create a lookup table to share between the mapper and the scalarbar 00260 hueLut =vtkLookupTable() 00261 00262 hueLut.SetTableRange(0, 1) 00263 hueLut.SetHueRange(0, 1) 00264 hueLut.SetSaturationRange(1, 1) 00265 hueLut.SetValueRange(1, 1) 00266 hueLut.Build() 00267 mapper.SetLookupTable(hueLut) 00268 scalarBar.SetLookupTable(hueLut) 00269 mapper.ScalarVisibilityOn() 00270 mapper.SetScalarModeToUsePointData() 00271 mapper.SetColorModeToMapScalars() 00272 00273 def buildLookupTable(self): 00274 self.colorFunction = vtk.vtkColorTransferFunction() 00275 self.colorFunction.SetColorSpaceToHSV() 00276 self.colorFunction.HSVWrapOff() 00277 00278 drange = [10., 20.] 00279 self.colorFunction.AddRGBPoint(drange[0], 0.0, 0.0, 1.0) 00280 self.colorFunction.AddRGBPoint(drange[1], 1.0, 0.0, 0.0) 00281 00282 self.scalarBar.SetTitle("Title1") 00283 self.scalarBar.SetLookupTable(self.colorFunction) 00284 self.scalarBar.SetOrientationToVertical() 00285 00286 self.scalarBar.SetHeight(0.9) 00287 self.scalarBar.SetWidth(0.20) # the width is set first 00288 self.scalarBar.SetPosition(0.77, 0.1) # after the width is set, this is adjusted 00289 #self.scalarBar.SetPosition2(0.1, 0.3) 00290 #print self.scalarBar.GetPosition() 00291 00292 propTitle = vtk.vtkTextProperty() 00293 propTitle.SetFontFamilyToArial() 00294 #propTitle.ItalicOff() 00295 propTitle.BoldOn() 00296 propTitle.ShadowOn() 00297 00298 propLabel = vtk.vtkTextProperty() 00299 propLabel.BoldOff() 00300 propLabel.ShadowOn() 00301 00302 scalar_range = self.grid.GetScalarRange() 00303 self.aQuadMapper.SetScalarRange(scalar_range) 00304 self.aQuadMapper.SetLookupTable(self.colorFunction) 00305 00306 #self.scalarBar.SetTitleTextProperty(propTitle); 00307 #self.scalarBar.SetLabelTextProperty(propLabel); 00308 self.scalarBar.SetLabelFormat("%i") 00309 00310 # allows 0-1 to be nice number when ranging values (gotta pick something) 00311 self.scalarBar.SetNumberOfLabels(11) 00312 self.scalarBar.SetMaximumNumberOfColors(11) 00313 00314 #self.scalarBar.VisibilityOff() # first load -> scalar bar off 00315 #self.scalarBar.ShadowOn() 00316 #self.scalarBar.RepositionableOn() 00317 self.rend.AddActor(self.scalarBar) 00318 #return scalarBar 00319 00320 def UpdateScalarBar(self, Title, minValue, maxValue, dataFormat): 00321 """ 00322 @param Title the scalar bar title 00323 @param minValue the blue value 00324 @param maxValue the red value 00325 @param dataFormat '%g','%f','%i',etc. 00326 """ 00327 #drange = [10.,20.] 00328 self.colorFunction.RemoveAllPoints() 00329 self.colorFunction.AddRGBPoint(minValue, 0.0, 0.0, 1.0) 00330 self.colorFunction.AddRGBPoint(maxValue, 1.0, 0.0, 0.0) 00331 #self.scalarBar.SetLookupTable(self.colorFunction) 00332 00333 self.scalarBar.SetTitle(Title) 00334 self.scalarBar.SetLabelFormat(dataFormat) 00335 00336 nValues = 11 00337 if (Title in ['Element_ID','Eids','Region'] and 00338 (maxValue-minValue+1) < 11): 00339 nValues = int(maxValue-minValue)+1 00340 #print "need to adjust axes...maxValue=%s" %(maxValue) 00341 #if dataFormat=='%.0f' and maxValue> 00342 00343 self.scalarBar.SetNumberOfLabels(nValues) 00344 self.scalarBar.SetMaximumNumberOfColors(nValues) 00345 self.scalarBar.Modified() 00346 00347 def Update(self): 00348 #print '\n'.join(dir(self.widget)) 00349 window = self.widget.GetRenderWindow() 00350 self.rend.ResetCamera() 00351 window.Render() 00352 self.widget.Update() 00353 #self.rend.Update() 00354 #self.renWin.Render() 00355 00356 def startWireframeLight(self): 00357 #light = vtk.vtkLight() 00358 #light.SetFocalPoint(self.grid.GetOutput().GetCenter()) 00359 #self.rend.AddLight(light) 00360 sphere1.GetProperty().SetColor(1, 1, 1) 00361 sphere1.GetProperty().SetAmbient(1.0) 00362 sphere1.GetProperty().SetDiffuse(0) 00363 sphere1.GetProperty().SetSpecular(0) 00364 00365 def main(self): 00366 print("main builder") 00367 window = self.widget.GetRenderWindow() 00368 window.AddRenderer(self.rend) 00369 00370 self.addGeometry() 00371 self.addAltGeometry() 00372 self.buildLookupTable() 00373 #self.startWireframeLight() 00374 self.createTriAxes() 00375 00376 textSize = 15 00377 self.createText([5,50],'Max ', textSize) # text actor 0 00378 self.createText([5,35],'Min ', textSize) # text actor 1 00379 self.createText([5,20],'Word1', textSize) # text actor 2 00380 self.createText([5,5 ],'Word2', textSize) # text actor 3 00381 #self.createText([5,35],'Yet Again', textSize) 00382 00383 # Create the usual rendering stuff. 00384 if self.isEdges: 00385 self.getEdges() 00386 self.rend.GetActiveCamera().ParallelProjectionOn() 00387 self.rend.SetBackground(.1, .2, .4) 00388 vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset() 00389 self.rend.ResetCamera() 00390 00391 #iren.Start() 00392 00393 def createText(self, position, label, textSize=18, movable=False): 00394 # create a text actor 00395 txt = vtk.vtkTextActor() 00396 txt.SetInput(label) 00397 txtprop=txt.GetTextProperty() 00398 #txtprop.SetFontFamilyToArial() 00399 txtprop.SetFontSize(textSize) 00400 txtprop.SetColor(1, 1, 1) 00401 txt.SetDisplayPosition(*position) 00402 00403 #print "dir(text) = ",dir(txt) 00404 txt.VisibilityOff() 00405 00406 #txt.SetDisplayPosition(5,5) # bottom left 00407 #txt.SetDisplayPosition(5,95) 00408 00409 #print dir(txt) 00410 #txt.SetPosition(0.1,0.5) 00411 00412 # assign actor to the renderer 00413 self.rend.AddActor(txt) 00414 self.textActors[self.iText] = txt 00415 self.iText+=1 00416 00417 def TurnTextOff(self): 00418 for (i,text) in self.textActors.iteritems(): 00419 text.VisibilityOff() 00420 00421 def TurnTextOn(self): 00422 for (i,text) in self.textActors.iteritems(): 00423 text.VisibilityOn() 00424 00425 def getWindow(self): 00426 return self.widget.GetRenderWindow() 00427 00428 def getWindowName(self,winName=''): 00429 return "pyNastran v%s - %s" %(version, self.bdfFileName) 00430 00431 def setWindowName(self,winName=''): 00432 window = self.getWindow() 00433 window.SetWindowName("pyNastran v%s - %s" %(version, self.bdfFileName)) 00434 00435 def isStress(self,op2,ID): 00436 if (ID in op2.solidStress or ID in op2.plateStress or 00437 ID in op2.compositePlateStress or ID in op2.barStress or 00438 ID in op2.beamStress or ID in op2.rodStress): 00439 return True 00440 return False 00441 00442 def incrementCycle(self): 00443 if self.iCase is not self.nCases: 00444 self.iCase +=1 00445 else: 00446 self.iCase = 0 00447 00448 if len(self.caseKeys)>0: 00449 key = self.caseKeys[self.iCase] 00450 print("key = %s" %(str(key))) 00451 if key[2] == 3: # vector size=3 -> vector, skipping ??? 00452 self.incrementCycle() 00453 foundCases = True 00454 else: 00455 print("No Results found. Many results are not supported " 00456 "in the GUI.\n") 00457 foundCases = False 00458 #print "next key = ",key 00459 return foundCases 00460 00461 def cycleResults(self): 00462 plotNodal = self.isNodal 00463 plotCentroidal = self.isCentroidal 00464 #print("plotNodal=%s plotCentroidal=%s" %(plotNodal,plotCentroidal)) 00465 #print("nCases = %i" %(self.nCases+1)) 00466 if self.nCases == 0: 00467 return 00468 00469 foundCases = self.incrementCycle() 00470 #if foundCases: 00471 if 1: 00472 print("incremented case") 00473 #self.gridResult.Reset() 00474 gridResult = vtk.vtkFloatArray() 00475 emptyResult = vtk.vtkFloatArray() 00476 00477 key = self.caseKeys[self.iCase] 00478 case = self.resultCases[key] 00479 print("len(case) = %i" %(len(case))) 00480 (subcaseID, resultType, vectorSize, location, dataFormat) = key 00481 00482 if location == 'centroid' and plotCentroidal: 00483 #allocationSize = vectorSize*location (where location='centroid'-> self.nElements) 00484 gridResult.Allocate(self.nElements, 1000) 00485 elif location == 'nodal' and plotNodal: 00486 #allocationSize = vectorSize*self.nNodes # (where location='node'-> self.nNodes) 00487 gridResult.Allocate(self.nNodes*vectorSize, 1000) 00488 gridResult.SetNumberOfComponents(vectorSize) 00489 else: 00490 print("***%s skipping" %(location)) 00491 ### 00492 00493 #self.iSubcaseNameMap[self.iSubcase] = [Subtitle,Label] 00494 caseName = self.iSubcaseNameMap[subcaseID] 00495 (subtitle,label) = caseName 00496 00497 print("subcaseID=%s resultType=%s subtitle=%s label=%s" 00498 %(subcaseID, resultType, subtitle, label)) 00499 00500 for value in case: 00501 maxValue = value 00502 minValue = value 00503 break 00504 00505 for value in case: 00506 maxValue = max(value, maxValue) 00507 minValue = min(value, minValue) 00508 00509 # flips sign to make colors go from blue -> red 00510 normValue = maxValue-minValue 00511 #print "case = ",case 00512 #if normValue==0.: # avoids division by 0. 00513 # normValue = 1. 00514 00515 valueSet = set() 00516 if vectorSize == 1: 00517 #print "minValue = ",min(case) 00518 for value in case: 00519 gridResult.InsertNextValue(value) 00520 if len(valueSet) < 20: 00521 valueSet.add(value) 00522 ### 00523 else: # vectorSize=3 00524 pass 00525 #for value in case: 00526 # self.gridResult.InsertNextTuple3(value) # x,y,z 00527 ### 00528 ### 00529 print("max=%g min=%g norm=%g\n" %(maxValue, minValue, normValue)) 00530 00531 nValueSet = len(valueSet) 00532 00533 self.textActors[0].SetInput('Max: %g' %(maxValue)) # max 00534 self.textActors[1].SetInput('Min: %g' %(minValue)) # min 00535 self.textActors[2].SetInput('Subcase=%s Subtitle: %s' %(subcaseID,subtitle)) # info 00536 self.textActors[3].SetInput('Label: %s' %(label)) # info 00537 self.UpdateScalarBar(resultType, minValue, maxValue, dataFormat) 00538 #self.scalarBar.SetNumberOfLabels(nValueSet) 00539 #self.scalarBar.SetMaximumNumberOfColors(nValueSet) 00540 #prop = self.scalarBar.GetLabelTextProperty() 00541 #fontSize = prop.GetFontSize() 00542 #print "fontSize = ",fontSize 00543 #prop.SetFontSize(40) 00544 00545 ## @todo results can only go from centroid->node and not back to 00546 ## centroid 00547 #print dir(self.grid) 00548 #self.grid.Reset() 00549 if location == 'centroid' and plotCentroidal: 00550 #self.grid.GetPointData().Reset() 00551 self.grid.GetCellData().SetScalars(gridResult) 00552 print("***plotting vector=%s skipping - subcaseID=%s resultType=%s subtitle=%s label=%s" %(vectorSize,subcaseID,resultType,subtitle,label)) 00553 self.grid.Modified() 00554 elif location == 'nodal' and plotNodal: 00555 self.grid.GetCellData().Reset() 00556 if vectorSize == 1: 00557 print("***plotting vector=%s skipping - subcaseID=%s resultType=%s subtitle=%s label=%s" %(vectorSize,subcaseID,resultType,subtitle,label)) 00558 self.grid.GetPointData().SetScalars(gridResult) 00559 self.grid.Modified() 00560 else: 00561 print("***nodal vector=%s skipping - subcaseID=%s resultType=%s subtitle=%s label=%s" %(vectorSize,subcaseID,resultType,subtitle,label)) 00562 #pass 00563 # self.grid.GetPointData().SetScalars(self.gridResult) 00564 #print "***nodal skipping - subcaseID=%s resultType=%s subtitle=%s label=%s" %(subcaseID,resultType,subtitle,label) 00565 else: 00566 print("***%s skipping - subcaseID=%s resultType=%s subtitle=%s label=%s" %(location,subcaseID,resultType,subtitle,label)) 00567 ### 00568 ### if results 00569 00570 def onKeyPress(self, obj, event): 00571 rwi = obj 00572 key = rwi.GetKeySym() 00573 #print "*Pressed %s" %(key) 00574 00575 def buildVTK(self,bdfFileName=None,dirname=None): 00576 self.bdfFileName = bdfFileName 00577 00578 self.rend = vtk.vtkRenderer() 00579 self.scalarBar = vtk.vtkScalarBarActor() 00580 self.loadNastranGeometry(self.bdfFileName,dirname,self.isNodal,self.isCentroidal) 00581 self.main() 00582 00583 #self.renWin = vtk.vtkRenderWindow() 00584 #renWin = window 00585 00586 cam = self.rend.GetActiveCamera() 00587 mouseArgs = {'pipeline':self, 'camera':cam} 00588 00589 xSize = 800 00590 ySize = 600 00591 (x,y) = getScreenCorner(xSize, ySize) 00592 #window.SetSize(xSize,ySize) 00593 #window.SetPosition(x,y) 00594 00595 #iren = wxVTKRenderWindowInteractor(self,-1) 00596 #iren = vtk.vtkRenderWindowInteractor() 00597 #mouseStyle = MouseStyle(mouseArgs,iren) 00598 #iren.SetInteractorStyle(mouseStyle) 00599 #window = self.widget.GetRenderWindow() 00600 #iren.SetRenderWindow(window) 00601 00602 #iren.AddObserver("KeyPressEvent", self.OnKeyPress) 00603 00604 #print "type(ren) = ",type(self.rend) 00605 #self.rend.GetActiveCamera().Zoom(2.0) 00606 00607 #self.setWindowName() 00608 # Render the scene and start interaction. 00609 #iren.Initialize() 00610 #iren.Start() 00611 #window.Render() 00612