Oasys.D3PLOT.Segment class¶
Properties¶
- property Segment.data: float | array¶
Component data for a segment passed as an argument to
GetMultipleData
. Note that data will only exist for the instance of the segment passed toGetMultipleData
. i.e. it is a local property stored on the specific instance. It is not stored in the D3PLOT database
- property Segment.include: integer¶
The include file number in the model that the segment is in
- property Segment.index: integer¶
The internal index for the segment in D3PLOT
- property Segment.label: integer¶
The LS-DYNA label for the segment
- property Segment.material: Material¶
The
Material
the segment has. This is only available if there is a ztf file for the model. If not None will be returned
- property Segment.part: Part¶
The
Part
the segment is in
- property Segment.type: constant¶
The type for the segment (will be
Type.SEGMENT
)
Static methods¶
- classmethod Segment.BlankAll(window, model)¶
Blanks all of the segments in the model
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to blank the segments inmodel (Model) –
Model
that all the segments will be blanked in- Returns:
No return value
- Return type:
None
Example
To blank all of the segments in model m, in graphics window gw:
Oasys.D3PLOT.Segment.BlankAll(gw, m)
- classmethod Segment.BlankFlagged(window, model, flag)¶
Blanks all of the segments in the model flagged with a defined flag
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to blank the segments inmodel (Model) –
Model
that the flagged segments will be blanked inflag (Flag) – Flag (see
AllocateFlag
) set on the segments to blank- Returns:
No return value
- Return type:
None
Example
To blank all of the segments flagged with flag f in model m, in graphics window gw:
Oasys.D3PLOT.Segment.BlankFlagged(gw, m, f)
- classmethod Segment.First(model)¶
Returns the first segment in the model (or None if there are no segments in the model)
- Parameters:
model (Model) –
Model
to get first segment in- Returns:
Segment object
- Return type:
Segment
Example
To get the first segment in model m:
s = Oasys.D3PLOT.Segment.First(m)
- classmethod Segment.FlagAll(model, flag)¶
Flags all of the segments in the model with a defined flag
- Parameters:
model (Model) –
Model
that all the segments will be flagged inflag (Flag) – Flag (see
AllocateFlag
) to set on the segments- Returns:
No return value
- Return type:
None
Example
To flag all of the segments with flag f in model m:
Oasys.D3PLOT.Segment.FlagAll(m, f)
- classmethod Segment.GetAll(model)¶
Gets all of the segments in the model
- Parameters:
model (Model) –
Model
that all the segments are in- Returns:
List of
Segment
objects- Return type:
list
Example
To get all of the segments in model m:
s = Oasys.D3PLOT.Segment.GetAll(m)
- classmethod Segment.GetFlagged(model, flag)¶
Gets all of the segments in the model flagged with a defined flag
- Parameters:
model (Model) –
Model
that the flagged segments are inflag (Flag) – Flag (see
AllocateFlag
) set on the segments to get- Returns:
List of
Segment
objects- Return type:
list
Example
To get all of the segments flagged with flag f in model m:
Oasys.D3PLOT.Segment.GetFlagged(m, f)
- classmethod Segment.GetFromID(model, label)¶
Returns the Segment object for segment in model with label (or None if it does not exist)
- Parameters:
model (Model) –
Model
to get segment inlabel (integer) – The LS-DYNA label for the segment in the model
- Returns:
Segment object
- Return type:
Segment
Example
To get the segment in model m with label 1000:
s = Oasys.D3PLOT.Segment.GetFromID(m, 1000)
- classmethod Segment.GetFromIndex(model, index)¶
Returns the Segment object for segment in model with index (or None if it does not exist)
- Parameters:
model (Model) –
Model
to get segment inindex (integer) – The D3PLOT internal index in the model for segment
- Returns:
Segment object
- Return type:
Segment
Example
To get the segment in model m at index 50:
s = Oasys.D3PLOT.Segment.GetFromIndex(m, 50)
- classmethod Segment.GetMultipleData(component, items, options=Oasys.gRPC.defaultArg)¶
Returns the value for a data component for multiple segments. For each segment 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 seeGetData
- Parameters:
component (constant) – Component constant to get data for
items (list) – List of
Segment
objects to get the data for. All of the segments must be in the same modeloptions (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 orComponent.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
orConstant.BOTTOM
)- 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
orConstant.MATERIAL
. This is only necessary for directional components (eg X stress) and then only when something other than the defaultConstant.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
orComponent.UBMV
- Returns:
Dictionary containing the data. A property is created in the dictionary for each segment 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 segments in list items and use the data property (note that in the example, the argument extra is optional):
Oasys.D3PLOT.Segment.GetMultipleData(component, items, {"extra": 1}) for item in items: if item.data != None: do_something..To calculate a component for segments in list items and use the return value (note that in the example, the argument extra is optional):
data = Oasys.D3PLOT.Segment.GetMultipleData(component, items, {"extra": 1}) for d in data: Oasys.D3PLOT.Message("Label is {}".format(d)) if data[d] != None: do_something..
- classmethod Segment.Last(model)¶
Returns the last segment in the model (or None if there are no segments in the model)
- Parameters:
model (Model) –
Model
to get last segment in- Returns:
Segment object
- Return type:
Segment
Example
To get the last segment in model m:
s = Oasys.D3PLOT.Segment.Last(m)
- classmethod Segment.Pick()¶
Allows the user to pick a segment from the screen
- Returns:
Segment object or None if cancelled
- Return type:
Segment
Example
To pick a segment:
s = Oasys.D3PLOT.Segment.Pick()
- classmethod Segment.Select(flag)¶
Selects segments using an object menu
- Parameters:
flag (Flag) – Flag (see
AllocateFlag
) to use when selecting segments- Returns:
The number of segments selected or None if menu cancelled
- Return type:
integer
Example
To select segments, flagging those selected with flag f:
total = Oasys.D3PLOT.Segment.Select(f)
- classmethod Segment.Total(model)¶
Returns the total number of segments in the model
- Parameters:
model (Model) –
Model
to get total in- Returns:
The number of segments
- Return type:
integer
Example
To get the number of segments in model m:
total = Oasys.D3PLOT.Segment.Total(m)
- classmethod Segment.UnblankAll(window, model)¶
Unblanks all of the segments in the model
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to unblank the segments inmodel (Model) –
Model
that all the segments will be unblanked in- Returns:
No return value
- Return type:
None
Example
To unblank all of the segments in model m, in graphics window gw:
Oasys.D3PLOT.Segment.UnblankAll(gw, m)
- classmethod Segment.UnblankFlagged(window, model, flag)¶
Unblanks all of the segments in the model flagged with a defined flag
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to unblank the segments inmodel (Model) –
Model
that the flagged segments will be unblanked inflag (Flag) – Flag (see
AllocateFlag
) set on the segments to unblank- Returns:
No return value
- Return type:
None
Example
To unblank all of the segments flagged with flag f in model m, in graphics window gw:
Oasys.D3PLOT.Segment.UnblankFlagged(gw, m, f)
- classmethod Segment.UnflagAll(model, flag)¶
Unsets a defined flag on all of the segments in the model
- Parameters:
model (Model) –
Model
that the defined flag for all segments will be unset inflag (Flag) – Flag (see
AllocateFlag
) to unset on the segments- Returns:
No return value
- Return type:
None
Example
To unset flag f on all of the segments in model m:
Oasys.D3PLOT.Segment.UnflagAll(m, f)
Instance methods¶
- Segment.Blank(window)¶
Blanks the segment in a graphics window
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to blank the segment in- Returns:
No return value
- Return type:
None
Example
To blank segment s in graphics window g:
s.Blank(g)
- Segment.Blanked(window)¶
Checks if the segment is blanked in a graphics window or not
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) in which to check if the segment is blanked- Returns:
True if blanked, False if not
- Return type:
boolean
Example
To check if segment s is blanked in graphics window g:
if s.Blanked(g): do_something..
- Segment.ClearFlag(flag)¶
Clears a flag on a segment
- Parameters:
flag (Flag) – Flag (see
AllocateFlag
) to clear on the segment- Returns:
No return value
- Return type:
None
Example
To clear flag f on segment s:
s.ClearFlag()
- Segment.Flagged(flag)¶
Checks if the segment is flagged or not
- Parameters:
flag (Flag) – Flag (see
AllocateFlag
) to test on the segment- Returns:
True if flagged, False if not
- Return type:
boolean
Example
To check if segment s has flag f set on it:
if s.Flagged(f): do_something..
- Segment.GetData(component, options=Oasys.gRPC.defaultArg)¶
Returns the value for a data component.
Also seeGetMultipleData
- 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 orComponent.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
orConstant.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
orConstant.MATERIAL
. This is only necessary for directional components (eg X stress) and then only when something other than the defaultConstant.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
orComponent.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 = s.GetData(component, {"extra": 1}) if value != None: do_something..
- Segment.LocalAxes()¶
Returns the local axes of the element in model space, expressed as direction cosines in a 2D list. Beam elements must have 3 nodes to be able to return local axes
- Returns:
list of lists
- Return type:
list
Example
To get the local axes for segment s:
axes = s.LocalAxes() xAxis = [ axes[0][0], axes[0][1], axes[0][2] ] yAxis = [ axes[1][0], axes[1][1], axes[1][2] ] zAxis = [ axes[2][0], axes[2][1], axes[2][2] ]
- Segment.Next()¶
Returns the next segment in the model (or None if there is not one)
- Returns:
Segment object
- Return type:
Segment
Example
To get the next segment after segment s:
s = s.Next()
- Segment.Previous()¶
Returns the previous segment in the model (or None if there is not one)
- Returns:
Segment object
- Return type:
Segment
Example
To get the previous segment before segment s:
s = s.Previous()
- Segment.SetFlag(flag)¶
Sets a flag on a segment
- Parameters:
flag (Flag) – Flag (see
AllocateFlag
) to set on the segment- Returns:
No return value
- Return type:
None
Example
To set flag f on segment s:
s.SetFlag(f)
- Segment.Topology()¶
Returns the topology for the segment in the model
- Returns:
list of Node objects
- Return type:
list
Example
To get the topology for segment s:
topology = s.Topology()
- Segment.Unblank(window)¶
Unblanks the segment in a graphics window
- Parameters:
window (GraphicsWindow) –
GraphicsWindow
) to unblank the segment in- Returns:
No return value
- Return type:
None
Example
To unblank segment s in graphics window g:
s.Unblank(g)