Meshpressoメッシュコンバータ

Python Meshpressoモジュールの背景にある考え方は、異なるシミュレーション環境間でモデルデータを変換できるようにすることです。Meshpressoモジュールは、メッシュを最初から作成するか、別のソースからインポートできるように記述されています。次に、メッシュを作成してCalculix入力デックにエクスポートする例を示します。また、.dbファイルにエクスポートして、そこからインポートして戻すこともできます。

# example: prepare db file from scratch
# prepare nodes
n1 = meshpresso.Node(nLabel=1, nCoords=(1.0, 0.0, 0.0))
n2 = meshpresso.Node(nLabel=2, nCoords=(0.0, 1.0, 0.0))
n3 = meshpresso.Node(nLabel=3, nCoords=(0.0, 0.0, 1.0))
# put nodes into the list
nodeList = [n1, n2, n3]
# prepare elements
e1 = meshpresso.Element(elType='C3D4', elLabel=1,
               elConnect=(0, 1, 2),
               partAllNodes=nodeList)
# put elements into the list
elementList = [e1, ]
# create part from nodes and elements
part = meshpresso.PartMesh(partName='TestPart',
                  partNodes=nodeList,
                  partElements=elementList)
# put parts into the list
partList = [part, ]
# create a model
model = meshpresso.ExportMesh(modelName='test',
                     listOfParts=partList)
# do some operations with the model
# for example export model to calculix file
model.exportToCalculix(exportedFilename='test.inp')
# or save it to db file
model.saveToDbFile('dbFile.db')
# example: prepare db file from scratch
# prepare nodes
n1 = meshpresso.Node(nLabel=1, nCoords=(1.0, 0.0, 0.0))
n2 = meshpresso.Node(nLabel=2, nCoords=(0.0, 1.0, 0.0))
n3 = meshpresso.Node(nLabel=3, nCoords=(0.0, 0.0, 1.0))
# put nodes into the list
nodeList = [n1, n2, n3]
# prepare elements
e1 = meshpresso.Element(elType='C3D4', elLabel=1,
               elConnect=(0, 1, 2),
               partAllNodes=nodeList)
# put elements into the list
elementList = [e1, ]
# create part from nodes and elements
part = meshpresso.PartMesh(partName='TestPart',
                  partNodes=nodeList,
                  partElements=elementList)
# put parts into the list
partList = [part, ]
# create a model
model = meshpresso.ExportMesh(modelName='test',
                     listOfParts=partList)
# do some operations with the model
# for example export model to calculix file
model.exportToCalculix(exportedFilename='test.inp')
# or save it to db file
model.saveToDbFile('dbFile.db')

dbファイルからメッシュをロードするには、次の関数を使用します:

# example: load mesh from db file
m = meshpresso.ExportMesh.importFromDbFile(pathToDbFile='dbFile.db')
m.exportToCalculix(exportedFilename='test.inp')

モジュール実装のドキュメントは、次のリンクから参照できます: