import gmessi GmshConverter = gmessi.gmESSIPython() GmshConverter.loadMshFile("111.msh") Inputfile = open("111.gmessi", "r") for line in Inputfile: GmshConverter.Convert(line) ElementList = GmshConverter.getSphereSelectionData("Physical_Group#1", 0.5, 1.5, 0.5, 0.5).ElementList NodeList = GmshConverter.getSphereSelectionData("Physical_Group#1", 0.5, 1.5, 0.5, 0.5).NodeList NodeList = GmshConverter.getSphereSelectionData("All", 1.5, 0, 0, 0).NodeList GmshConverter.CreatePhysicalGroup("HelloWorld", NodeList, ElementList) GmshConverter.UpdateGmshFile() GmshConverter.Convert("[Add_Node_Load_Linear{Physical_Group#1,Fx,10*N}]") GmshConverter.Convert("Add_20NodeBrick_elastic{Physical_Group#1,1}") GmshConverter.Convert("[Add_Element_Self_Weight{Physical_Group#1,1}]") GmshConverter.pwd GmshConverter.GmshFile GmshConverter.GeometryFile GmshConverter.LoadFile GmshConverter.MainFile
import gmessi Example_5 = gmessi.gmESSIPython() Example_5.loadMshFile("Example_5.msh") Inputfile = open('Example_5.gmessi', 'r') for line in Inputfile: line = line.partition('//')[0] line = line.rstrip() if (line): Example_5.Convert(line)
import gmessi PresentationExample = gmessi.gmESSIPython() PresentationExample.loadMshFile("PresentationExample.msh") Inputfile = open('PresentationExample.gmessi', 'r') for line in Inputfile: line = line.partition('//')[0] line = line.rstrip() if (line): PresentationExample.Convert(line)
import sys import gmessi as GMESSI import os from math import * gmESSI = GMESSI.gmESSIPython() #**************************************************************** # DRM 3D Example #**************************************************************** gmESSI.loadGmshFile("column.msh") gmESSI.setSimulationDir("./column_fei",1) gmESSI.setMainFile(gmESSI.SimulationDir+ "main.fei") gmESSI.setNodeFile(gmESSI.SimulationDir+ "node.fei") gmESSI.setElementFile(gmESSI.SimulationDir+ "element.fei") gmESSI.setLoadFile(gmESSI.SimulationDir+ "load.fei") #2 1 "bottom_surface" #3 2 "all_volume" gmESSI.Convert("[Add_All_Node{ unit:= m, nof_dofs:= 3}]") gmESSI.CopyCommand("\n");
import sys import gmessi import os from math import * GmESSI = gmessi.gmESSIPython() GmESSI.loadMshFile("Example_2.msh") #0 1 "All_Points" #1 3 "All_Lines" #2 2 "All_Surfaces" #2 5 "ApplySurfaceLoad" #2 6 "SurfaceToBeFixed" #3 4 "All_Volumes" #// My new model ANALYSIS_FILE = open(GmESSI.MainFile,'a');ANALYSIS_FILE.write("// My new model\n");ANALYSIS_FILE.close(); GmESSI.Convert("[Define_Model_Name{ModelName:= \"Cantilever_Analysis\"}]") ANALYSIS_FILE = open(GmESSI.MainFile,'a');ANALYSIS_FILE.write('\n');ANALYSIS_FILE.close(); GmESSI.Convert("[Add_All_Node{Unit:= m, NumDofs:= 3}]") ANALYSIS_FILE = open(GmESSI.MainFile,'a');ANALYSIS_FILE.write('\n');ANALYSIS_FILE.close();