Oasys.D3PLOT.Part class

Properties

property Part.data: float | array

Component data for a part passed as an argument to GetMultipleData. Note that data will only exist for the instance of the part passed to GetMultipleData. i.e. it is a local property stored on the specific instance. It is not stored in the D3PLOT database

property Part.elementType: constant

The type of elements in the part. e.g. Type.SHELL, Type.SOLID etc

property Part.include: integer

The include file number in the model that the part is in

property Part.index: integer

The internal index for the part in D3PLOT

property Part.label: integer

The LS-DYNA label for the part

property Part.material: Material

The Material the part has. This is only available if there is a ztf file for the model. If not None will be returned

property Part.model: Model

The Model that the part is in

property Part.title: string

The title for the part (or None if no title)

property Part.type: constant

The type for the part (will be Type.PART)

Static methods

classmethod Part.BlankAll(window, model)

Blanks all of the parts in the model

Parameters:
  • window (GraphicsWindow) – GraphicsWindow) to blank the parts in

  • model (Model) – Model that all the parts will be blanked in

Returns:

No return value

Return type:

None

Example

To blank all of the parts in model m, in graphics window gw:

Oasys.D3PLOT.Part.BlankAll(gw, m)
classmethod Part.BlankFlagged(window, model, flag)

Blanks all of the parts in the model flagged with a defined flag

Parameters:
  • window (GraphicsWindow) – GraphicsWindow) to blank the parts in

  • model (Model) – Model that the flagged parts will be blanked in

  • flag (Flag) – Flag (see AllocateFlag) set on the parts to blank

Returns:

No return value

Return type:

None

Example

To blank all of the parts flagged with flag f in model m, in graphics window gw:

Oasys.D3PLOT.Part.BlankFlagged(gw, m, f)
classmethod Part.First(model)

Returns the first part in the model (or None if there are no parts in the model)

Parameters:

model (Model) – Model to get first part in

Returns:

Part object

Return type:

Part

Example

To get the first part in model m:

p = Oasys.D3PLOT.Part.First(m)
classmethod Part.FlagAll(model, flag)

Flags all of the parts in the model with a defined flag

Parameters:
  • model (Model) – Model that all the parts will be flagged in

  • flag (Flag) – Flag (see AllocateFlag) to set on the parts

Returns:

No return value

Return type:

None

Example

To flag all of the parts with flag f in model m:

Oasys.D3PLOT.Part.FlagAll(m, f)
classmethod Part.GetAll(model)

Gets all of the parts in the model

Parameters:

model (Model) – Model that all the parts are in

Returns:

List of Part objects

Return type:

list

Example

To get all of the parts in model m:

p = Oasys.D3PLOT.Part.GetAll(m)
classmethod Part.GetFlagged(model, flag)

Gets all of the parts in the model flagged with a defined flag

Parameters:
  • model (Model) – Model that the flagged parts are in

  • flag (Flag) – Flag (see AllocateFlag) set on the parts to get

Returns:

List of Part objects

Return type:

list

Example

To get all of the parts flagged with flag f in model m:

Oasys.D3PLOT.Part.GetFlagged(m, f)
classmethod Part.GetFromID(model, label)

Returns the Part object for part in model with label (or None if it does not exist)

Parameters:
  • model (Model) – Model to get part in

  • label (integer) – The LS-DYNA label for the part in the model

Returns:

Part object

Return type:

Part

Example

To get the part in model m with label 1000:

p = Oasys.D3PLOT.Part.GetFromID(m, 1000)
classmethod Part.GetFromIndex(model, index)

Returns the Part object for part in model with index (or None if it does not exist)

Parameters:
  • model (Model) – Model to get part in

  • index (integer) – The D3PLOT internal index in the model for part

Returns:

Part object

Return type:

Part

Example

To get the part in model m at index 50:

p = Oasys.D3PLOT.Part.GetFromIndex(m, 50)
classmethod Part.GetMultipleData(component, items, options=Oasys.gRPC.defaultArg)

Returns the value for a data component for multiple parts. For each part a local property called data will be created containing a number if a scalar component, or a list if a vector or tensor component (or None if the value cannot be calculated). The data is also returned as an object.
Also see GetData

Parameters:
Returns:

Dictionary containing the data. A property is created in the dictionary for each part with the label. The value of the property is a number if a scalar component or an array if a vector or tensor component (or None if the value cannot be calculated)

Return type:

dictionary

Example

To calculate a component for parts in list items and use the data property (note that in the example, the argument extra is optional):

Oasys.D3PLOT.Part.GetMultipleData(component, items, {"extra": 1})
for item in items:
    if item.data != None:
        do_something..

To calculate a component for parts in list items and use the return value (note that in the example, the argument extra is optional):

data = Oasys.D3PLOT.Part.GetMultipleData(component, items, {"extra": 1})
for d in data:
    Oasys.D3PLOT.Message("Label is {}".format(d))
    if data[d] != None:
        do_something..
classmethod Part.Last(model)

Returns the last part in the model (or None if there are no parts in the model)

Parameters:

model (Model) – Model to get last part in

Returns:

Part object

Return type:

Part

Example

To get the last part in model m:

p = Oasys.D3PLOT.Part.Last(m)
classmethod Part.Pick()

Allows the user to pick a part from the screen

Returns:

Part object or None if cancelled

Return type:

Part

Example

To pick a part:

p = Oasys.D3PLOT.Part.Pick()
classmethod Part.Select(flag)

Selects parts using an object menu

Parameters:

flag (Flag) – Flag (see AllocateFlag) to use when selecting parts

Returns:

The number of parts selected or None if menu cancelled

Return type:

integer

Example

To select parts, flagging those selected with flag f:

total = Oasys.D3PLOT.Part.Select(f)
classmethod Part.Total(model)

Returns the total number of parts in the model

Parameters:

model (Model) – Model to get total in

Returns:

The number of parts

Return type:

integer

Example

To get the number of parts in model m:

total = Oasys.D3PLOT.Part.Total(m)
classmethod Part.UnblankAll(window, model)

Unblanks all of the parts in the model

Parameters:
  • window (GraphicsWindow) – GraphicsWindow) to unblank the parts in

  • model (Model) – Model that all the parts will be unblanked in

Returns:

No return value

Return type:

None

Example

To unblank all of the parts in model m, in graphics window gw:

Oasys.D3PLOT.Part.UnblankAll(gw, m)
classmethod Part.UnblankFlagged(window, model, flag)

Unblanks all of the parts in the model flagged with a defined flag

Parameters:
  • window (GraphicsWindow) – GraphicsWindow) to unblank the parts in

  • model (Model) – Model that the flagged parts will be unblanked in

  • flag (Flag) – Flag (see AllocateFlag) set on the parts to unblank

Returns:

No return value

Return type:

None

Example

To unblank all of the parts flagged with flag f in model m, in graphics window gw:

Oasys.D3PLOT.Part.UnblankFlagged(gw, m, f)
classmethod Part.UnflagAll(model, flag)

Unsets a defined flag on all of the parts in the model

Parameters:
  • model (Model) – Model that the defined flag for all parts will be unset in

  • flag (Flag) – Flag (see AllocateFlag) to unset on the parts

Returns:

No return value

Return type:

None

Example

To unset flag f on all of the parts in model m:

Oasys.D3PLOT.Part.UnflagAll(m, f)

Instance methods

Part.Blank(window)

Blanks the part in a graphics window

Parameters:

window (GraphicsWindow) – GraphicsWindow) to blank the part in

Returns:

No return value

Return type:

None

Example

To blank part p in graphics window g:

p.Blank(g)
Part.Blanked(window)

Checks if the part is blanked in a graphics window or not

Parameters:

window (GraphicsWindow) – GraphicsWindow) in which to check if the part is blanked

Returns:

True if blanked, False if not

Return type:

boolean

Example

To check if part p is blanked in graphics window g:

if p.Blanked(g):
    do_something..
Part.ClearFlag(flag)

Clears a flag on a part

Parameters:

flag (Flag) – Flag (see AllocateFlag) to clear on the part

Returns:

No return value

Return type:

None

Example

To clear flag f on part p:

p.ClearFlag()
Part.Elements()

Returns a list containing the elements in the part

Returns:

Array of element objects

Return type:

array

Example

To return the elements for part p:

elements = p.Elements()
Part.Flagged(flag)

Checks if the part is flagged or not

Parameters:

flag (Flag) – Flag (see AllocateFlag) to test on the part

Returns:

True if flagged, False if not

Return type:

boolean

Example

To check if part p has flag f set on it:

if p.Flagged(f):
    do_something..
Part.GetData(component, options=Oasys.gRPC.defaultArg)

Returns the value for a data component.
Also see GetMultipleData

Parameters:
  • component (constant) – Component constant to get data for

  • options (dict) –

    Optional. Dictionary containing options for getting data. Can be any of:

    extra:

    (integer) The extra data component number if component Component.SOX for solids, Component.BMX for beams or Component.SHX for shells and thick shells

    ip:

    (integer) Integration point number to get the data at (ip >= 1 or one of the constants Constant.TOP, Constant.MIDDLE or Constant.BOTTOM). If the integration point is not defined it will use the integration point defined on the current GUI “data” panel, which defaults to the middle surface for shells, thick shells, and solids, and Mag All for beams, but may vary if changed by an interactive user. If consistent output from a script is required, independent of any prior interactive activity, an explicit integration point or surface should be defined

    op:

    (integer) On plane integration point number for shells and thick shells (op >= 1 [default])

    referenceFrame:

    (constant) The frame of reference to return values in. Either Constant.GLOBAL (default), Constant.LOCAL, Constant.CYLINDRICAL, Constant.USER_DEFINED or Constant.MATERIAL. This is only necessary for directional components (eg X stress) and then only when something other than the default Constant.GLOBAL coordinate system is to be used

    user:

    (integer) The user-defined component number if component Component.UNOS, Component.UNOV, Component.USSS, Component.USST, Component.UBMS or Component.UBMV

Returns:

Number if a scalar component, array if a vector or tensor component (or None if the value cannot be calculated because it’s not available in the model).<br> If requesting an invalid component it will throw an error (e.g. Component.AREA of a node).

Return type:

float|array

Example

To calculate a component and check it has been calculated (note that in the example, the argument extra is optional):

value = p.GetData(component, {"extra": 1})
if value != None:
    do_something..
Part.Next()

Returns the next part in the model (or None if there is not one)

Returns:

Part object

Return type:

Part

Example

To get the next part after part p:

p = p.Next()
Part.Previous()

Returns the previous part in the model (or None if there is not one)

Returns:

Part object

Return type:

Part

Example

To get the previous part before part p:

p = p.Previous()
Part.SetFlag(flag)

Sets a flag on a part

Parameters:

flag (Flag) – Flag (see AllocateFlag) to set on the part

Returns:

No return value

Return type:

None

Example

To set flag f on part p:

p.SetFlag(f)
Part.Unblank(window)

Unblanks the part in a graphics window

Parameters:

window (GraphicsWindow) – GraphicsWindow) to unblank the part in

Returns:

No return value

Return type:

None

Example

To unblank part p in graphics window g:

p.Unblank(g)