Export this shape to a STEP file. kwargs is used to provide additional optional keyword arguments to configure the exporter. :param fileName: Path and filename for writing. :type fileName: str :param unit: The internal unit of the model's geometry values. De
(
self,
fileName: str,
unit: UnitLiterals = "MM",
outputUnit: UnitLiterals | None = None,
**kwargs: Any,
)
| 515 | return writer.Write(self.wrapped, fileName) |
| 516 | |
| 517 | def exportStep( |
| 518 | self, |
| 519 | fileName: str, |
| 520 | unit: UnitLiterals = "MM", |
| 521 | outputUnit: UnitLiterals | None = None, |
| 522 | **kwargs: Any, |
| 523 | ) -> IFSelect_ReturnStatus: |
| 524 | """ |
| 525 | Export this shape to a STEP file. |
| 526 | kwargs is used to provide additional optional keyword arguments to configure the exporter. |
| 527 | |
| 528 | :param fileName: Path and filename for writing. |
| 529 | :type fileName: str |
| 530 | :param unit: The internal unit of the model's geometry values. Default "MM". |
| 531 | :type unit: UnitLiterals |
| 532 | :param outputUnit: The unit to use in the STEP file header. If None, defaults to the value of ``unit``. |
| 533 | Use this when you want the output file to declare a different unit than the model's internal unit, |
| 534 | for example to export a MM model as a STEP file declaring meters. |
| 535 | :type outputUnit: UnitLiterals or None |
| 536 | :param write_pcurves: Enable or disable writing parametric curves to the STEP file. Default True. |
| 537 | If False, writes STEP file without pcurves. This decreases the size of the resulting STEP file. |
| 538 | :type write_pcurves: bool |
| 539 | :param precision_mode: Controls the uncertainty value for STEP entities. Specify -1, 0, or 1. Default 0. |
| 540 | See OCCT documentation. |
| 541 | :type precision_mode: int |
| 542 | """ |
| 543 | |
| 544 | # Handle the extra settings for the STEP export |
| 545 | pcurves = 1 |
| 546 | if "write_pcurves" in kwargs and not kwargs["write_pcurves"]: |
| 547 | pcurves = 0 |
| 548 | precision_mode = kwargs["precision_mode"] if "precision_mode" in kwargs else 0 |
| 549 | |
| 550 | writer = STEPControl_Writer() |
| 551 | Interface_Static.SetIVal_s("write.surfacecurve.mode", pcurves) |
| 552 | Interface_Static.SetIVal_s("write.precision.mode", precision_mode) |
| 553 | Interface_Static.SetCVal_s("xstep.cascade.unit", unit.upper()) |
| 554 | Interface_Static.SetCVal_s( |
| 555 | "write.step.unit", outputUnit if outputUnit is not None else unit.upper() |
| 556 | ) |
| 557 | writer.Transfer(self.wrapped, STEPControl_AsIs) |
| 558 | |
| 559 | return writer.Write(fileName) |
| 560 | |
| 561 | def exportBrep(self, f: str | BytesIO) -> bool: |
| 562 | """ |