Example #1
0
    def Initialize(self):
        def QT_TRANSLATE_NOOP(scope, text):
            return text

        import OpenSCAD_rc, OpenSCADCommands
        commands = [
            'OpenSCAD_ReplaceObject', 'OpenSCAD_RemoveSubtree',
            'OpenSCAD_RefineShapeFeature', 'OpenSCAD_MirrorMeshFeature',
            'OpenSCAD_ScaleMeshFeature', 'OpenSCAD_ResizeMeshFeature',
            'OpenSCAD_IncreaseToleranceFeature', 'OpenSCAD_Edgestofaces',
            'OpenSCAD_ExpandPlacements', 'OpenSCAD_ExplodeGroup'
        ]
        toolbarcommands = [
            'OpenSCAD_ReplaceObject', 'OpenSCAD_RemoveSubtree',
            'OpenSCAD_ExplodeGroup', 'OpenSCAD_RefineShapeFeature',
            'OpenSCAD_IncreaseToleranceFeature'
        ]
        import PartGui
        parttoolbarcommands = [
            'Part_CheckGeometry', 'Part_Primitives', 'Part_Builder',
            'Part_Cut', 'Part_Fuse', 'Part_Common', 'Part_Extrude',
            'Part_Revolve'
        ]
        import FreeCAD
        param = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
        openscadfilename = param.GetString('openscadexecutable')
        if not openscadfilename:

            import OpenSCADUtils
            openscadfilename = OpenSCADUtils.searchforopenscadexe()
            if openscadfilename:  #automatic search was succsessful
                FreeCAD.addImportType("OpenSCAD Format (*.scad)", "importCSG")
                param.SetString('openscadexecutable',
                                openscadfilename)  #save the result
        if openscadfilename:
            commands.extend([
                'OpenSCAD_AddOpenSCADElement', 'OpenSCAD_MeshBoolean',
                'OpenSCAD_Hull', 'OpenSCAD_Minkowski'
            ])

            toolbarcommands.extend([
                'OpenSCAD_AddOpenSCADElement', 'OpenSCAD_MeshBoolean',
                'OpenSCAD_Hull', 'OpenSCAD_Minkowski'
            ])
        else:
            FreeCAD.Console.PrintWarning('OpenSCAD executable not found\n')

        self.appendToolbar(QT_TRANSLATE_NOOP('Workbench', 'OpenSCADTools'),
                           toolbarcommands)
        self.appendMenu('OpenSCAD', commands)
        self.appendToolbar(
            QT_TRANSLATE_NOOP('Workbech', 'OpenSCAD Part tools'),
            parttoolbarcommands)
        #self.appendMenu('OpenSCAD',["AddOpenSCADElement"])
        ###self.appendCommandbar("&Generic Tools",["ColorCodeShape"])
        FreeCADGui.addIconPath(":/icons")
        FreeCADGui.addLanguagePath(":/translations")
        FreeCADGui.addPreferencePage(":/ui/openscadprefs-base.ui", "OpenSCAD")
def addExtensions():

    """Adds the CADExchanger extensions to FreeCAD"""

    importfmts,exportfmts = getExtensions()
    for key,value in importfmts.items():
        FreeCAD.addImportType(key+" ("+value+")","CADExchangerIO")
    for key,value in exportfmts.items():
        FreeCAD.addExportType(key+" ("+value+")","CADExchangerIO")
Example #3
0
    def Initialize(self):
        def QT_TRANSLATE_NOOP(scope, text):
            return text
        import OpenSCAD_rc,OpenSCADCommands
        commands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
            'OpenSCAD_RefineShapeFeature',\
            'OpenSCAD_IncreaseToleranceFeature', 'OpenSCAD_Edgestofaces', \
            'OpenSCAD_ExpandPlacements','OpenSCAD_ExplodeGroup']
        toolbarcommands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
            'OpenSCAD_ExplodeGroup','OpenSCAD_RefineShapeFeature']
            #'OpenSCAD_IncreaseToleranceFeature' #icon still missing
        import PartGui
        parttoolbarcommands = ['Part_CheckGeometry',"Part_Primitives",\
            "Part_Builder",'Part_Cut','Part_Fuse','Part_Common',\
            'Part_Extrude',"Part_Revolve"]
        import FreeCAD
        param = FreeCAD.ParamGet(\
            "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
        openscadfilename = param.GetString('openscadexecutable')
        if not openscadfilename:

            import OpenSCADUtils
            openscadfilename = OpenSCADUtils.searchforopenscadexe()
            if openscadfilename: #automatic search was succsessful
                FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG") 
                param.SetString('openscadexecutable',openscadfilename) #save the result
        if openscadfilename:
            commands.extend(['OpenSCAD_AddOpenSCADElement',
                'OpenSCAD_MeshBoolean','OpenSCAD_Hull','OpenSCAD_Minkowski'])
            toolbarcommands.extend(['OpenSCAD_AddOpenSCADElement',
                'OpenSCAD_MeshBoolean','OpenSCAD_Hull','OpenSCAD_Minkowski'])
        else:
            FreeCAD.Console.PrintWarning('OpenSCAD executable not found\n')

        self.appendToolbar(QT_TRANSLATE_NOOP('Workbench','OpenSCADTools'),toolbarcommands)
        self.appendMenu('OpenSCAD',commands)
        self.appendToolbar(QT_TRANSLATE_NOOP('Workbech','OpenSCAD Part tools'),parttoolbarcommands)
        #self.appendMenu('OpenSCAD',["AddOpenSCADElement"])
        ###self.appendCommandbar("&Generic Tools",["ColorCodeShape"])
        FreeCADGui.addIconPath(":/icons")
        FreeCADGui.addLanguagePath(":/translations")
        FreeCADGui.addPreferencePage(":/ui/openscadprefs-base.ui","OpenSCAD")
Example #4
0
    def Initialize(self):
        import OpenSCAD_rc, OpenSCADCommands
        commands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
            'OpenSCAD_RefineShapeFeature',"OpenSCAD_Edgestofaces",\
            'OpenSCAD_ExpandPlacements']
        toolbarcommands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
            'OpenSCAD_RefineShapeFeature']
        import PartGui
        parttoolbarcommands = ['Part_CheckGeometry',"Part_Primitives",\
            "Part_Builder",'Part_Cut','Part_Fuse','Part_Common',\
            'Part_Extrude',"Part_Revolve"]
        import FreeCAD
        param = FreeCAD.ParamGet(\
            "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
        openscadfilename = param.GetString('openscadexecutable')
        if not openscadfilename:

            import OpenSCADUtils
            openscadfilename = OpenSCADUtils.searchforopenscadexe()
            if openscadfilename:  #automatic search was succsessful
                FreeCAD.addImportType("OpenSCAD Format (*.scad)", "importCSG")
                param.SetString('openscadexecutable',
                                openscadfilename)  #save the result
        if openscadfilename:
            commands.extend(['OpenSCAD_AddOpenSCADElement'])
            toolbarcommands.extend(['OpenSCAD_AddOpenSCADElement'])
        else:
            FreeCAD.Console.PrintWarning('OpenSCAD executable not found\n')

        self.appendToolbar("OpenSCADTools", toolbarcommands)
        self.appendMenu('OpenSCAD', commands)
        self.appendToolbar('OpenSCAD Part tools', parttoolbarcommands)
        #self.appendMenu('OpenSCAD',["AddOpenSCADElement"])
        ###self.appendCommandbar("&Generic Tools",["ColorCodeShape"])
        FreeCADGui.addIconPath(":/icons")
        FreeCADGui.addLanguagePath(":/translations")
        FreeCADGui.addPreferencePage(":/ui/openscadprefs-base.ui", "OpenSCAD")
# signal that the gui is up
App.GuiUp = 1
App.Gui = FreeCADGui
FreeCADGui.Workbench = Workbench

Gui.addWorkbench(NoneWorkbench())

# init modules
InitApplications()

# set standard workbench (needed as fallback)
Gui.activateWorkbench("NoneWorkbench")

# Register .py, .FCScript and .FCMacro
FreeCAD.addImportType("Inventor V2.1 (*.iv)", "FreeCADGui")
FreeCAD.addImportType("VRML V2.0 (*.wrl *.vrml *.wrz *.wrl.gz)", "FreeCADGui")
FreeCAD.addImportType("Python (*.py *.FCMacro *.FCScript)", "FreeCADGui")
FreeCAD.addExportType("Inventor V2.1 (*.iv)", "FreeCADGui")
FreeCAD.addExportType("VRML V2.0 (*.wrl *.vrml *.wrz *.wrl.gz)", "FreeCADGui")
# FreeCAD.addExportType("IDTF (for 3D PDF) (*.idtf)","FreeCADGui")
# FreeCAD.addExportType("3D View (*.svg)","FreeCADGui")
FreeCAD.addExportType("Portable Document Format (*.pdf)", "FreeCADGui")

del (InitApplications)
del (NoneWorkbench)
del (StandardWorkbench)


Log("Init: Running FreeCADGuiInit.py start script... done\n")
Example #6
0
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/

# FreeCAD init script of the Fem module

import FreeCAD


FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen")

# see FemMesh::read() and FemMesh::write() methods in src/Mod/Fem/App/FemMesh.cpp
FreeCAD.addImportType("FEM mesh formats (*.bdf *.dat *.inp *.med *.unv *.vtk *.vtu *.z88)", "Fem")
FreeCAD.addExportType("FEM mesh formats (*.dat *.inp *.med *.stl *.unv *.vtk *.vtu *.z88)", "Fem")

FreeCAD.addImportType("FEM result CalculiX (*.frd)", "feminout.importCcxFrdResults")

FreeCAD.addImportType("FEM mesh Fenics (*.xml *.xdmf)", "feminout.importFenicsMesh")
FreeCAD.addExportType("FEM mesh Fenics (*.xml *.xdmf)", "feminout.importFenicsMesh")

FreeCAD.addImportType(
    "FEM mesh YAML/JSON (*.meshyaml *.meshjson *.yaml *.json)", "feminout.importYamlJsonMesh"
)
FreeCAD.addExportType(
    "FEM mesh YAML/JSON (*.meshyaml *.meshjson *.yaml *.json)", "feminout.importYamlJsonMesh"
)

FreeCAD.addImportType("FEM mesh Z88 (*i1.txt)", "feminout.importZ88Mesh")
Example #7
0
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/


import FreeCAD


FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM results (*.vtk *.vtp *.vts *.vtr *.vtu *.vti)", "Fem")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addImportType("Z88 displacement result file (*.txt)", "z88DispReader")
Example #8
0
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Lesser General Public License for more details.                   *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/

import FreeCAD

FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
    FreeCAD.addExportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
    FreeCAD.addImportType("FEM results (*.vtk *.vtu)", "importVTKResults")
    FreeCAD.addExportType("FEM CFD Result in VTK format (*.vtk *.vtu)", "importVTKResults")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "importCcxFrdResults")
FreeCAD.addImportType("Fenics mesh file (*.xml *.xdmf)", "importFenicsMesh")
FreeCAD.addExportType("Fenics mesh file (*.xml *.xdmf)", "importFenicsMesh")
FreeCAD.addImportType("Mesh from Calculix/Abaqus input file (*.inp)", "importInpMesh")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addImportType("Z88 displacement (o2) result file (*.txt)", "importZ88O2Results")
Example #9
0
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Library General Public License for more details.                  *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************
"""Initialization file of the workbench, non-GUI."""

import FreeCAD as App

# add Import/Export types
App.addImportType("Autodesk DXF 2D (*.dxf)", "importDXF")
App.addImportType("SVG as geometry (*.svg)", "importSVG")
App.addImportType("Open CAD Format (*.oca *.gcad)", "importOCA")
App.addImportType("Common airfoil data (*.dat)", "importAirfoilDAT")
App.addExportType("Autodesk DXF 2D (*.dxf)", "importDXF")
App.addExportType("Flattened SVG (*.svg)", "importSVG")
App.addExportType("Open CAD Format (*.oca)", "importOCA")
App.addImportType("Autodesk DWG 2D (*.dwg)", "importDWG")
App.addExportType("Autodesk DWG 2D (*.dwg)", "importDWG")

App.__unit_test__ += ["TestDraft"]
    def Activated(self):
        # Here your write what your ScriptCmd does...
        FreeCAD.Console.PrintMessage('Hello, World!')

    def GetResources(self):
        return {
            'Pixmap': 'path_to_an_icon/myicon.png',
            'MenuText': 'Short text',
            'ToolTip': 'More detailed text'
        }


FreeCADGui.addCommand('Script_Cmd', ScriptCmd())

# Assumes Import_Ext.py is the file that has the code for opening and reading .ext files
FreeCAD.addImportType("Your new File Type (*.ext)", "Import_Ext")


def open(filename):
    doc = App.newDocument()
    # here you do all what is needed with filename, read, classify data, create corresponding FreeCAD objects
    doc.recompute()


FreeCAD.addExportType("Your new File Type (*.ext)", "Export_Ext")

import Part, PartGui
doc = App.activeDocument()
# add a line element to the document and set its points
l = Part.LineSegment()
l.StartPoint = (0.0, 0.0, 0.0)
Example #11
0
#*   This file is part of the FreeCAD CAx development system.              *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/


import FreeCAD


FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
Example #12
0
import FreeCAD
FreeCAD.addImportType("GDML (*.gdml)", "freecad.gdml.importGDML")
FreeCAD.addImportType("XML (*.xml)", "freecad.gdml.importGDML")
FreeCAD.addImportType("OBJ -> GDML-Tessellated (*.obj)",
                      "freecad.gdml.importOBJ")
FreeCAD.addExportType("GDML (*.gdml)", "freecad.gdml.exportGDML")
FreeCAD.addExportType("GDML (*.GDML)", "freecad.gdml.exportGDML")
FreeCAD.addExportType("XML (*.XML)", "freecad.gdml.exportGDML")
FreeCAD.addExportType("XML (*.xml)", "freecad.gdml.exportGDML")
FreeCAD.addExportType("GEMC - stl (*.gemc)", "freecad.gdml.exportGDML")
FreeCAD.addExportType("GEMC - gdml (*.GEMC)", "freecad.gdml.exportGDML")
Example #13
0
import FreeCAD
FreeCAD.addImportType("3DM (*.3dm)", "freecad.importNURBS.import3DM")
Example #14
0
# FreeCAD init script of buildbotics workbench

#***************************************************************************
#*   Copyright (c) 2019 Buildbotics LLC                              *
#*                                                                         *
#*   This file is part of the FreeCAD CAx development system.              *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#***************************************************************************/

import FreeCAD

FreeCAD.addImportType("My own format (*.own)", "importOwn")
FreeCAD.addExportType("My own format (*.own)", "importOwn")
Example #15
0
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Lesser General Public License for more details.                   *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/

import FreeCAD

FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if ("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
    FreeCAD.addExportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
    FreeCAD.addImportType("FEM results (*.vtk *.vtu)", "importVTKResults")
    FreeCAD.addExportType("FEM CFD Result in VTK format (*.vtk *.vtu)",
                          "importVTKResults")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "importCcxFrdResults")
FreeCAD.addImportType("Mesh from Calculix/Abaqus input file (*.inp)",
                      "importInpMesh")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addImportType("Z88 displacement (o2) result file (*.txt)",
                      "importZ88O2Results")
Example #16
0
import FreeCAD
FreeCAD.addImportType("New Importer CSG (*.csg)",
                      "freecad.OpenSCAD_Alt_Import.importCSG")
FreeCAD.addImportType("New Importer SCAD (*.scad)",
                      "freecad.OpenSCAD_Alt_Import.importCSG")
Example #17
0
    def Initialize(self):
        def QT_TRANSLATE_NOOP(scope, text):
            return text

        import OpenSCAD_rc, OpenSCADCommands

        commands = [
            "OpenSCAD_ReplaceObject",
            "OpenSCAD_RemoveSubtree",
            "OpenSCAD_RefineShapeFeature",
            "OpenSCAD_MirrorMeshFeature",
            "OpenSCAD_ScaleMeshFeature",
            "OpenSCAD_ResizeMeshFeature",
            "OpenSCAD_IncreaseToleranceFeature",
            "OpenSCAD_Edgestofaces",
            "OpenSCAD_ExpandPlacements",
            "OpenSCAD_ExplodeGroup",
        ]
        toolbarcommands = [
            "OpenSCAD_ReplaceObject",
            "OpenSCAD_RemoveSubtree",
            "OpenSCAD_ExplodeGroup",
            "OpenSCAD_RefineShapeFeature",
            "OpenSCAD_IncreaseToleranceFeature",
        ]
        import PartGui

        parttoolbarcommands = [
            "Part_CheckGeometry",
            "Part_Primitives",
            "Part_Builder",
            "Part_Cut",
            "Part_Fuse",
            "Part_Common",
            "Part_Extrude",
            "Part_Revolve",
        ]
        import FreeCAD
        translate = FreeCAD.Qt.translate

        param = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
        openscadfilename = param.GetString("openscadexecutable")
        if not openscadfilename:
            import OpenSCADUtils

            openscadfilename = OpenSCADUtils.searchforopenscadexe()
            if openscadfilename:  # automatic search was succsessful
                FreeCAD.addImportType("OpenSCAD Format (*.scad)", "importCSG")
                param.SetString("openscadexecutable",
                                openscadfilename)  # save the result
        if openscadfilename:
            commands.extend([
                "OpenSCAD_AddOpenSCADElement",
                "OpenSCAD_MeshBoolean",
                "OpenSCAD_Hull",
                "OpenSCAD_Minkowski",
            ])

            toolbarcommands.extend([
                "OpenSCAD_AddOpenSCADElement",
                "OpenSCAD_MeshBoolean",
                "OpenSCAD_Hull",
                "OpenSCAD_Minkowski",
            ])
        else:
            FreeCAD.Console.PrintWarning("OpenSCAD executable not found\n")

        transferMechanism = param.GetInt("transfermechanism", 0)
        if openscadfilename and transferMechanism == 0:
            # We are using the Python temp-directory creation function
            if "snap" in openscadfilename:
                FreeCAD.Console.PrintMessage(
                    translate(
                        "OpenSCAD",
                        "It looks like you may be using a Snap version of OpenSCAD.",
                    ) + " " + translate(
                        "OpenSCAD",
                        "If OpenSCAD execution fails to load the temporary file, use FreeCAD's OpenSCAD Workbench Preferences to change the transfer mechanism.",
                    ) + "\n")
            elif sys.executable.startswith("/tmp/"):  # Heuristic for AppImages
                FreeCAD.Console.PrintMessage(
                    translate(
                        "OpenSCAD",
                        "It looks like you may be using a sandboxed version of FreeCAD.",
                    ) + " " + translate(
                        "OpenSCAD",
                        "If OpenSCAD execution fails to load the temporary file, use FreeCAD's OpenSCAD Workbench Preferences to change the transfer mechanism.",
                    ) + "\n")

        self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "OpenSCADTools"),
                           toolbarcommands)
        self.appendMenu("OpenSCAD", commands)
        self.appendToolbar(
            QT_TRANSLATE_NOOP("Workbech", "OpenSCAD Part tools"),
            parttoolbarcommands)
        # self.appendMenu('OpenSCAD',["AddOpenSCADElement"])
        ###self.appendCommandbar("&Generic Tools",["ColorCodeShape"])
        FreeCADGui.addIconPath(":/icons")
        FreeCADGui.addLanguagePath(":/translations")
        FreeCADGui.addPreferencePage(":/ui/openscadprefs-base.ui", "OpenSCAD")
Example #18
0
#

__title__ = "FreeCAD hFrame3DDfc library"
__author__ = "*****@*****.**"

import FreeCAD

FreeCAD.addImportType("FEM result frame3DD (*.out)",
                      "feminout.importFrame3DDResults")
FreeCAD.addImportType("FEM case frame3DD (*.3DD)",
                      "feminout.importFrame3DDCase")
Example #19
0
import FreeCAD

FreeCAD.addImportType("CSI SAFE (*.xls *.xlsx)", "safe.punch.geom")
Example #20
0
# *   (c) Juergen Riegel ([email protected]) 2002                       *
# *                                                                         *
# *   This file is part of the FreeCAD CAx development system.              *
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
# *   as published by the Free Software Foundation; either version 2 of     *
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   FreeCAD is distributed in the hope that it will be useful,            *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Lesser General Public License for more details.                   *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/


import FreeCAD
# add import and export file for this workbench

if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("CFD result formats (*.vtk)", "importCfdResultFoamVTK")

Example #21
0
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/

import FreeCAD

FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if ("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM results (*.vtk *.vtp *.vts *.vtr *.vtu *.vti)",
                          "Fem")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addImportType("Z88 displacement result file (*.txt)", "z88DispReader")
Example #22
0
PATH_PREF = os.path.join(__dir__, 'Preferences/')
#Pyramid shapes
PYRAMID_PATH = os.path.join(__dir__, 'PyramidMo/')
PYRAMID_ICON_PATH = os.path.join(__dir__, 'PyramidMo/Resources/icons/')

#Coin3D New widget system
WIDGETS3D_PATH = os.path.join(__dir__, 'ThreeDWidgets/')

#Direct Modeling implementation
DIRECTMODELING_PATH = os.path.join(__dir__, 'DirectModeling/')

#From DRAFT
__dirname__ = os.path.join(App.getResourceDir(), "Mod", "Draft")

# Defeaturing WB
DEFEATURING_WB = os.path.join(__dir__, 'DefeaturingWB/')
DefeaturingWB_icons_path = os.path.join(DEFEATURING_WB, 'Resources', 'icons')

# PART
App.addImportType("BREP format (*.brep *.brp)", "Part")
App.addExportType("BREP format (*.brep *.brp)", "Part")
App.addImportType("IGES format (*.iges *.igs)", "Part")
App.addExportType("IGES format (*.iges *.igs)", "Part")
App.addImportType("STEP with colors (*.step *.stp)", "Import")
App.addExportType("STEP with colors (*.step *.stp)", "Import")
#Desing456 WB Default  view
#Default Extrusion direction, i.e. 2D/3D objects are placed on XY plane by default.
DefaultDirectionOfExtrusion = 'z'  # We need to know this always. Any change in the plane should be saved here.

App.__unit_test__ += ["TestPartApp"]
Example #23
0
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
# *   as published by the Free Software Foundation; either version 2 of     *
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Library General Public License for more details.                  *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

from os.path import dirname
from os.path import realpath

import FreeCAD


module_path = dirname(realpath(__file__))


FreeCAD.addImportType(
    "1 run BimTester (*.ifc)",
    "freecad.bimtester.import_ifc"
)
Example #24
0
File: Init.py Project: KimK/FreeCAD
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/

# FreeCAD init script of the Fem module

import FreeCAD


FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen")

# see FemMesh::read() and FemMesh::write() methods in src/Mod/Fem/App/FemMesh.cpp
FreeCAD.addImportType("FEM mesh formats (*.unv *.med *.dat *.bdf *.inp *.vtk *.vtu *.z88)", "Fem")
FreeCAD.addExportType("FEM mesh formats (*.unv *.med *.stl *.dat *.inp *.vtk *.vtu *.z88)", "Fem")

FreeCAD.addImportType("FEM result CalculiX (*.frd)", "feminout.importCcxFrdResults")

FreeCAD.addImportType("FEM mesh Fenics (*.xml *.xdmf)", "feminout.importFenicsMesh")
FreeCAD.addExportType("FEM mesh Fenics (*.xml *.xdmf)", "feminout.importFenicsMesh")

FreeCAD.addImportType("FEM mesh Z88 (*i1.txt)", "feminout.importZ88Mesh")
FreeCAD.addExportType("FEM mesh Z88 (*i1.txt)", "feminout.importZ88Mesh")

FreeCAD.addImportType("FEM result Z88 displacements (*o2.txt)", "feminout.importZ88O2Results")

if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM result VTK (*.vtk *.vtu)", "feminout.importVTKResults")
    FreeCAD.addExportType("FEM result VTK (*.vtk *.vtu)", "feminout.importVTKResults")
Example #25
0
# ***************************************************************************
# *                                                                         *
# *   Copyright (c) 2013 - Juergen Riegel <*****@*****.**>      *
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
# *   as published by the Free Software Foundation; either version 2 of     *
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Library General Public License for more details.                  *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

import FreeCAD

# import for the FreeCAD Material card
FreeCAD.addImportType("FreeCAD Material Card (*.FCMat)", "importFCMat")
Example #26
0
#***************************************************************************
#*                                                                         *
#*   Copyright (c) 2013 - Juergen Riegel <*****@*****.**>      *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Library General Public License for more details.                  *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#***************************************************************************


import FreeCAD


# import for the FreeCAD Material card
FreeCAD.addImportType("FreeCAD Material Card (*.FCMat)", "importFCMat")
Example #27
0
# FreeCAD init script of the Mesh module
# (c) 2004 Werner Mayer LGPL

import FreeCAD

# Append the open handler
FreeCAD.addImportType("STL Mesh (*.stl *.ast)", "Mesh")
FreeCAD.addImportType("Binary Mesh (*.bms)", "Mesh")
FreeCAD.addImportType("Alias Mesh (*.obj)", "Mesh")
FreeCAD.addImportType("Object File Format Mesh (*.off)", "Mesh")
FreeCAD.addImportType("Stanford Triangle Mesh (*.ply)", "Mesh")
FreeCAD.addImportType("Simple Model Format (*.smf)", "Mesh")

FreeCAD.addExportType("STL Mesh (*.stl *.ast)", "Mesh")
FreeCAD.addExportType("Binary Mesh (*.bms)", "Mesh")
FreeCAD.addExportType("Alias Mesh (*.obj)", "Mesh")
FreeCAD.addExportType("Object File Format Mesh (*.off)", "Mesh")
FreeCAD.addExportType("Stanford Triangle Mesh (*.ply)", "Mesh")
FreeCAD.addExportType("Additive Manufacturing Format (*.amf)", "Mesh")
FreeCAD.addExportType("Simple Model Format (*.smf)", "Mesh")
FreeCAD.addExportType("3D Manufacturing Format (*.3mf)", "Mesh")

FreeCAD.__unit_test__ += [ "MeshTestsApp" ]
Example #28
0
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/
import FreeCAD, os
FreeCAD.addImportType("OpenSCAD CSG Format (*.csg)", "importCSG")
param = FreeCAD.ParamGet(\
    "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
openscadbin = openscadfilename and os.path.isfile(openscadfilename)
if openscadbin:
    FreeCAD.addImportType("OpenSCAD Format (*.scad)", "importCSG")
    FreeCAD.__unit_test__ += ["TestOpenSCADApp"]

FreeCAD.addExportType("OpenSCAD CSG Format (*.csg)", "exportCSG")
FreeCAD.addExportType("OpenSCAD Format (*.scad)", "exportCSG")
Example #29
0
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/

# FreeCAD init script of the Fem module

import FreeCAD

FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen")

FreeCAD.addImportType("FEM mesh formats (*.unv *.med *.dat *.bdf)", "Fem")
FreeCAD.addExportType(
    "FEM mesh formats (*.unv *.med *.stl *.dat *.inp *.vtk *.vtu)", "Fem")

FreeCAD.addImportType("FEM mesh CalculiX/Abaqus (*.inp)",
                      "feminout.importInpMesh")
FreeCAD.addImportType("FEM result CalculiX (*.frd)",
                      "feminout.importCcxFrdResults")

FreeCAD.addImportType("FEM mesh Fenics (*.xml *.xdmf)",
                      "feminout.importFenicsMesh")
FreeCAD.addExportType("FEM mesh Fenics (*.xml *.xdmf)",
                      "feminout.importFenicsMesh")

FreeCAD.addImportType("FEM mesh Z88 (*i1.txt)", "feminout.importZ88Mesh")
FreeCAD.addExportType("FEM mesh Z88 (*i1.txt)", "feminout.importZ88Mesh")
Example #30
0
                                                  self.title, str(e))


FreeCAD.Logger = FCADLogger

# init every application by importing Init.py
try:
    import traceback
    InitApplications()
except Exception as e:
    Err('Error in InitApplications ' + str(e) + '\n')
    Err('-' * 80 + '\n')
    Err(traceback.format_exc())
    Err('-' * 80 + '\n')

FreeCAD.addImportType("FreeCAD document (*.FCStd)", "FreeCAD")

# set to no gui, is overwritten by InitGui
App.GuiUp = 0

# fill up unit definitions

App.Units.NanoMetre = App.Units.Quantity('nm')
App.Units.MicroMetre = App.Units.Quantity('um')
App.Units.MilliMetre = App.Units.Quantity('mm')
App.Units.CentiMetre = App.Units.Quantity('cm')
App.Units.DeciMetre = App.Units.Quantity('dm')
App.Units.Metre = App.Units.Quantity('m')
App.Units.KiloMetre = App.Units.Quantity('km')

App.Units.MilliLiter = App.Units.Quantity('ml')
Example #31
0
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/
import FreeCAD,os
FreeCAD.addImportType("OpenSCAD CSG Format (*.csg)","importCSG")
param = FreeCAD.ParamGet(\
    "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
openscadbin = openscadfilename and os.path.isfile(openscadfilename)
if openscadbin:
    FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
FreeCAD.addExportType("OpenSCAD CSG Format (*.csg)","exportCSG")
FreeCAD.addExportType("OpenSCAD Format (*.scad)","exportCSG")

Example #32
0
# init the gui

# signal that the gui is up
App.GuiUp = 1
App.Gui = FreeCADGui

Gui.addWorkbench(NoneWorkbench())

# init modules
InitApplications()

# set standard workbench (needed as fallback)
Gui.activateWorkbench("NoneWorkbench")

# Register .py, .FCScript and .FCMacro
FreeCAD.addImportType("Inventor V2.1 (*.iv)", "FreeCADGui")
FreeCAD.addImportType("VRML V2.0 (*.wrl *.vrml *.wrz *.wrl.gz)", "FreeCADGui")
FreeCAD.addImportType("Python (*.py *.FCMacro *.FCScript)", "FreeCADGui")
FreeCAD.addExportType("Inventor V2.1 (*.iv)", "FreeCADGui")
FreeCAD.addExportType("VRML V2.0 (*.wrl *.vrml *.wrz *.wrl.gz)", "FreeCADGui")
#FreeCAD.addExportType("IDTF (for 3D PDF) (*.idtf)","FreeCADGui")
FreeCAD.addExportType("3D View (*.svg)", "FreeCADGui")
FreeCAD.addExportType("Portable Document Format (*.pdf)", "FreeCADGui")

del (InitApplications)
del (NoneWorkbench)
del (StandardWorkbench)

Log('Init: Running FreeCADGuiInit.py start script... done\n')
Example #33
0
# *   FreeCAD is distributed in the hope that it will be useful,            *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Lesser General Public License for more details.                   *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with FreeCAD; if not, write to the Free Software        *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# *   Juergen Riegel 2002                                                   *
# ***************************************************************************/


import FreeCAD


FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
if("BUILD_FEM_VTK" in FreeCAD.__cmake__):
    FreeCAD.addImportType("FEM results (*.vtk *.vtp *.vts *.vtr *.vtu *.vti)", "Fem")
    FreeCAD.addImportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")
    FreeCAD.addExportType("FEM CFD Unstructure Mesh (*.vtk *.vtu)", "Fem")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Mesh from Calculix/Abaqus input file (*.inp)", "importInpMesh")
FreeCAD.addImportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addExportType("Z88 mesh file (*.txt)", "importZ88Mesh")
FreeCAD.addImportType("Z88 displacement result file (*.txt)", "z88DispReader")
Example #34
0
#*   (c) Juergen Riegel ([email protected]) 2002                       *
#*                                                                         *
#*   This file is part of the FreeCAD CAx development system.              *
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   FreeCAD is distributed in the hope that it will be useful,            *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Lesser General Public License for more details.                   *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with FreeCAD; if not, write to the Free Software        *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#*   Juergen Riegel 2002                                                   *
#***************************************************************************/

import FreeCAD

FreeCAD.addExportType("TetGen file (*.poly)", "convert2TetGen")
FreeCAD.addImportType("FEM formats (*.unv *.med *.dat *.bdf)", "Fem")
FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)", "ccxFrdReader")
FreeCAD.addImportType("Abaqus file (*.inp)", "FemGui")
Example #35
0
# -*- coding: utf-8 -*-

__title__ = "Curves workbench"
__author__ = "Christophe Grellier (Chris_G)"
__license__ = "LGPL 2.1"
__doc__ = "FreeCAD workbench that offers a collection of tools mainly related to Nurbs curves and surfaces."

import os
import sys
import _utils
import FreeCAD

FreeCAD.addImportType("3DM (*.3dm)","import3DM")
path_curvesWB = os.path.dirname(_utils.__file__)
sys.path.append(os.path.join(path_curvesWB, 'Gui'))
path_curvesWB_icons =  os.path.join( path_curvesWB, 'Resources', 'icons')
_utils.setIconsPath(path_curvesWB_icons)
global main_CurvesWB_Icon
main_CurvesWB_Icon = os.path.join( path_curvesWB_icons , 'blendSurf.svg')

class CurvesWorkbench(Workbench):
    """FreeCAD workbench that offers a collection of tools mainly related to Nurbs curves and surfaces."""
    MenuText = "Curves"
    global main_CurvesWB_Icon
    Icon = main_CurvesWB_Icon
    
    def Initialize(self):
        """This function is executed when FreeCAD starts"""
        
        #import Sw2R
        #import PlateSurface
Example #36
0
		sys.path.append(os.path.expanduser('~/Library/Application Support/FreeCAD/Mod'))

# some often used shortcuts (for lazy people like me  ;-)
App = FreeCAD
Log = FreeCAD.Console.PrintLog
Msg = FreeCAD.Console.PrintMessage
Err = FreeCAD.Console.PrintError
Wrn = FreeCAD.Console.PrintWarning
test_ascii = lambda s: all(ord(c) < 128 for c in s)

Log ('Init: starting App::FreeCADInit.py\n')

# init every application by importing Init.py
InitApplications()

FreeCAD.addImportType("FreeCAD document (*.FCStd)","FreeCAD")

# set to no gui, is overwritten by InitGui
App.GuiUp = 0

# fill up unit definitions

App.Units.NanoMetre     = App.Units.Quantity('nm')
App.Units.MicroMetre    = App.Units.Quantity('um')
App.Units.MilliMetre    = App.Units.Quantity('mm')
App.Units.CentiMetre    = App.Units.Quantity('cm')
App.Units.DeciMetre     = App.Units.Quantity('dm')
App.Units.Metre         = App.Units.Quantity('m')
App.Units.KiloMetre     = App.Units.Quantity('km')

App.Units.Liter         = App.Units.Quantity('l')
Example #37
0
import FreeCAD
FreeCAD.addImportType("GDML (*.gdml)","freecad.gdml.importGDML")
FreeCAD.addImportType("GDML (*.xml)","freecad.gdml.importGDML")
FreeCAD.addExportType("GDML (*.gdml)","freecad.gdml.exportGDML")
FreeCAD.addExportType("GDML (*.GDML)","freecad.gdml.exportGDML")
FreeCAD.addExportType("XML (*.XML)","freecad.gdml.exportGDML")
FreeCAD.addExportType("XML (*.xml)","freecad.gdml.exportGDML")