FEM: inout tetgen converter, guard Gui commands to be able to load the module in CMD mode without problems
This commit is contained in:
@@ -26,11 +26,12 @@
|
||||
|
||||
# Make mesh of pn junction in TetGen format
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
App = FreeCAD # shortcut
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
Gui = FreeCADGui # shortcut
|
||||
# import Part
|
||||
import Mesh
|
||||
App = FreeCAD # shortcut
|
||||
Gui = FreeCADGui # shortcut
|
||||
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
@@ -277,22 +278,26 @@ def createMesh():
|
||||
nmesh.removeDuplicatedFacets()
|
||||
pnMesh.Mesh = nmesh
|
||||
|
||||
# Hide all boxes
|
||||
for box in BoxList:
|
||||
Gui.hideObject(box)
|
||||
# # Remove all boxes
|
||||
if FreeCAD.GuiUp:
|
||||
# Hide all boxes
|
||||
for box in BoxList:
|
||||
Gui.hideObject(box)
|
||||
|
||||
# Remove all boxes
|
||||
# for box in BoxList:
|
||||
# App.ActiveDocument.removeObject(box.Name)
|
||||
|
||||
# Update document
|
||||
AppPyDoc.recompute()
|
||||
|
||||
## export to TenGen *.poly (use File|Export instead)
|
||||
# export to TenGen *.poly (use File|Export instead) *****
|
||||
# filePath = "/home/tig/tmp/tetgen/pnJunction.poly"
|
||||
# exportMeshToTetGenPoly(pnMesh.Mesh,filePath,beVerbose)
|
||||
|
||||
Gui.activeDocument().activeView().viewAxometric()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
if FreeCAD.GuiUp:
|
||||
Gui.activeDocument().activeView().viewAxometric()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
if beVerbose == 1:
|
||||
FreeCAD.Console.PrintMessage("\nScript finished without errors.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user