Beispiel #1
0
    def transfer_step(self, schema='AP203', units=None):
        """
        Transfer the document in preparation for STEP export.

        :param str schema: Schema for STEP file ('AP203', or 'AP214').
        :param units: Units to convert STEP file to.
        :type units: str or None

        :return: *True* if transferred, *False* otherwise.
        :rtype: bool
        """
        self._step_writer = STEPCAFControl_Writer()
        self._step_writer.SetNameMode(True)
        self._step_writer.SetColorMode(True)

        Interface_Static.SetCVal_('write.step.schema', schema)
        try:
            units = units_dict[units]
        except KeyError:
            units = Settings.units
        Interface_Static.SetCVal_('write.step.unit', units)

        self._step_writer.Transfer(self._doc)

        tw = self._step_writer.ChangeWriter().WS().TransferWriter()
        self._step_fp = tw.FinderProcess()

        return True
Beispiel #2
0
 def __init__(self, units='inch', modecr=0):
     self._writer = IGESControl_Writer(units, modecr)
     try:
         units = units_dict[units]
     except KeyError:
         units = Settings.units
     Interface_Static.SetCVal_('write.step.unit', units)
Beispiel #3
0
    def __init__(self, schema='AP203', units=None, product_name=None,
                 assembly_mode=None):
        self._writer = STEPControl_Writer()
        self._fp = self._writer.WS().TransferWriter().FinderProcess()
        Interface_Static.SetCVal_('write.step.schema', schema)

        try:
            units = units_dict[units]
        except KeyError:
            units = Settings.units
        Interface_Static.SetCVal_('write.step.unit', units)

        if product_name is not None:
            Interface_Static.SetCVal_('write.step.product.name', product_name)

        if assembly_mode is not None:
            Interface_Static.SetIVal_('write.step.assembly', assembly_mode)
Beispiel #4
0
    def __init__(self, fn):
        self._reader = IGESControl_Reader()

        # Read file
        status = self._reader.ReadFile(fn)
        if status != IFSelect_RetDone:
            raise RuntimeError("Error reading IGES file.")

        # Convert to desired units
        Interface_Static.SetCVal_("xstep.cascade.unit", Settings.units)

        # Transfer
        nroots = self._reader.TransferRoots()
        if nroots > 0:
            self._shape = Shape.wrap(self._reader.OneShape())