diff --git a/src/GEOReverse/Modules/MCNPinput.py b/src/GEOReverse/Modules/MCNPinput.py index fcc53bb0..55a26bb4 100644 --- a/src/GEOReverse/Modules/MCNPinput.py +++ b/src/GEOReverse/Modules/MCNPinput.py @@ -1,14 +1,16 @@ +import math import os -import sys import re + import FreeCAD -from GEOReverse.Modules.Parser import parser as mp -from GEOReverse.Modules.remh import cell_card_string, remove_hash -from GEOReverse.Modules.Objects import * -import math import numpy as np from numpy import linalg as LA +from .Objects import * +from .Parser import parser as mp +from .remh import cell_card_string, remove_hash + + class MCNPinput: def __init__(self,name): if not os.path.isfile(name): diff --git a/src/GEOReverse/Modules/Objects.py b/src/GEOReverse/Modules/Objects.py index bfcdaf61..3bf72afb 100644 --- a/src/GEOReverse/Modules/Objects.py +++ b/src/GEOReverse/Modules/Objects.py @@ -1,10 +1,13 @@ -from GEOReverse.Modules.buildSolidCell import BuildSolid -import FreeCAD, Part -import numpy as np import math -from GEOReverse.Modules.remh import cline -from GEOReverse.Modules.Utils.booleanFunction import outterTerms,BoolSequence -from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids + +import FreeCAD +import numpy as np +import Part + +from .buildSolidCell import BuildSolid +from .remh import cline +from .Utils.booleanFunction import BoolSequence, outterTerms + class CADCell: def __init__(self,stringCell=None): diff --git a/src/GEOReverse/Modules/Parser/PartialFormatter.py b/src/GEOReverse/Modules/Parser/PartialFormatter.py index f4d050cf..2b08e050 100644 --- a/src/GEOReverse/Modules/Parser/PartialFormatter.py +++ b/src/GEOReverse/Modules/Parser/PartialFormatter.py @@ -1,4 +1,5 @@ import string + version = '3.6' def make_label(item): diff --git a/src/GEOReverse/Modules/Parser/parser.py b/src/GEOReverse/Modules/Parser/parser.py index 6c4bec26..914e6379 100644 --- a/src/GEOReverse/Modules/Parser/parser.py +++ b/src/GEOReverse/Modules/Parser/parser.py @@ -4,10 +4,11 @@ Functions for parsing MCNP input files. """ +import os import re import warnings -import os -from GEOReverse.Modules.Parser.PartialFormatter import PartialFormatter + +from .PartialFormatter import PartialFormatter version = '3.6' diff --git a/src/GEOReverse/Modules/Utils/BooleanSolids.py b/src/GEOReverse/Modules/Utils/BooleanSolids.py index def406cf..2fcf28f2 100644 --- a/src/GEOReverse/Modules/Utils/BooleanSolids.py +++ b/src/GEOReverse/Modules/Utils/BooleanSolids.py @@ -2,11 +2,12 @@ # Conversion to MCNP v0.0 # Only one solid and planar surfaces # -import FreeCAD -import BOPTools.SplitAPI import math -import re -from GEOReverse.Modules.Utils.booleanFunction import BoolSequence + +import BOPTools.SplitAPI +import FreeCAD + +from .booleanFunction import BoolSequence BoolVals = (None,True,False) diff --git a/src/GEOReverse/Modules/Utils/booleanFunction.py b/src/GEOReverse/Modules/Utils/booleanFunction.py index 947b5dda..fd2d944b 100644 --- a/src/GEOReverse/Modules/Utils/booleanFunction.py +++ b/src/GEOReverse/Modules/Utils/booleanFunction.py @@ -1,4 +1,5 @@ import re + mostinner=re.compile(r"\([^\(^\)]*\)") # identify most inner parentheses number =re.compile(r"(?P[-+]?\d+)") mix =re.compile(r"(?P([-+]?\d+|\[0+\]))") diff --git a/src/GEOReverse/Modules/XMLParser.py b/src/GEOReverse/Modules/XMLParser.py index 20113b3b..55f7c0af 100644 --- a/src/GEOReverse/Modules/XMLParser.py +++ b/src/GEOReverse/Modules/XMLParser.py @@ -1,4 +1,5 @@ -from GEOReverse.Modules.remh import cline +from .remh import cline + class cellCARD: diff --git a/src/GEOReverse/Modules/XMLinput.py b/src/GEOReverse/Modules/XMLinput.py index a28ab1dd..a801e557 100644 --- a/src/GEOReverse/Modules/XMLinput.py +++ b/src/GEOReverse/Modules/XMLinput.py @@ -1,14 +1,15 @@ +import math import os -import sys import re +import xml.etree.ElementTree as ET + import FreeCAD -from GEOReverse.Modules.remh import cell_card_string, remove_hash -from GEOReverse.Modules.Objects import * -from GEOReverse.Modules.XMLParser import get_cards -import math import numpy as np from numpy import linalg as LA -import xml.etree.ElementTree as ET + +from .Objects import * +from .XMLParser import get_cards + class XMLinput: def __init__(self,name): diff --git a/src/GEOReverse/Modules/buildCAD.py b/src/GEOReverse/Modules/buildCAD.py index aadcadf0..8a035948 100644 --- a/src/GEOReverse/Modules/buildCAD.py +++ b/src/GEOReverse/Modules/buildCAD.py @@ -1,9 +1,7 @@ -import FreeCAD, Part import BOPTools.SplitAPI -from GEOReverse.Modules.buildSolidCell import FuseSolid -from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids -from GEOReverse.Modules.Utils.booleanFunction import BoolSequence +from .buildSolidCell import FuseSolid +from .Utils.booleanFunction import BoolSequence def buildCAD(UnivCell,data,config): diff --git a/src/GEOReverse/Modules/buildSolidCell.py b/src/GEOReverse/Modules/buildSolidCell.py index dbd524bf..78d579eb 100644 --- a/src/GEOReverse/Modules/buildSolidCell.py +++ b/src/GEOReverse/Modules/buildSolidCell.py @@ -1,12 +1,8 @@ -import FreeCAD, Part -import BOPTools.SplitAPI -from BOPTools import GeneralFuseResult as GFR -from GEOReverse.Modules.Utils.booleanFunction import BoolSequence -from GEOReverse.Modules.splitFunction import SplitSolid,splitBase,joinBase -from GEOReverse.Modules.Utils.BooleanSolids import buildCTableFromSolids -from GEOReverse.Modules.options import Options - -import math +import Part + +from .options import Options +from .splitFunction import SplitSolid, joinBase, splitBase +from .Utils.booleanFunction import BoolSequence def getPart(slist): diff --git a/src/GEOReverse/Modules/processInp.py b/src/GEOReverse/Modules/processInp.py index a15036ef..3f300bb3 100644 --- a/src/GEOReverse/Modules/processInp.py +++ b/src/GEOReverse/Modules/processInp.py @@ -1,5 +1,6 @@ import configparser -from GEOReverse.Modules.options import Options + +from .options import Options def setOptions(optionFile): diff --git a/src/GEOReverse/Modules/remh.py b/src/GEOReverse/Modules/remh.py index 39df3f78..701b322b 100644 --- a/src/GEOReverse/Modules/remh.py +++ b/src/GEOReverse/Modules/remh.py @@ -1,8 +1,5 @@ -import sys -import re import math - - +import re ######################################### # define patterns to be found in string # diff --git a/src/GEOReverse/Modules/splitFunction.py b/src/GEOReverse/Modules/splitFunction.py index 4b5902a7..8dbad941 100644 --- a/src/GEOReverse/Modules/splitFunction.py +++ b/src/GEOReverse/Modules/splitFunction.py @@ -1,8 +1,9 @@ -import FreeCAD,Part -import BOPTools.SplitAPI -from GEOReverse.Modules.Utils.booleanFunction import outterTerms import math +import BOPTools.SplitAPI +import FreeCAD +import Part + class splitBase: def __init__(self,base,knownSurf={}): diff --git a/src/GEOReverse/reverse.py b/src/GEOReverse/reverse.py index cba945c1..3b53505d 100644 --- a/src/GEOReverse/reverse.py +++ b/src/GEOReverse/reverse.py @@ -1,12 +1,12 @@ -import sys -import FreeCAD, Part, Import - -from GEOReverse.Modules.MCNPinput import MCNPinput -from GEOReverse.Modules.XMLinput import XMLinput -from GEOReverse.Modules.buildCAD import buildCAD,makeTree -from GEOReverse.Modules.Objects import CADCell -from GEOReverse.Modules.processInp import setOptions -from GEOReverse.CodeVersion import * +import FreeCAD +import Import + +from .CodeVersion import * +from .Modules.buildCAD import buildCAD, makeTree +from .Modules.MCNPinput import MCNPinput +from .Modules.Objects import CADCell +from .Modules.processInp import setOptions +from .Modules.XMLinput import XMLinput def reverse(optFile='configRevese.ini') : diff --git a/src/GEOUNED/Conversion/CellDefinition.py b/src/GEOUNED/Conversion/CellDefinition.py index 1e2cda97..ca390815 100644 --- a/src/GEOUNED/Conversion/CellDefinition.py +++ b/src/GEOUNED/Conversion/CellDefinition.py @@ -1,21 +1,22 @@ ############################ # Module for Cell definiton # ############################# -import FreeCAD, Part -from GEOUNED.Utils.Functions import GEOUNED_Surface -from GEOUNED.Utils.BasicFunctions_part1 \ - import isParallel, isOposite, isInLine, signPlane, isSameValue -from GEOUNED.Utils.booleanFunction import BoolSequence, insertInSequence - -import GEOUNED.Utils.BasicFunctions_part2 as BF -import GEOUNED.Utils.Functions as UF -import GEOUNED.Utils.Qform as QF -import GEOUNED.Utils.Geometry_GU as GU -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.Utils.BooleanSolids import buildCTableFromSolids,removeExtraSurfaces import math -from collections import OrderedDict + +import FreeCAD +import Part + +from ..Utils import BasicFunctions_part2 as BF +from ..Utils import Functions as UF +from ..Utils import Geometry_GU as GU +from ..Utils.BasicFunctions_part1 import (isInLine, isOposite, isParallel, + isSameValue, signPlane) +from ..Utils.booleanFunction import BoolSequence, insertInSequence +from ..Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces +from ..Utils.Functions import GEOUNED_Surface +from ..Utils.Options.Classes import Options as opt +from ..Utils.Options.Classes import Tolerances as tol + def getId(facein, Surfaces): diff --git a/src/GEOUNED/Cuboid/translate.py b/src/GEOUNED/Cuboid/translate.py index 863c4443..9db5881c 100644 --- a/src/GEOUNED/Cuboid/translate.py +++ b/src/GEOUNED/Cuboid/translate.py @@ -1,12 +1,13 @@ -from GEOUNED.Utils.booleanFunction import BoolSequence -import GEOUNED.Utils.Geometry_GU as GU -from GEOUNED.Utils.BasicFunctions_part1 \ - import isParallel, isOposite -import GEOUNED.Utils.BasicFunctions_part2 as BF -import GEOUNED.Decompose.Decom_one as Decom -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -import FreeCAD,Part +import FreeCAD +import Part + +from ..Decompose import Decom_one as Decom +from ..Utils import BasicFunctions_part2 as BF +from ..Utils import Geometry_GU as GU +from ..Utils.BasicFunctions_part1 import isOposite, isParallel +from ..Utils.booleanFunction import BoolSequence +from ..Utils.Options.Classes import Options as opt +from ..Utils.Options.Classes import Tolerances as tol def commonEdge(face1,face2): diff --git a/src/GEOUNED/Decompose/Decom_one.py b/src/GEOUNED/Decompose/Decom_one.py index 80ca97c2..f0f57bf3 100644 --- a/src/GEOUNED/Decompose/Decom_one.py +++ b/src/GEOUNED/Decompose/Decom_one.py @@ -2,18 +2,20 @@ # Only one solid and planar surfaces # -import FreeCAD, Part -import GEOUNED.Utils.Functions as UF -import GEOUNED.Utils.Geometry_GU as GU -import GEOUNED.Conversion.CellDefinition as CD -from collections import OrderedDict -from GEOUNED.Utils.BasicFunctions_part1 import isParallel, isSameValue,\ - isInLine, isInPlane -from GEOUNED.Utils.BasicFunctions_part2 import isDuplicateInList -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt import math -import copy +from collections import OrderedDict + +import FreeCAD +import Part + +from ..Conversion import CellDefinition as CD +from ..Utils import Functions as UF +from ..Utils import Geometry_GU as GU +from ..Utils.BasicFunctions_part1 import (isInLine, isInPlane, isParallel, + isSameValue) +from ..Utils.BasicFunctions_part2 import isDuplicateInList +from ..Utils.Options.Classes import Options as opt +from ..Utils.Options.Classes import Tolerances as tol twoPi = math.pi*2 diff --git a/src/GEOUNED/LoadFile/LoadFunctions.py b/src/GEOUNED/LoadFile/LoadFunctions.py index 8225fd09..45c942b5 100644 --- a/src/GEOUNED/LoadFile/LoadFunctions.py +++ b/src/GEOUNED/LoadFile/LoadFunctions.py @@ -1,7 +1,9 @@ import re + import FreeCAD -from GEOUNED.Utils.Functions import GEOUNED_Solid -from GEOUNED.Utils.Options.Classes import Options as opt + +from ..Utils.Functions import GEOUNED_Solid +from ..Utils.Options.Classes import Options as opt def GetLabel(label): diff --git a/src/GEOUNED/LoadFile/LoadSTEP.py b/src/GEOUNED/LoadFile/LoadSTEP.py index 59dd8990..9deaa28b 100644 --- a/src/GEOUNED/LoadFile/LoadSTEP.py +++ b/src/GEOUNED/LoadFile/LoadSTEP.py @@ -1,12 +1,15 @@ # # Module to load a STEP file # -import FreeCAD, Part -from FreeCAD import Import +import os import re -import os.path -import GEOUNED.Utils.Functions as UF -import GEOUNED.LoadFile.LoadFunctions as LF + +import FreeCAD +import Part +from FreeCAD import Import + +from ..Utils import Functions as UF +from . import LoadFunctions as LF # Paco mod diff --git a/src/GEOUNED/Utils/BasicFunctions_part1.py b/src/GEOUNED/Utils/BasicFunctions_part1.py index 0ade2170..0b455fa4 100644 --- a/src/GEOUNED/Utils/BasicFunctions_part1.py +++ b/src/GEOUNED/Utils/BasicFunctions_part1.py @@ -1,9 +1,11 @@ # # Set of useful functions used in different parts of the code # -import FreeCAD import math +import FreeCAD + + def isSameValue(v1,v2,tolerance=1e-6): return abs(v1-v2) < tolerance diff --git a/src/GEOUNED/Utils/BasicFunctions_part2.py b/src/GEOUNED/Utils/BasicFunctions_part2.py index a0c79fc3..b80b322e 100644 --- a/src/GEOUNED/Utils/BasicFunctions_part2.py +++ b/src/GEOUNED/Utils/BasicFunctions_part2.py @@ -1,12 +1,13 @@ # # Set of useful functions used in different parts of the code # -from GEOUNED.Utils.BasicFunctions_part1 \ - import isParallel, isOposite,isSameValue, isInTolerance, isInLine, isInPlane -from GEOUNED.Write.Functions import MCNPSurface -import FreeCAD import math +import FreeCAD + +from ..Utils.BasicFunctions_part1 import (isInLine, isInPlane, isInTolerance, + isOposite, isParallel, isSameValue) +from ..Write.Functions import MCNPSurface sameSurfFic = open('fuzzySurfaces','w') def Fuzzy(index,dtype,surf1,surf2,val,tol): diff --git a/src/GEOUNED/Utils/BooleanSolids.py b/src/GEOUNED/Utils/BooleanSolids.py index 2c099108..60ab1380 100644 --- a/src/GEOUNED/Utils/BooleanSolids.py +++ b/src/GEOUNED/Utils/BooleanSolids.py @@ -2,13 +2,13 @@ # Conversion to MCNP v0.0 # Only one solid and planar surfaces # -import FreeCAD import math -import re -from GEOUNED.Utils.Functions import GEOUNED_Surface, splitBOP -from GEOUNED.Utils.booleanFunction import BoolSequence -from GEOUNED.Utils.Options.Classes import Options as opt +import FreeCAD + +from ..Utils.booleanFunction import BoolSequence +from ..Utils.Functions import GEOUNED_Surface, splitBOP +from ..Utils.Options.Classes import Options as opt BoolVals = (None,True,False) diff --git a/src/GEOUNED/Utils/Functions.py b/src/GEOUNED/Utils/Functions.py index f6b8dea3..f5a34f63 100644 --- a/src/GEOUNED/Utils/Functions.py +++ b/src/GEOUNED/Utils/Functions.py @@ -1,16 +1,20 @@ # # Set of useful functions used in different parts of the code # -import BOPTools.SplitAPI -import GEOUNED.Utils.BasicFunctions_part2 as BF -from GEOUNED.Utils.BasicFunctions_part1 import isParallel,\ - Plane3PtsParams, PlaneParams, CylinderParams, ConeParams, SphereParams, TorusParams -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options -import copy -import FreeCAD, Part import math + +import BOPTools.SplitAPI +import FreeCAD import numpy as np +import Part + +from ..Utils.BasicFunctions_part1 import (ConeParams, CylinderParams, + Plane3PtsParams, PlaneParams, + SphereParams, TorusParams, + isParallel) +from ..Utils.Options.Classes import Options +from ..Utils.Options.Classes import Tolerances as tol +from . import BasicFunctions_part2 as BF def getBox(comp): diff --git a/src/GEOUNED/Utils/Geometry_GU.py b/src/GEOUNED/Utils/Geometry_GU.py index ddd4ac5a..769bab91 100644 --- a/src/GEOUNED/Utils/Geometry_GU.py +++ b/src/GEOUNED/Utils/Geometry_GU.py @@ -1,11 +1,14 @@ # # definition of GEOUNED objects to release memory # -import FreeCAD, Part import math -from GEOUNED.Utils.BasicFunctions_part1 import isSameValue -from GEOUNED.Utils.BasicFunctions_part2 import isSameTorus -from GEOUNED.Utils.Options.Classes import Tolerances as tol + +import Part + +from ..Utils.Options.Classes import Tolerances as tol +from .BasicFunctions_part1 import isSameValue +from .BasicFunctions_part2 import isSameTorus + # SURFACES class Surfaces_GU(object): diff --git a/src/GEOUNED/Utils/Options/__init__.py b/src/GEOUNED/Utils/Options/__init__.py index f6437a78..8a43702e 100644 --- a/src/GEOUNED/Utils/Options/__init__.py +++ b/src/GEOUNED/Utils/Options/__init__.py @@ -1,5 +1,4 @@ -import os.path -from GEOUNED.Utils.Options.Classes import Options, Tolerances, MCNP_numeric_format +from .Classes import MCNP_numeric_format, Options, Tolerances #default options values forceCylinder = True # Force using cylinders instead cones for auxillary surfaces of torus surface definition diff --git a/src/GEOUNED/Utils/Qform.py b/src/GEOUNED/Utils/Qform.py index 792e912f..27ac1bf5 100644 --- a/src/GEOUNED/Utils/Qform.py +++ b/src/GEOUNED/Utils/Qform.py @@ -4,9 +4,12 @@ # # -import FreeCAD, Part import math +import FreeCAD +import Part + + def RotationMatrix(u,v): """ Definition of the rotation matrix for two vectors""" diff --git a/src/GEOUNED/Utils/booleanFunction.py b/src/GEOUNED/Utils/booleanFunction.py index 4c679157..4691cbb2 100644 --- a/src/GEOUNED/Utils/booleanFunction.py +++ b/src/GEOUNED/Utils/booleanFunction.py @@ -1,4 +1,5 @@ import re + mostinner=re.compile(r"\([^\(^\)]*\)") # identify most inner parentheses number =re.compile(r"(?P[-+]?\d+)") mix =re.compile(r"(?P([-+]?\d+|\[0+\]))") diff --git a/src/GEOUNED/Void/Void.py b/src/GEOUNED/Void/Void.py index d729f0f6..c7805e33 100644 --- a/src/GEOUNED/Void/Void.py +++ b/src/GEOUNED/Void/Void.py @@ -1,11 +1,14 @@ -from GEOUNED.Void.VoidBoxClass import VoidBox -from GEOUNED.Utils.BasicFunctions_part1 import isOposite -from GEOUNED.Utils.Functions import GEOUNED_Solid, GEOUNED_Surface -from GEOUNED.Utils.booleanFunction import BoolSequence -from GEOUNED.Utils.Options.Classes import Options as opt -import GEOUNED.LoadFile.LoadFunctions as LF -import GEOUNED.Void.voidFunctions as VF -import FreeCAD, Part +import FreeCAD +import Part + +from ..LoadFile import LoadFunctions as LF +from ..Utils.BasicFunctions_part1 import isOposite +from ..Utils.booleanFunction import BoolSequence +from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface +from ..Utils.Options.Classes import Options as opt +from ..Void import voidFunctions as VF +from .VoidBoxClass import VoidBox + def voidGeneration(MetaList,EnclosureList,Surfaces,UniverseBox,setting,init): voidList = [] diff --git a/src/GEOUNED/Void/VoidBoxClass.py b/src/GEOUNED/Void/VoidBoxClass.py index 51cc9a00..9ead80e3 100644 --- a/src/GEOUNED/Void/VoidBoxClass.py +++ b/src/GEOUNED/Void/VoidBoxClass.py @@ -1,14 +1,14 @@ """File with the VoidBox class""" import FreeCAD import Part -import GEOUNED.Decompose.Decom_one as Decom -import GEOUNED.Conversion.CellDefinition as Conv - -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.Utils.BasicFunctions_part1 import isOposite -from GEOUNED.Utils.Functions import GEOUNED_Solid, GEOUNED_Surface -from GEOUNED.Utils.booleanFunction import BoolSequence -from GEOUNED.Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces + +from ..Conversion import CellDefinition as Conv +from ..Decompose import Decom_one as Decom +from ..Utils.BasicFunctions_part1 import isOposite +from ..Utils.booleanFunction import BoolSequence +from ..Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces +from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface +from ..Utils.Options.Classes import Options as opt class VoidBox (): diff --git a/src/GEOUNED/Write/Functions.py b/src/GEOUNED/Write/Functions.py index cebc945e..4094aa47 100644 --- a/src/GEOUNED/Write/Functions.py +++ b/src/GEOUNED/Write/Functions.py @@ -1,14 +1,16 @@ -import GEOUNED.Utils.Qform as Qform -from GEOUNED.Utils.BasicFunctions_part1 import isParallel, isOposite -from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.Write.StringFunctions import remove_redundant - -import FreeCAD import math import re +import FreeCAD + +from ..Utils import Qform as Qform +from ..Utils.BasicFunctions_part1 import isOposite, isParallel +from ..Utils.Options.Classes import MCNP_numeric_format as nf +from ..Utils.Options.Classes import Options as opt +from ..Utils.Options.Classes import Tolerances as tol +from .StringFunctions import remove_redundant + + class CardLine : def __init__(self,card,linesize=80,tabspace=6,fmt=''): self.str = card + ' ' diff --git a/src/GEOUNED/Write/MCNPFormat.py b/src/GEOUNED/Write/MCNPFormat.py index 73e5a8ce..4695198d 100644 --- a/src/GEOUNED/Write/MCNPFormat.py +++ b/src/GEOUNED/Write/MCNPFormat.py @@ -1,19 +1,17 @@ ############################## # Module to write MCNP input # ############################## +import math from datetime import datetime -from GEOUNED.Utils.Functions import Surfaces_dict -from GEOUNED.Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite -from GEOUNED.Write.Functions import MCNPSurface, changeSurfSign, writeMCNPCellDef,CardLine -from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.CodeVersion import * import FreeCAD -import copy -import math -import re + +from ..CodeVersion import * +from ..Utils.BasicFunctions_part1 import isOposite, pointsToCoeffs +from ..Utils.Functions import Surfaces_dict +from ..Utils.Options.Classes import Options as opt +from .Functions import CardLine, MCNPSurface, changeSurfSign, writeMCNPCellDef + class MCNP_input: def __init__(self,Meta,Surfaces,setting) : diff --git a/src/GEOUNED/Write/OpenMCFormat.py b/src/GEOUNED/Write/OpenMCFormat.py index 469a4cd8..58e2afb5 100644 --- a/src/GEOUNED/Write/OpenMCFormat.py +++ b/src/GEOUNED/Write/OpenMCFormat.py @@ -1,17 +1,14 @@ ############################## # Module to write MCNP input # ############################## -from datetime import datetime -from GEOUNED.Utils.Functions import Surfaces_dict -from GEOUNED.Write.Functions import OpenMCSurface, changeSurfSign, writeOpenMCregion,CardLine -from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.CodeVersion import * import FreeCAD -import copy -import math -import re + +from ..CodeVersion import * +from ..Utils.Functions import Surfaces_dict +from ..Utils.Options.Classes import Options as opt +from .Functions import OpenMCSurface, changeSurfSign, writeOpenMCregion + class OpenMC_input: def __init__(self,Meta,Surfaces,setting) : diff --git a/src/GEOUNED/Write/PHITSFormat.py b/src/GEOUNED/Write/PHITSFormat.py index a895bb62..5740d9c4 100644 --- a/src/GEOUNED/Write/PHITSFormat.py +++ b/src/GEOUNED/Write/PHITSFormat.py @@ -11,19 +11,18 @@ # 5. Eliminated the only MCNP related parts # 6. Added some comments to remind +import re from datetime import datetime -from GEOUNED.Utils.Functions import Surfaces_dict -from GEOUNED.Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite -from GEOUNED.Write.Functions import PHITSSurface, changeSurfSign, writePHITSCellDef,CardLine,CellString -from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.CodeVersion import * + import FreeCAD -import copy -import math -import re -import os + +from ..CodeVersion import * +from ..Utils.BasicFunctions_part1 import isOposite, pointsToCoeffs +from ..Utils.Functions import Surfaces_dict +from ..Utils.Options.Classes import Options as opt +from ..Write.Functions import (CellString, PHITSSurface, changeSurfSign, + writePHITSCellDef) + class PHITS_input: def __init__(self,Meta,Surfaces,setting) : diff --git a/src/GEOUNED/Write/SerpentFormat.py b/src/GEOUNED/Write/SerpentFormat.py index 5462e866..d215c7f1 100644 --- a/src/GEOUNED/Write/SerpentFormat.py +++ b/src/GEOUNED/Write/SerpentFormat.py @@ -3,17 +3,14 @@ ################################# from datetime import datetime -from GEOUNED.Utils.Functions import Surfaces_dict -from GEOUNED.Utils.BasicFunctions_part1 import pointsToCoeffs,isOposite -from GEOUNED.Write.Functions import SerpentSurface, changeSurfSign, writeSerpentCellDef,CardLine -from GEOUNED.Utils.Options.Classes import MCNP_numeric_format as nf -from GEOUNED.Utils.Options.Classes import Tolerances as tol -from GEOUNED.Utils.Options.Classes import Options as opt -from GEOUNED.CodeVersion import * import FreeCAD -import copy -import math -import re + +from ..CodeVersion import * +from ..Utils.BasicFunctions_part1 import isOposite, pointsToCoeffs +from ..Utils.Functions import Surfaces_dict +from ..Utils.Options.Classes import Options as opt +from .Functions import SerpentSurface, changeSurfSign, writeSerpentCellDef + class Serpent_input: def __init__(self,Meta,Surfaces,setting) : diff --git a/src/GEOUNED/Write/StringFunctions.py b/src/GEOUNED/Write/StringFunctions.py index 355c5d1b..a1bc1ea3 100644 --- a/src/GEOUNED/Write/StringFunctions.py +++ b/src/GEOUNED/Write/StringFunctions.py @@ -1,6 +1,5 @@ import re - ######################################### # define patterns to be found in string # ######################################### diff --git a/src/GEOUNED/Write/WriteFiles.py b/src/GEOUNED/Write/WriteFiles.py index 954d433f..9746065d 100644 --- a/src/GEOUNED/Write/WriteFiles.py +++ b/src/GEOUNED/Write/WriteFiles.py @@ -1,8 +1,9 @@ -import GEOUNED.Write.AdditionalFiles as OutFiles -from GEOUNED.Write.MCNPFormat import MCNP_input -from GEOUNED.Write.OpenMCFormat import OpenMC_input -from GEOUNED.Write.SerpentFormat import Serpent_input -from GEOUNED.Write.PHITSFormat import PHITS_input +from . import AdditionalFiles as OutFiles +from .MCNPFormat import MCNP_input +from .OpenMCFormat import OpenMC_input +from .PHITSFormat import PHITS_input +from .SerpentFormat import Serpent_input + def writeGeometry(UniverseBox,MetaList,Surfaces,code_setting): diff --git a/src/GEOUNED/__init__.py b/src/GEOUNED/__init__.py index 9ca60786..572ffeca 100644 --- a/src/GEOUNED/__init__.py +++ b/src/GEOUNED/__init__.py @@ -2,7 +2,7 @@ # # We load the STEP and the materials -import sys + # this try except attempts to import freecad (lowercase) which is the conda # package name for FreeCAD (mixed case) upon import the conda package appends # the sys path for Conda installed FreeCAD, consequently FreeCAD can then be @@ -11,25 +11,24 @@ import freecad except: pass -import FreeCAD,Part import configparser - -from os import path,mkdir from datetime import datetime - - -import GEOUNED.LoadFile.LoadSTEP as Load -import GEOUNED.Decompose.Decom_one as Decom -import GEOUNED.Utils.Functions as UF -import GEOUNED.Conversion.CellDefinition as Conv -from GEOUNED.Write.Functions import writeMCNPCellDef -from GEOUNED.Write.WriteFiles import writeGeometry -from GEOUNED.CodeVersion import * -from GEOUNED.Utils.Options.Classes import Tolerances, MCNP_numeric_format, Options -from GEOUNED.Utils.BooleanSolids import buildCTableFromSolids -from GEOUNED.Cuboid.translate import translate - -import GEOUNED.Void.Void as Void +from os import mkdir, path + +import FreeCAD +import Part + +from .CodeVersion import * +from .Conversion import CellDefinition as Conv +from .Cuboid.translate import translate +from .Decompose import Decom_one as Decom +from .LoadFile import LoadSTEP as Load +from .Utils import Functions as UF +from .Utils.BooleanSolids import buildCTableFromSolids +from .Utils.Options.Classes import MCNP_numeric_format, Options, Tolerances +from .Void import Void as Void +from .Write.Functions import writeMCNPCellDef +from .Write.WriteFiles import writeGeometry class GEOUNED() :