コード例 #1
0
ファイル: writer.py プロジェクト: myenvis/FreeCAD
 def _handleUnits(self):
     self.unit_schema = 0
     self.unit_system = {  # standard FreeCAD Base units = unit schema 0
         "L": "mm",
         "M": "kg",
         "T": "s",
         "I": "A",
         "O": "K",
         "N": "mol",
         "J": "cd",
     }
     param = ParamGet("User parameter:BaseApp/Preferences/Units")
     self.unit_schema = param.GetInt("UserSchema", 0)
     if self.unit_schema == 0:
         Console.PrintMessage(
             "The FreeCAD standard unit schema mm/kg/s is used. "
             "Elmer sif-file writing is done in Standard FreeCAD units.\n"
         )
     elif self.unit_schema == 1:
         Console.PrintMessage(
             "The SI unit schema m/kg/s is used. "
             "Elmer sif-file writing is done in SI-units.\n"
         )
         self.unit_system = {
             "L": "m",
             "M": "kg",
             "T": "s",
             "I": "A",
             "O": "K",
             "N": "mol",
             "J": "cd",
         }
     elif self.unit_schema > 1:
         Console.PrintMessage(
             "Unit schema: {} not supported by Elmer writer. "
             "The FreeCAD standard unit schema mm/kg/s is used. "
             "Elmer sif-file writing is done in Standard FreeCAD units.\n"
             .format(self.unit_schema)
         )
コード例 #2
0
 def _handleUnits(self):
     # TODO constants and units
     # should be only one system for all solver and not in each solver
     # https://forum.freecadweb.org/viewtopic.php?t=47895
     # https://forum.freecadweb.org/viewtopic.php?t=48451
     # https://forum.freecadweb.org/viewtopic.php?f=10&t=48642
     # The FreeCAD unit schema is only used to determine the schema number
     # all definition are done here ATM
     # keep in mind a unit schema might not be consistent:
     # Length could be mm and Area could be m2 and Volume could be cm3
     # as long as only the seven base units are retrieved from a unit schema
     # the units are consistent
     # TODO retrieve the seven base units from FreeCAD unit schema
     # instead of hard coding them here for a second once
     self.unit_schema = Units.Scheme.SI1
     self.unit_system = {  # standard FreeCAD Base units = unit schema 0
         "L": "mm",
         "M": "kg",
         "T": "s",
         "I": "A",
         "O": "K",
         "N": "mol",
         "J": "cd",
     }
     param = ParamGet("User parameter:BaseApp/Preferences/Units")
     self.unit_schema = param.GetInt("UserSchema", Units.Scheme.SI1)
     if self.unit_schema == Units.Scheme.SI1:
         Console.PrintMessage(
             "The FreeCAD standard unit schema mm/kg/s is used. "
             "Elmer sif-file writing is done in Standard FreeCAD units.\n")
     elif self.unit_schema == Units.Scheme.SI2:
         Console.PrintMessage(
             "The SI unit schema m/kg/s is used. "
             "Elmer sif-file writing is done in SI-units.\n")
         self.unit_system = {
             "L": "m",
             "M": "kg",
             "T": "s",
             "I": "A",
             "O": "K",
             "N": "mol",
             "J": "cd",
         }
     elif self.unit_schema == Units.Scheme.FemMilliMeterNewton:
         # see also unit comment in calculix writer
         Console.PrintMessage(
             "The FEM unit schema mm/N/s is used. "
             "Elmer sif-file writing is done in FEM-units.\n")
         self.unit_system = {
             "L": "mm",
             "M": "t",
             "T": "s",
             "I": "A",
             "O": "K",
             "N": "mol",
             "J": "cd",
         }
     elif (self.unit_schema > Units.Scheme.SI2
           and self.unit_schema != Units.Scheme.FemMilliMeterNewton):
         Console.PrintMessage(
             "Unit schema: {} not supported by Elmer writer. "
             "The FreeCAD standard unit schema mm/kg/s is used. "
             "Elmer sif-file writing is done in Standard FreeCAD units.\n".
             format(Units.listSchemas(self.unit_schema)))
コード例 #3
0
import Fem
from . import sifio
from .. import settings
from femmesh import gmshtools
from femtools import constants
from femtools import femutils
from femtools import membertools

_STARTINFO_NAME = "ELMERSOLVER_STARTINFO"
_SIF_NAME = "case.sif"
_ELMERGRID_IFORMAT = "8"
_ELMERGRID_OFORMAT = "2"
_SOLID_PREFIX = "Solid"

param = ParamGet("User parameter:BaseApp/Preferences/Units")
unitsschema = param.GetInt("UserSchema")

if unitsschema == 1:
    Console.PrintMessage("The unit schema m/kg/s is used. So export and "
                         "import is done in ISO units (SI-units).\n")
    UNITS = {
        "L": "m",
        "M": "kg",
        "T": "s",
        "I": "A",
        "O": "K",
        "N": "mol",
        "J": "cd",
    }
else:
    Console.PrintMessage("The unit schema mm/kg/s is used. So export and "
コード例 #4
0
_block_size = 0

__prmPrefOW__ = ParamGet("User parameter:BaseApp/Preferences/OutputWindow")
__prmPrefIL__ = ParamGet(
    "User parameter:BaseApp/Preferences/Mod/InventorLoader")

# The file the be imported
_inventor_file = None
_dump_folder = None

STRATEGY_SAT = 0
STRATEGY_NATIVE = 1
STRATEGY_STEP = 2
STRATEGY_CANCEL = -1

__strategy__ = __prmPrefIL__.GetInt("strategy", STRATEGY_SAT)

IS_CELL_REF = re.compile('^[a-z](\d+)?$', re.IGNORECASE)
IS_BETA = re.compile('^.* Beta(\d+) .*$', re.IGNORECASE)
_author = ''
_company = ''
_comment = ''
_lastModifiedBy = ''
_description = ''
_colorDefault = ''

with open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
                       "colors.json"),
          encoding='utf-8') as colorPalette:
    _colorNames = json.load(colorPalette)
    for n in _colorNames: