Oasys.PRIMER.Transformation class¶
Properties¶
- property Transformation.exists(read only): boolean¶
true if transformation exists, false if referred to but not defined
- property Transformation.label: integer¶
Transformation
number. Also see thetranid
property which is an alternative name for this
- property Transformation.nrow(read only): integer¶
Number of rows of transformations
- property Transformation.title: string¶
The title for the transformation
- property Transformation.tranid: integer¶
Transformation
number. Also see thelabel
property which is an alternative name for this
Constructor¶
- classmethod Transformation(model, tranid, title=Oasys.gRPC.defaultArg)¶
Create a new
Transformation
object
- Parameters:
model (Model) –
Model
that transformation will be created intranid (integer) –
Transformation
labeltitle (string) – Optional.
Transformation
title- Returns:
Transformation object
- Return type:
dict
Example
To create a new transformation in model m with label 1000 and title “Example transform”
t = Oasys.PRIMER.Transformation(m, 1000, "Example transform")
Static methods¶
- classmethod Transformation.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a define transformation definition
- Parameters:
model (Model) –
Model
that the transformation will be created inmodal (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:
Transformation object (or None if not made)
- Return type:
dict
Example
To start creating a define transformation definition in model m:
t = Oasys.PRIMER.Transformation.Create(m)
- classmethod Transformation.First(model)¶
Returns the first transformation in the model
- Parameters:
model (Model) –
Model
to get first transformation in- Returns:
Transformation object (or None if there are no transformations in the model)
- Return type:
Transformation
Example
To get the first transformation in model m:
t = Oasys.PRIMER.Transformation.First(m)
- classmethod Transformation.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free transformation label in the model. Also see
Transformation.LastFreeLabel()
,Transformation.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Transformation label
- Return type:
int
Example
To get the first free transformation label in model m:
label = Oasys.PRIMER.Transformation.FirstFreeLabel(m)
- classmethod Transformation.FlagAll(model, flag)¶
Flags all of the transformations in the model with a defined flag
- Parameters:
model (Model) –
Model
that all transformations will be flagged inflag (Flag) – Flag to set on the transformations
- Returns:
No return value
- Return type:
None
Example
To flag all of the transformations with flag f in model m:
Oasys.PRIMER.Transformation.FlagAll(m, f)
- classmethod Transformation.GetAll(model)¶
Returns a list of Transformation objects for all of the transformations in a model in PRIMER
- Parameters:
model (Model) –
Model
to get transformations from- Returns:
List of Transformation objects
- Return type:
list
Example
To make a list of Transformation objects for all of the transformations in model m
t = Oasys.PRIMER.Transformation.GetAll(m)
- classmethod Transformation.GetFlagged(model, flag)¶
Returns a list of Transformation objects for all of the flagged transformations in a model in PRIMER
- Parameters:
model (Model) –
Model
to get transformations fromflag (Flag) – Flag set on the transformations that you want to retrieve
- Returns:
List of Transformation objects
- Return type:
list
Example
To make a list of Transformation objects for all of the transformations in model m flagged with f
t = Oasys.PRIMER.Transformation.GetFlagged(m, f)
- classmethod Transformation.GetFromID(model, number)¶
Returns the Transformation object for a transformation ID
- Parameters:
model (Model) –
Model
to find the transformation innumber (integer) – number of the transformation you want the Transformation object for
- Returns:
Transformation object (or None if transformation does not exist)
- Return type:
Transformation
Example
To get the Transformation object for transformation 100 in model m
t = Oasys.PRIMER.Transformation.GetFromID(m, 100)
- classmethod Transformation.Last(model)¶
Returns the last transformation in the model
- Parameters:
model (Model) –
Model
to get last transformation in- Returns:
Transformation object (or None if there are no transformations in the model)
- Return type:
Transformation
Example
To get the last transformation in model m:
t = Oasys.PRIMER.Transformation.Last(m)
- classmethod Transformation.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free transformation label in the model. Also see
Transformation.FirstFreeLabel()
,Transformation.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Transformation label
- Return type:
int
Example
To get the last free transformation label in model m:
label = Oasys.PRIMER.Transformation.LastFreeLabel(m)
- classmethod Transformation.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) transformation label in the model. Also see
Transformation.FirstFreeLabel()
,Transformation.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Transformation label
- Return type:
int
Example
To get the next free transformation label in model m:
label = Oasys.PRIMER.Transformation.NextFreeLabel(m)
- classmethod Transformation.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select transformations using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting transformations
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only transformations from that model can be selected. If the argument is aFlag
then only transformations that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any transformations can be selected. from any modelmodal (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 transformations selected or None if menu cancelled
- Return type:
int
Example
To select transformations from model m, flagging those selected with flag f, giving the prompt ‘Select transformations’:
Oasys.PRIMER.Transformation.Select(f, 'Select transformations', m)To select transformations, flagging those selected with flag f but limiting selection to transformations flagged with flag l, giving the prompt ‘Select transformations’:
Oasys.PRIMER.Transformation.Select(f, 'Select transformations', l)
- classmethod Transformation.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of transformations in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing transformations should be counted. If false or omitted referenced but undefined transformations will also be included in the total
- Returns:
number of transformations
- Return type:
int
Example
To get the total number of transformations in model m:
total = Oasys.PRIMER.Transformation.Total(m)
- classmethod Transformation.UnflagAll(model, flag)¶
Unsets a defined flag on all of the transformations in the model
- Parameters:
model (Model) –
Model
that the defined flag for all transformations will be unset inflag (Flag) – Flag to unset on the transformations
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the transformations in model m:
Oasys.PRIMER.Transformation.UnflagAll(m, f)
Instance methods¶
- Transformation.AddRow(data, row=Oasys.gRPC.defaultArg)¶
Adds a row of data for a *DEFINE_TRANSFORMATION
- Parameters:
data (List of data) – The data you want to add
row (integer) – Optional. The row you want to add the data at. Existing transforms will be shifted. If omitted the data will be added to the end of the existing transforms. Note that row indices start at 0
- Returns:
No return value
- Return type:
None
Example
To add a translation of (0, 0, 100) to transformation t:
list = ["TRANSL", 0, 0, 100] t.AddRow(array)
- Transformation.AssociateComment(comment)¶
Associates a comment with a transformation
- Parameters:
comment (Comment) –
Comment
that will be attached to the transformation- Returns:
No return value
- Return type:
None
Example
To associate comment c to the transformation t:
t.AssociateComment(c)
- Transformation.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 transformation t:
t.Browse()
- Transformation.ClearFlag(flag)¶
Clears a flag on the transformation
- Parameters:
flag (Flag) – Flag to clear on the transformation
- Returns:
No return value
- Return type:
None
Example
To clear flag f for transformation t:
t.ClearFlag(f)
- Transformation.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the transformation. The target include of the copied transformation 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:
Transformation object
- Return type:
Transformation
Example
To copy transformation t into transformation z:
z = t.Copy()
- Transformation.DetachComment(comment)¶
Detaches a comment from a transformation
- Parameters:
comment (Comment) –
Comment
that will be detached from the transformation- Returns:
No return value
- Return type:
None
Example
To detach comment c from the transformation t:
t.DetachComment(c)
- Transformation.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 transformation t:
t.Edit()
- Transformation.Flagged(flag)¶
Checks if the transformation is flagged or not
- Parameters:
flag (Flag) – Flag to test on the transformation
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if transformation t has flag f set on it:
if t.Flagged(f): do_something..
- Transformation.GetComments()¶
Extracts the comments associated to a transformation
- 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 transformation t:
comm_list = t.GetComments()
- Transformation.GetParameter(prop)¶
Checks if a Transformation 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 theTransformation.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – transformation property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Transformation property t.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if t.GetParameter(t.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Transformation property t.example is a parameter by using the GetParameter method:
if t.ViewParameters().GetParameter(t.example): do_something..
- Transformation.GetRow(row)¶
Returns the data for a row in the transformation
- Parameters:
row (integer) – The row you want the data for. Note row indices start at 0
- Returns:
A list of numbers containing the row variables
- Return type:
list
Example
To get the data for the 2nd row in transformation t:
data = t.GetRow(1)
- Transformation.Keyword()¶
Returns the keyword for this transformation. Note that a carriage return is not added. See also
Transformation.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for transformation t:
key = t.Keyword()
- Transformation.KeywordCards()¶
Returns the keyword cards for the transformation. Note that a carriage return is not added. See also
Transformation.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for transformation i:
cards = i.KeywordCards()
- Transformation.Next()¶
Returns the next transformation in the model
- Returns:
Transformation object (or None if there are no more transformations in the model)
- Return type:
Transformation
Example
To get the transformation in model m after transformation t:
t = t.Next()
- Transformation.Previous()¶
Returns the previous transformation in the model
- Returns:
Transformation object (or None if there are no more transformations in the model)
- Return type:
Transformation
Example
To get the transformation in model m before transformation t:
t = t.Previous()
- Transformation.RemoveRow(row)¶
Removes the data for a row in *DEFINE_TRANSFORMATION
- 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 transformation t:
t.RemoveRow(1)
- Transformation.SetFlag(flag)¶
Sets a flag on the transformation
- Parameters:
flag (Flag) – Flag to set on the transformation
- Returns:
No return value
- Return type:
None
Example
To set flag f for transformation t:
t.SetFlag(f)
- Transformation.SetRow(row, data)¶
Sets the data for a row in *DEFINE_TRANSFORMATION
- 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
- Returns:
No return value
- Return type:
None
Example
To set the second row of data for transformation t to be a translation of (0, 0, 100):
list = ["TRANSL", 0, 0, 100] t.SetRow(1, array)
- Transformation.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:
Transformation object
- Return type:
dict
Example
To check if Transformation property t.example is a parameter by using the
Transformation.GetParameter()
method:if t.ViewParameters().GetParameter(t.example): do_something..
- Transformation.Xrefs()¶
Returns the cross references for this transformation
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for transformation t:
xrefs = t.Xrefs()