コード例 #1
0
ファイル: brep.py プロジェクト: jf---/aoc-xchange
    def __init__(self, filename=None):
        logger.info("BrepExporter instantiated with filename : %s" % filename)
        check_exporter_filename(filename, brep_extensions)
        check_overwrite(filename)

        self._shape = None  # only one shape can be exported
        self._filename = filename
コード例 #2
0
ファイル: brep.py プロジェクト: bmjjr/OCCDataExchange
    def __init__(self, filename=None):
        logger.info("BrepExporter instantiated with filename : %s" % filename)
        check_exporter_filename(filename, brep_extensions)
        check_overwrite(filename)

        self._shape = None  # only one shape can be exported
        self._filename = filename
コード例 #3
0
ファイル: step_ocaf.py プロジェクト: jf---/aoc-xchange
    def __init__(self, filename, layer_name='layer-00'):
        logger.info("StepOcafExporter instantiated with filename : %s" % filename)

        check_exporter_filename(filename, step_extensions)
        check_overwrite(filename)

        self.filename = filename
        self.h_doc = h_doc = TDocStd.Handle_TDocStd_Document()
        logger.info("Empty Doc?", h_doc.IsNull())

        # Create the application
        app = XCAFApp._XCAFApp.XCAFApp_Application_GetApplication().GetObject()
        app.NewDocument(TCollection.TCollection_ExtendedString("MDTV-CAF"), h_doc)

        # Get root assembly
        doc = h_doc.GetObject()
        self.shape_tool = XCAFDoc.XCAFDoc_DocumentTool().ShapeTool(doc.Main()).GetObject()
        self.colors = XCAFDoc.XCAFDoc_DocumentTool().ColorTool(doc.Main()).GetObject()
        self.layers = XCAFDoc.XCAFDoc_DocumentTool().LayerTool(doc.Main()).GetObject()
        labels = TDF.TDF_LabelSequence()
        color_labels = TDF.TDF_LabelSequence()
        # TopoDS_Shape aShape;

        self.top_label = self.shape_tool.NewShape()
        self.current_color = Quantity.Quantity_Color(Quantity.Quantity_NOC_RED)
        self.current_layer = self.layers.AddLayer(TCollection.TCollection_ExtendedString(layer_name))
        self.layer_names = {}
コード例 #4
0
    def __init__(self, filename, layer_name='layer-00'):
        logger.info("StepOcafExporter instantiated with filename : %s" %
                    filename)

        check_exporter_filename(filename, step_extensions)
        check_overwrite(filename)

        self.filename = filename
        self.h_doc = h_doc = TDocStd.Handle_TDocStd_Document()
        logger.info("Empty Doc?", h_doc.IsNull())

        # Create the application
        app = XCAFApp._XCAFApp.XCAFApp_Application_GetApplication().GetObject()
        app.NewDocument(TCollection.TCollection_ExtendedString("MDTV-CAF"),
                        h_doc)

        # Get root assembly
        doc = h_doc.GetObject()
        self.shape_tool = XCAFDoc.XCAFDoc_DocumentTool().ShapeTool(
            doc.Main()).GetObject()
        self.colors = XCAFDoc.XCAFDoc_DocumentTool().ColorTool(
            doc.Main()).GetObject()
        self.layers = XCAFDoc.XCAFDoc_DocumentTool().LayerTool(
            doc.Main()).GetObject()
        labels = TDF.TDF_LabelSequence()
        color_labels = TDF.TDF_LabelSequence()
        # TopoDS_Shape aShape;

        self.top_label = self.shape_tool.NewShape()
        self.current_color = Quantity.Quantity_Color(Quantity.Quantity_NOC_RED)
        self.current_layer = self.layers.AddLayer(
            TCollection.TCollection_ExtendedString(layer_name))
        self.layer_names = {}
コード例 #5
0
    def __init__(self,
                 filename,
                 verbose=False,
                 schema="AP214CD",
                 tolerance=1e-4):
        logger.info("StepExporter instantiated with filename : %s" % filename)
        logger.info("StepExporter schema : %s" % schema)
        logger.info("StepExporter tolerance : %s" % str(tolerance))

        if schema not in ["AP203", "AP214CD"]:
            msg = "Unsupported STEP schema"
            logger.error(msg)
            raise AssertionError(msg)

        check_exporter_filename(filename, step_extensions)
        check_overwrite(filename)

        self._filename = filename
        self._shapes = list()
        self.verbose = verbose

        self._stepcontrol_writer = STEPControl.STEPControl_Writer()
        self._stepcontrol_writer.SetTolerance(tolerance)

        Interface.Interface_Static_SetCVal("write.step.schema", schema)
コード例 #6
0
ファイル: test_checks.py プロジェクト: jf---/aoc-xchange
def test_check_overwrite():
    r"""check_overwrite() tests"""
    # file exists
    assert check_overwrite(
        path_from_file(__file__, "./models_in/box.igs")) is True

    # file does not exist
    assert check_overwrite(
        path_from_file(__file__, "./models_in/bo_.igs")) is False
コード例 #7
0
def test_check_overwrite():
    r"""check_overwrite() tests"""
    # file exists
    assert check_overwrite(path_from_file(__file__,
                                          "./models_in/box.igs")) is True

    # file does not exist
    assert check_overwrite(path_from_file(__file__,
                                          "./models_in/bo_.igs")) is False
コード例 #8
0
ファイル: stl.py プロジェクト: jf---/aoc-xchange
    def __init__(self, filename=None, ascii_mode=False):
        logger.info("StlExporter instantiated with filename : %s" % filename)
        logger.info("StlExporter ascii : %s" % str(ascii_mode))

        check_exporter_filename(filename, stl_extensions)
        check_overwrite(filename)

        self._shape = None  # only one shape can be exported
        self._ascii_mode = ascii_mode
        self._filename = filename
コード例 #9
0
ファイル: stl.py プロジェクト: bmjjr/OCCDataExchange
    def __init__(self, filename=None, ascii_mode=False, line_deflection=0.9,
                 is_relative=False, angular_deflection=0.5, in_parallel=False):
        logger.info("StlExporter instantiated with filename : %s" % filename)
        logger.info("StlExporter ascii : %s" % str(ascii_mode))

        check_exporter_filename(filename, stl_extensions)
        check_overwrite(filename)

        self._shape = None  # only one shape can be exported
        self._ascii_mode = ascii_mode
        self._filename = filename
        self._line_deflection = line_deflection
        self._is_relative = is_relative
        self._angular_deflection = angular_deflection
        self._in_parallel = in_parallel
コード例 #10
0
ファイル: iges.py プロジェクト: bmjjr/OCCDataExchange
    def __init__(self, filename, format="5.1"):
        logger.info("IgesExporter instantiated with filename : %s" % filename)
        logger.info("IgesExporter format : %s" % format)

        if format not in ["5.1", "5.3"]:
            msg = "Unsupported IGES format"
            logger.error(msg)
            raise ValueError(msg)

        check_exporter_filename(filename, iges_extensions)
        check_overwrite(filename)

        self._shapes = list()
        self._filename = filename

        if format == "5.3":
            self._brepmode = True
        else:
            self._brepmode = False
コード例 #11
0
ファイル: step.py プロジェクト: jf---/aoc-xchange
    def __init__(self, filename, verbose=False, schema="AP214CD", tolerance=1e-4):
        logger.info("StepExporter instantiated with filename : %s" % filename)
        logger.info("StepExporter schema : %s" % schema)
        logger.info("StepExporter tolerance : %s" % str(tolerance))

        if schema not in ["AP203", "AP214CD"]:
            msg = "Unsupported STEP schema"
            logger.error(msg)
            raise AssertionError(msg)

        check_exporter_filename(filename, step_extensions)
        check_overwrite(filename)

        self._filename = filename
        self._shapes = list()
        self.verbose = verbose

        self._stepcontrol_writer = STEPControl.STEPControl_Writer()
        self._stepcontrol_writer.SetTolerance(tolerance)

        Interface.Interface_Static_SetCVal("write.step.schema", schema)