Skip to content

Commit

Permalink
FEM: inout tetgen converter, guard Gui commands to be able to load th…
Browse files Browse the repository at this point in the history
…e module in CMD mode without problems
  • Loading branch information
berndhahnebach committed May 18, 2019
1 parent 41c828a commit 06fffbd
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/Mod/Fem/feminout/convert2TetGen.py
Expand Up @@ -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
# @{
Expand Down Expand Up @@ -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.")

Expand Down

0 comments on commit 06fffbd

Please sign in to comment.