Oasys.PRIMER.MorphFlow class

Properties

property MorphFlow.exists(read only): boolean

true if morph flow exists, false if referred to but not defined

property MorphFlow.include: integer

The Include file number that the morph flow is in

property MorphFlow.max: float

Maximum value for type set to “CONTINUOUS” or “STEP” when written as design variable for LS-OPT

property MorphFlow.min: float

Minimum value for type set to “CONTINUOUS” or “STEP” when written as design variable for LS-OPT

property MorphFlow.model(read only): integer

The Model number that the flow is in

property MorphFlow.name: string

Name of the morph flow. If the flow is used for applying LS-OPT variables, this should match the variable name in the listing file written by LS-OPT

property MorphFlow.npoints(read only): integer

Number of morph points referenced by the flow

property MorphFlow.nvals(read only): integer

Number of values in the list when type is set to “DISCRETE”

property MorphFlow.step: float

Step size for type set to “STEP” when written as design variable for LS-OPT

property MorphFlow.type: string

Range type for the morph flow. This should be “CONTINUOUS”, “STEP” or “DISCRETE” and may be used for LS-OPT when writing design variable files from morph flows

Constructor

classmethod MorphFlow(model, name)

Create a new MorphFlow object

Parameters:
  • model (Model) – Model that morph flow will be created in

  • name (string) – MorphFlow name

Returns:

MorphFlow object

Return type:

dict

Example

To create a new (empty) morph flow in model m with name ‘depth’

f = Oasys.PRIMER.MorphFlow(m, "depth")

Static methods

classmethod MorphFlow.BlankAll(model, redraw=Oasys.gRPC.defaultArg)

Blanks all of the flows in the model

Parameters:
  • model (Model) – Model that all flows will be blanked in

  • redraw (boolean) – Optional. If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw()

Returns:

No return value

Return type:

None

Example

To blank all of the flows in model m:

Oasys.PRIMER.MorphFlow.BlankAll(m)
classmethod MorphFlow.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Blanks all of the flagged flows in the model

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

  • flag (Flag) – Flag set on the flows that you want to blank

  • redraw (boolean) – Optional. If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw()

Returns:

No return value

Return type:

None

Example

To blank all of the flows in model m flagged with f:

Oasys.PRIMER.MorphFlow.BlankFlagged(m, f)
classmethod MorphFlow.Create(model, modal=Oasys.gRPC.defaultArg)

Starts an interactive editing panel to create a morph flow card

Parameters:
  • model (Model) – Model that the morph flow card will be created in

  • modal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal

Returns:

MorphFlow object (or None if not made)

Return type:

dict

Example

To start creating a morph flow card in model m:

f = Oasys.PRIMER.MorphFlow.Create(m)
classmethod MorphFlow.First(model)

Returns the first flow in the model

Parameters:

model (Model) – Model to get first flow in

Returns:

MorphFlow object (or None if there are no flows in the model)

Return type:

MorphFlow

Example

To get the first flow in model m:

flow = Oasys.PRIMER.MorphFlow.First(m)
classmethod MorphFlow.FlagAll(model, flag)

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

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

  • flag (Flag) – Flag to set on the flows

Returns:

No return value

Return type:

None

Example

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

Oasys.PRIMER.MorphFlow.FlagAll(m, f)
classmethod MorphFlow.GetAll(model)

Returns a list of MorphFlow objects for all of the flows in a model in PRIMER

Parameters:

model (Model) – Model to get flows from

Returns:

List of MorphFlow objects

Return type:

list

Example

To make a list of MorphFlow objects for all of the flows in model m

flow = Oasys.PRIMER.MorphFlow.GetAll(m)
classmethod MorphFlow.GetFlagged(model, flag)

Returns a list of MorphFlow objects for all of the flagged flows in a model in PRIMER

Parameters:
  • model (Model) – Model to get flows from

  • flag (Flag) – Flag set on the flows that you want to retrieve

Returns:

List of MorphFlow objects

Return type:

list

Example

To make a list of MorphFlow objects for all of the flows in model m flagged with f

flow = Oasys.PRIMER.MorphFlow.GetFlagged(m, f)
classmethod MorphFlow.GetFromID(model, number)

Returns the MorphFlow object for a flow ID

Parameters:
  • model (Model) – Model to find the flow in

  • number (integer) – number of the flow you want the MorphFlow object for

Returns:

MorphFlow object (or None if flow does not exist)

Return type:

MorphFlow

Example

To get the MorphFlow object for flow 100 in model m

flow = Oasys.PRIMER.MorphFlow.GetFromID(m, 100)
classmethod MorphFlow.GetFromName(model, morph_flow_name)

Returns the stored MorphFlow object for a morph flow name. WARNING: This assumes that there is at most one morph flow with a given name. Otherwise this function only returns the first occurrence

Parameters:
  • model (Model) – Model to find the morph flow in

  • morph_flow_name (string) – name of the morph flow you want the MorphFlow object for

Returns:

MorphFlow object (or None if morph flow does not exist)

Return type:

MorphFlow

Example

To get the MorphFlow object for flow “depth” in model m

f = Oasys.PRIMER.MorphFlow.GetFromName(m, "depth")
classmethod MorphFlow.Last(model)

Returns the last flow in the model

Parameters:

model (Model) – Model to get last flow in

Returns:

MorphFlow object (or None if there are no flows in the model)

Return type:

MorphFlow

Example

To get the last flow in model m:

flow = Oasys.PRIMER.MorphFlow.Last(m)
classmethod MorphFlow.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)

Allows the user to pick a flow

Parameters:
  • prompt (string) – Text to display as a prompt to the user

  • limit (Model or Flag) – Optional. If the argument is a Model then only flows from that model can be picked. If the argument is a Flag then only flows that are flagged with limit can be selected. If omitted, or None, any flows from any model can be selected. from any model

  • modal (boolean) – Optional. If picking is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the pick will be modal

  • button_text (string) – Optional. By default the window with the prompt will have a button labelled ‘Cancel’ which if pressed will cancel the pick and return None. If you want to change the text on the button use this argument. If omitted ‘Cancel’ will be used

Returns:

MorphFlow object (or None if not picked)

Return type:

dict

Example

To pick a flow from model m giving the prompt ‘Pick flow from screen’:

flow = Oasys.PRIMER.MorphFlow.Pick('Pick flow from screen', m)
classmethod MorphFlow.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select flows using standard PRIMER object menus

Parameters:
  • flag (Flag) – Flag to use when selecting flows

  • prompt (string) – Text to display as a prompt to the user

  • limit (Model or Flag) – Optional. If the argument is a Model then only flows from that model can be selected. If the argument is a Flag then only flows that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any flows can be selected. from any model

  • modal (boolean) – Optional. If selection is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the selection will be modal

Returns:

Number of flows selected or None if menu cancelled

Return type:

int

Example

To select flows from model m, flagging those selected with flag f, giving the prompt ‘Select flows’:

Oasys.PRIMER.MorphFlow.Select(f, 'Select flows', m)

To select flows, flagging those selected with flag f but limiting selection to flows flagged with flag l, giving the prompt ‘Select flows’:

Oasys.PRIMER.MorphFlow.Select(f, 'Select flows', l)
classmethod MorphFlow.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Sketches all of the flagged flows in the model. The flows will be sketched until you either call MorphFlow.Unsketch(), MorphFlow.UnsketchFlagged(), Model.UnsketchAll(), or delete the model

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

  • flag (Flag) – Flag set on the flows that you want to sketch

  • redraw (boolean) – Optional. If model should be redrawn or not after the flows are sketched. If omitted redraw is true. If you want to sketch flagged flows several times and only redraw after the last one then use false for redraw and call View.Redraw()

Returns:

No return value

Return type:

None

Example

To sketch all flows flagged with flag in model m:

Oasys.PRIMER.MorphFlow.SketchFlagged(m, flag)
classmethod MorphFlow.Total(model, exists=Oasys.gRPC.defaultArg)

Returns the total number of flows in the model

Parameters:
  • model (Model) – Model to get total for

  • exists (boolean) – Optional. true if only existing flows should be counted. If false or omitted referenced but undefined flows will also be included in the total

Returns:

number of flows

Return type:

int

Example

To get the total number of flows in model m:

total = Oasys.PRIMER.MorphFlow.Total(m)
classmethod MorphFlow.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the flows in the model

Parameters:
  • model (Model) – Model that all flows will be unblanked in

  • redraw (boolean) – Optional. If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw()

Returns:

No return value

Return type:

None

Example

To unblank all of the flows in model m:

Oasys.PRIMER.MorphFlow.UnblankAll(m)
classmethod MorphFlow.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the flagged flows in the model

Parameters:
  • model (Model) – Model that the flagged flows will be unblanked in

  • flag (Flag) – Flag set on the flows that you want to unblank

  • redraw (boolean) – Optional. If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw()

Returns:

No return value

Return type:

None

Example

To unblank all of the flows in model m flagged with f:

Oasys.PRIMER.MorphFlow.UnblankFlagged(m, f)
classmethod MorphFlow.UnflagAll(model, flag)

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

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

  • flag (Flag) – Flag to unset on the flows

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the flows in model m:

Oasys.PRIMER.MorphFlow.UnflagAll(m, f)
classmethod MorphFlow.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)

Unsketches all flows

Parameters:
  • model (Model) – Model that all flows will be unblanked in

  • redraw (boolean) – Optional. If model should be redrawn or not after the flows are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw()

Returns:

No return value

Return type:

None

Example

To unsketch all flows in model m:

Oasys.PRIMER.MorphFlow.UnsketchAll(m)
classmethod MorphFlow.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Unsketches all flagged flows in the model

Parameters:
  • model (Model) – Model that all flows will be unsketched in

  • flag (Flag) – Flag set on the flows that you want to unsketch

  • redraw (boolean) – Optional. If model should be redrawn or not after the flows are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw()

Returns:

No return value

Return type:

None

Example

To unsketch all flows flagged with flag in model m:

Oasys.PRIMER.MorphFlow.UnsketchAll(m, flag)

Instance methods

MorphFlow.AssociateComment(comment)

Associates a comment with a flow

Parameters:

comment (Comment) – Comment that will be attached to the flow

Returns:

No return value

Return type:

None

Example

To associate comment c to the flow flow:

flow.AssociateComment(c)
MorphFlow.Blank()

Blanks the flow

Returns:

No return value

Return type:

None

Example

To blank flow flow:

flow.Blank()
MorphFlow.Blanked()

Checks if the flow is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if flow flow is blanked:

if flow.Blanked():
    do_something..
MorphFlow.Browse(modal=Oasys.gRPC.defaultArg)

Starts an edit panel in Browse mode

Parameters:

modal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal

Returns:

no return value

Return type:

None

Example

To Browse flow flow:

flow.Browse()
MorphFlow.ClearFlag(flag)

Clears a flag on the flow

Parameters:

flag (Flag) – Flag to clear on the flow

Returns:

No return value

Return type:

None

Example

To clear flag f for flow flow:

flow.ClearFlag(f)
MorphFlow.Copy(range=Oasys.gRPC.defaultArg)

Copies the flow. The target include of the copied flow can be set using Options.copy_target_include

Parameters:

range (boolean) – Optional. If you want to keep the copied item in the range specified for the current include. Default value is false. To set current include, use Include.MakeCurrentLayer()

Returns:

MorphFlow object

Return type:

MorphFlow

Example

To copy flow flow into flow z:

z = flow.Copy()
MorphFlow.DetachComment(comment)

Detaches a comment from a flow

Parameters:

comment (Comment) – Comment that will be detached from the flow

Returns:

No return value

Return type:

None

Example

To detach comment c from the flow flow:

flow.DetachComment(c)
MorphFlow.Edit(modal=Oasys.gRPC.defaultArg)

Starts an interactive editing panel

Parameters:

modal (boolean) – Optional. If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal

Returns:

no return value

Return type:

None

Example

To Edit flow flow:

flow.Edit()
MorphFlow.Flagged(flag)

Checks if the flow is flagged or not

Parameters:

flag (Flag) – Flag to test on the flow

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if flow flow has flag f set on it:

if flow.Flagged(f):
    do_something..
MorphFlow.GetComments()

Extracts the comments associated to a flow

Returns:

List of Comment objects (or None if there are no comments associated to the node)

Return type:

list

Example

To get the list of comments associated to the flow flow:

comm_list = flow.GetComments()
MorphFlow.GetParameter(prop)

Checks if a MorphFlow property is a parameter or not. Note that object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. For this function to work the JavaScript interpreter must use the parameter name instead of the value. This can be done by setting the Options.property_parameter_names option to true before calling the function and then resetting it to false afterwards.. This behaviour can also temporarily be switched by using the MorphFlow.ViewParameters() method and ‘method chaining’ (see the examples below)

Parameters:

prop (string) – flow property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if MorphFlow property flow.example is a parameter:

Oasys.PRIMER.Options.property_parameter_names = True
if flow.GetParameter(flow.example):
    do_something...
Oasys.PRIMER.Options.property_parameter_names = False

To check if MorphFlow property flow.example is a parameter by using the GetParameter method:

if flow.ViewParameters().GetParameter(flow.example):
    do_something..
MorphFlow.GetRow(row)

Returns the data for a row in the morph flow

Parameters:

row (integer) – The row you want the data for. Note row indices start at 0

Returns:

A list of numbers containing the morph point ID at index 0 and the vector components at indices 1, 2, 3

Return type:

list

Example

To get the data for the 2nd row in morph flow f:

data = f.GetRow(1)
point_id = data[0]
dx = data[1]
dy = data[2]
dz = data[3]
MorphFlow.GetValue(index)

Get the value at given index on the morph flow with type “DISCRETE”

Parameters:

index (integer) – The index where you are extracting the value. Note row indices start at 0

Returns:

float

Return type:

float

Example

To get the 2nd value for morph flow f with type “DISCRETE”:

value = f.GetValue(1)

To get the last value on the list of values on f:

value = f.GetValue(f.nvals - 1)
MorphFlow.Keyword()

Returns the keyword for this morph flow (*MORPH_FLOW). Note that a carriage return is not added. See also MorphFlow.KeywordCards()

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for morph flow f:

key = f.Keyword()
MorphFlow.KeywordCards()

Returns the keyword cards for the morph flow. Note that a carriage return is not added. See also MorphFlow.Keyword()

Returns:

string containing the cards

Return type:

str

Example

To get the cards for morph flow f:

cards = f.KeywordCards()
MorphFlow.Next()

Returns the next flow in the model

Returns:

MorphFlow object (or None if there are no more flows in the model)

Return type:

MorphFlow

Example

To get the flow in model m after flow flow:

flow = flow.Next()
MorphFlow.Previous()

Returns the previous flow in the model

Returns:

MorphFlow object (or None if there are no more flows in the model)

Return type:

MorphFlow

Example

To get the flow in model m before flow flow:

flow = flow.Previous()
MorphFlow.RemoveRow(row)

Removes the data (a morph point ID and its three vector components) for a row in *MORPH_FLOW

Parameters:

row (integer) – The row you want to remove the data for. Note that row indices start at 0

Returns:

No return value

Return type:

None

Example

To remove the second row of data for morph flow f:

f.RemoveRow(1)
MorphFlow.RemoveValue(index)

Removes the value at given index in *MORPH_FLOW with type “DISCRETE”

Parameters:

index (integer) – The index where you are removing the value. Note that indices start at 0

Returns:

No return value

Return type:

None

Example

To remove the second value for morph flow f:

f.RemoveValue(1)

To remove the last value for f:

f.RemoveValue(f.nvals - 1)
MorphFlow.SetFlag(flag)

Sets a flag on the flow

Parameters:

flag (Flag) – Flag to set on the flow

Returns:

No return value

Return type:

None

Example

To set flag f for flow flow:

flow.SetFlag(f)
MorphFlow.SetRow(row, data)

Sets the data for a row in *MORPH_FLOW

Parameters:
  • row (integer) – The row you want to set the data for. Note that row indices start at 0

  • data (List of data) – The data you want to set the row to. It should be of length 4 having the morph point ID at index 0, and the vector components at indices 1, 2, 3

Returns:

No return value

Return type:

None

Example

To set the second point of the morph flow f to be morph point 11 with unit vector in X-direction:

list = [11, 1.0, 0.0, 0.0]
f.SetRow(1, array)

To append a new row of data (using the same list of values):

f.SetRow(f.npoints, list)
MorphFlow.SetValue(index, value)

Sets the value at given index in a *MORPH_FLOW with type “DISCRETE”

Parameters:
  • index (integer) – The row you want to set the data for. Note that row indices start at 0

  • value (real) – The new value to insert into the list

Returns:

No return value

Return type:

None

Example

To set the second value morph flow f to 20.0:

f.SetValue(1, 20.0)

To append the value 20.0 to the end of the list:

f.SetValue(f.nvals, 20.0)
MorphFlow.Sketch(redraw=Oasys.gRPC.defaultArg)

Sketches the flow. The flow will be sketched until you either call MorphFlow.Unsketch(), MorphFlow.UnsketchAll(), Model.UnsketchAll(), or delete the model

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the flow is sketched. If omitted redraw is true. If you want to sketch several flows and only redraw after the last one then use false for redraw and call View.Redraw()

Returns:

No return value

Return type:

None

Example

To sketch flow flow:

flow.Sketch()
MorphFlow.Unblank()

Unblanks the flow

Returns:

No return value

Return type:

None

Example

To unblank flow flow:

flow.Unblank()
MorphFlow.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the flow

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the flow is unsketched. If omitted redraw is true. If you want to unsketch several flows and only redraw after the last one then use false for redraw and call View.Redraw()

Returns:

No return value

Return type:

None

Example

To unsketch flow flow:

flow.Unsketch()
MorphFlow.ViewParameters()

Object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. This function temporarily changes the behaviour so that if a property is a parameter the parameter name is returned instead. This can be used with ‘method chaining’ (see the example below) to make sure a property argument is correct

Returns:

MorphFlow object

Return type:

dict

Example

To check if MorphFlow property flow.example is a parameter by using the MorphFlow.GetParameter() method:

if flow.ViewParameters().GetParameter(flow.example):
    do_something..
MorphFlow.Xrefs()

Returns the cross references for this flow

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for flow flow:

xrefs = flow.Xrefs()