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 #2
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"]
Example #3
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')
# 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 #5
0
# *   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                                                   *
# ***************************************************************************/

# 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"
Example #6
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")
        }


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)
l.EndPoint = (1.0, 1.0, 1.0)
doc.addObject("Part::Feature", "Line").Shape = l.toShape()
doc.recompute()

import Part, PartGui
doc = App.activeDocument()
n = list()

# create a 3D vector, set its coordinates and add it to the list
Example #8
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 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")
Log('Init: Running FreeCADGuiInit.py start script...\n')

# 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")

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

Log('Init: Running FreeCADGuiInit.py start script... done\n')
Example #10
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 #11
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 #12
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")
FreeCAD.addExportType("DRAWEXE source (*.draw)", "exportDRAWEXE")
Example #13
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                                                   *
#***************************************************************************/


# Get the Parameter Group of this module
ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Sandbox")

# Set the needed information
ParGrp.SetString("HelpIndex",        "Sandbox/Help/index.html")
ParGrp.SetString("WorkBenchName",    "Sandbox Design")
ParGrp.SetString("WorkBenchModule",  "SandboxWorkbench.py")
import FreeCAD
FreeCAD.addExportType("DRAWEXE source (*.draw)","exportDRAWEXE")

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
# *                                                                         *
# *   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")

FreeCAD.addExportType("FEM Mesh GMSH formats (*.ply2 *.cgns *.msh)",
                      "importGmshMesh")
Example #16
0
                    self.csg.write('#Annotation %s\n' % (ob.Name))
                v = ob.Position
                self.csg.write('dtext %s %s %s "%s"\n' % \
                        (f2s(v.x),f2s(v.y),f2s(v.z), '\\n'.join(\
                        ob.LabelText).encode(\
                        'ascii', errors='xmlcharrefreplace')))

    def export_objects(self, objlst, toplevel=True):
        self.write_header()
        toplevelobjs = [self.process_object(ob, toplevel=toplevel)\
                for ob in objlst]
        names = [name for name in toplevelobjs if name is not False]
        self.csg.write('donly %s\n' % (' '.join(names)))
        self.export_annotations(objlst)
        #for ob in objlst:
        #    self.process_object(ob,toplevel=toplevel)
        #self.write_displayonly(objlst)

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.csg.close()


def export(exportList, filename):
    "called when freecad exports a file"
    with Drawexporter(filename) as exporter:
        exporter.export_objects(exportList)


if 'tcl' not in FreeCAD.getExportType():
    FreeCAD.addExportType("DRAWEXE script (*.tcl)", "exportDRAWEXE")
Example #17
0
# *   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                                                   *
# ***************************************************************************/

# 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 *.dat *.inp)", "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")
Example #18
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 #19
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 #20
0
File: Init.py Project: KimK/FreeCAD
# *   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                                                   *
# ***************************************************************************/

# 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")
Example #21
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")
FreeCAD.addExportType("DRAWEXE source (*.draw)","exportDRAWEXE")

Example #22
0
try:
    from pivy import coin
    _SoGroup_init_orig = coin.SoGroup.__init__
    coin.SoGroup.__init__ = _SoGroup_init
except Exception:
    pass

# 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("X3D Extensible 3D (*.x3d *.x3dz)", "FreeCADGui")
FreeCAD.addExportType("WebGL/X3D (*.xhtml)", "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 #23
0
# FreeCAD init script of the Sandbox module
# (c) 2001 Juergen Riegel

#***************************************************************************
#*   (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("DRAWEXE source (*.draw)", "exportDRAWEXE")
Example #24
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 #25
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 #26
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 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)",
Example #27
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)", "feminterface.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)",
                          "feminterface.importVTKResults")
    FreeCAD.addExportType("FEM CFD Result in VTK format (*.vtk *.vtu)",
                          "feminterface.importVTKResults")

FreeCAD.addExportType("FEM formats (*.unv *.med *.dat *.inp)", "Fem")
FreeCAD.addImportType("CalculiX result (*.frd)",
                      "feminterface.importCcxFrdResults")
FreeCAD.addImportType("Fenics mesh file (*.xml *.xdmf)",
                      "feminterface.importFenicsMesh")
FreeCAD.addExportType("Fenics mesh file (*.xml *.xdmf)",
Example #28
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 #29
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("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 #30
0
                            (ob.Name,ob.Label.encode('unicode-escape')))
                else:
                    self.csg.write('#Annotation %s\n' % (ob.Name))
                v=ob.Position
                self.csg.write('dtext %s %s %s "%s"\n' % \
                        (f2s(v.x),f2s(v.y),f2s(v.z), '\\n'.join(\
                        ob.LabelText).encode(\
                        'ascii', errors='xmlcharrefreplace')))

    def export_objects(self,objlst,toplevel=True):
        self.write_header()
        toplevelobjs = [self.process_object(ob, toplevel=toplevel)\
                for ob in objlst]
        names = [name for name in toplevelobjs if name is not False]
        self.csg.write('donly %s\n'%(' '.join(names)))
        self.export_annotations(objlst)
        #for ob in objlst:
        #    self.process_object(ob,toplevel=toplevel)
        #self.write_displayonly(objlst)

    def __exit__(self,exc_type, exc_val, exc_tb ):
        self.csg.close()

def export(exportList,filename):
    "called when freecad exports a file"
    with Drawexporter(filename) as exporter:
        exporter.export_objects(exportList)

if 'tcl' not in FreeCAD.getExportType():
    FreeCAD.addExportType("DRAWEXE script (*.tcl)","exportDRAWEXE")
Example #31
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")