资源简介

学习python与OpenGL mywxmain.py为主调用文件 File->Open:打开模型文件,示例为input.dat Tool->solid:设置模型为实体显示 Tool->wire:设置模型为线框显示 Tool->solid+wire:设置模型为实体+线框显示 File->Merge:在模型上加入场数据,示例为温度场数据temp.dat View Field->temperature:可显示温度场云图 鼠标操作: 左键按下移动为旋转 模型移动,光照效果等功能还未加入。现有功能也有待改进。

资源截图

代码片段和文件信息

from structure import *
from readinputfile import *

class Mergeoutputfile(object):
    “““ class to load the outputfiledata and merge to the input file data.“““
    def __init__(selffilename = Nonefilename1 = None):
        self.filename = filename 
        self.filename1 = filename1
        self.sort = 0
        # define below
        # sort = 1    displacement | NDISPLACEMENT
        # sort = 2    temperature  | NTEMPERATURE
        # sort = 3    node stress  | NSTRESS
        # sort = 4    equivalence load  |  NLOAD
        # sort = 5    element stress  |  ESTRESS
        # sort = 6    element main stress and direction  |  EPRISTRESS
        self.structures = [] # one stucture once a time
        self.maxvalue = [-10000.0-10000.0-10000.0-10000.0-10000.0-10000.0]
        self.minvalue = [10000.010000.010000.010000.010000.010000.0]
        self.elementmark = False
        self.nodemark = False
        self.readdata()
    
    def readdata(self):
        dd = Readinputfile(self.filename)
        st = dd.structures[0]
        
        f1 = open(self.filename1‘r‘)
        alllines1 = f1.readlines()
        f1.close
        
        if dd.d == 3:
            self.stressno = 6
        elif dd.d == 2:
            self.stressno = 3
            
        for i in alllines1:
            x = i.split()
            ct = 0
            for jk in enumerate(x):
                if j == 0:
                    if k == “NDISPLACEMENT“:
                        self.sort = 1
                        continue
                    elif k == “NTEMPERATURE“:
                        self.sort = 2
                        continue
                    elif k == “NSTRESS“:
                        self.sort = 3
                        continue
                    elif k == “NLOAD“:
                        self.sort = 4
                        continue
                    elif k == “ESTRESS“:
                        self.sort = 5
                        continue
                    elif k == “EPRISTRESS“:
                        self.sort = 6
                        continue
                    else:
                        yid = int(k)-1

                if self.sort == 1:
                    if j >= 1 and j <= st.d:
                        y = float(k)
                        st.nodes[yid].disp[ct] = y
                        if st.nodes[yid].disp[ct] < self.minvalue[ct]:
                            self.minvalue[ct] = st.nodes[yid].disp[ct]
                        elif st.nodes[yid].disp[ct] > self.maxvalue[ct]:
                            self.maxvalue[ct] = st.nodes[yid].disp[ct]
                        ct += 1
                                            
                elif self.sort == 2:
                    if j == 1:
                        y = float(k)
                        st.nodes[yid].temp = y
                        if st.nodes[yid].temp < self.minvalue[0]:
                

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2009-12-08 14:29  新建文件夹

     文件       2190  2009-05-30 20:18  新建文件夹\input.dat

     文件      13518  2009-06-03 16:11  新建文件夹\mergeoutputfile.py

     文件       7129  2009-07-01 12:18  新建文件夹\mergeoutputfile.pyc

     文件      45811  2009-06-05 13:37  新建文件夹\mywxmain.py

     文件       4142  2009-06-05 13:25  新建文件夹\readinputfile.py

     文件       3358  2009-07-01 12:15  新建文件夹\readinputfile.pyc

     文件      11789  2009-06-04 15:28  新建文件夹\sketch.py

     文件      14365  2009-07-01 12:18  新建文件夹\sketch.pyc

     文件       3360  2009-06-04 15:28  新建文件夹\sketchbase.py

     文件       4970  2009-07-01 12:18  新建文件夹\sketchbase.pyc

     文件       5186  2009-06-01 14:47  新建文件夹\structure.py

     文件       4030  2009-07-01 12:15  新建文件夹\structure.pyc

     文件        715  2009-05-31 22:21  新建文件夹\temp.dat

     文件        361  2009-12-08 14:30  新建文件夹\使用说明.txt

----------- ---------  ---------- -----  ----

               120924                    15


评论

共有 条评论