StockBuilder Class — NXOpen Python API Reference 12.0.0 documentation

# StockBuilder Class

class `NXOpen.MechanicalRouting.``StockBuilder`

  Bases: `NXOpen.Builder`

  Builder for creating/editing stocks.

  Create Stock: Takes a set of segments and assign the selected the stock to the segments. The stock style and orientation settings are optional. Edit Stock: Takes in the selected stock to edit as input and redefines the stock with the new settings.

  To create a new instance of this class, use `NXOpen.MechanicalRouting.BuilderFactory.CreateStockBuilder()`

  Default values.

  Property | Value
  --- | ---
  OrientationAngle.Value | 0

  New in version NX11.0.0.

# Properties

Property | Description
--- | ---
CrossSectionDirection | Returns or sets the orientation vector.
MirrorCrossSection | Returns or sets the mirror cross section value.
OrientationAngle | Returns the angle.
SegmentCollector | Returns the routing object collector that collects segments to assign stock to.
StockAnchor | Returns or sets
StockSettings | Returns the path stock settings required to assign stock
Tag | Returns the Tag for this object.

# Methods

Method | Description
--- | ---
Commit | Commits any edits that have been applied to the builder.
Destroy | Deletes the builder, and cleans up any objects created by the builder.
GetCommittedObjects | For builders that create more than one object, this method returns the objects that are created by commit.
GetLogicalObjects | Returns the :py:class:`PDM.LogicalObject`s that represent content that will be created by this builder.
GetObject | Returns the object currently being edited by this builder.
PreCommit | Performs the operations needed prior to a commit.
ShowResults | Updates the model to reflect the result of an edit to the model for all builders that support showing results.
Validate | Validate whether the inputs to the component are sufficient for commit to be called.

# Property Detail

## CrossSectionDirection

`StockBuilder.``CrossSectionDirection`

  Returns or sets the orientation vector.

  cross section direction of the stock.

  `-------------------------------------`

  Getter Method

  Signature `CrossSectionDirection`

  Returns: |
  Return type: | `NXOpen.Direction`

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

  `-------------------------------------`

  Setter Method

  Signature `CrossSectionDirection`

  Parameters: | orientationVector (`NXOpen.Direction`) –

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

## MirrorCrossSection

`StockBuilder.``MirrorCrossSection`

  Returns or sets the mirror cross section value.

  `-------------------------------------`

  Getter Method

  Signature `MirrorCrossSection`

  Returns: |
  Return type: | bool

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

  `-------------------------------------`

  Setter Method

  Signature `MirrorCrossSection`

  Parameters: | flag (bool) –

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

## OrientationAngle

`StockBuilder.``OrientationAngle`

  Returns the angle.

  Determines the rotation angle of the stock.

  `-------------------------------------`

  Getter Method

  Signature `OrientationAngle`

  Returns: |
  Return type: | `NXOpen.Expression`

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

## SegmentCollector

`StockBuilder.``SegmentCollector`

  Returns the routing object collector that collects segments to assign stock to.

  `-------------------------------------`

  Getter Method

  Signature `SegmentCollector`

  Returns: |
  Return type: | `NXOpen.Routing.RouteObjectCollector`

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

## StockAnchor

`StockBuilder.``StockAnchor`

  Returns or sets

  `-------------------------------------`

  Getter Method

  Signature `StockAnchor`

  Returns: |
  Return type: | str

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

  `-------------------------------------`

  Setter Method

  Signature `StockAnchor`

  Parameters: | anchorName (str) –

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

## StockSettings

`StockBuilder.``StockSettings`

  Returns the path stock settings required to assign stock

  `-------------------------------------`

  Getter Method

  Signature `StockSettings`

  Returns: |
  Return type: | `NXOpen.MechanicalRouting.PathStockPreferenceBuilder`

  New in version NX11.0.0.

  License requirements: routing_base (“Routing Basic”)

# Method Detail

## GetLogicalObjects

`StockBuilder.``GetLogicalObjects`

  Returns the :py:class:`PDM.LogicalObject`s that represent content that will be created by this builder.

  Signature `GetLogicalObjects()`

  Returns: |
  Return type: | list of `NXOpen.PDM.LogicalObject`

  New in version NX11.0.1.

  License requirements: routing_base (“Routing Basic”)

## PreCommit

`StockBuilder.``PreCommit`

  Performs the operations needed prior to a commit.

  This method has to be called before invoking commit.

  Signature `PreCommit()`

  New in version NX11.0.1.

  License requirements: routing_base (“Routing Basic”)

## Validate

`StockBuilder.``Validate`

  Validate whether the inputs to the component are sufficient for commit to be called.

  If the component is not in a state to commit then an exception is thrown. For example, if the component requires you to set some property, this method will throw an exception if you haven’t set it. This method throws a not-yet-implemented NXException for some components.

  Signature `Validate()`

  Returns: | Was self validation successful
  Return type: | bool

  New in version NX3.0.1.

  License requirements: None.