Oasys.PRIMER.Spr2 class¶
Constants¶
Flags for Interpolation¶
Properties¶
- property Spr2.alpha1: float¶
Dimensionless parameter scaling the effective displacement
- property Spr2.alpha2: float¶
Dimensionless parameter scaling the effective displacement
- property Spr2.alpha3: float¶
Dimensionless parameter scaling the effective displacement. ( GT.0: incremental update (default), LT.0: total update (recommended) )
- property Spr2.d: float¶
Rivet diameter
- property Spr2.dens: float¶
Rivet density (necessary for time step calculation)
- property Spr2.dn: float¶
Failure displacement in normal direction
- property Spr2.dt: float¶
Failure displacement in tangential direction
- property Spr2.exists(read only): boolean¶
true if constrained spr2 exists, false if referred to but not defined
- property Spr2.expn: float¶
Exponent value for load function in normal direction
- property Spr2.expt: float¶
Exponent value for load function in tangential direction
- property Spr2.fn: float¶
Rivet strength in tension (pull-out) or (if -ve) label for UPID
- property Spr2.ft: float¶
Rivet strength in pure shear
- property Spr2.intp: float¶
Flag for interpolation. Values can be
Spr2.LINEAR
,Spr2.UNIFORM
orSpr2.INVERSE
- property Spr2.pidvb: integer¶
Part ID for visualization beams representing SPR2 in postprocessing
- property Spr2.thick: float¶
Total thickness of master and slave sheet
- property Spr2.xin: float¶
Fraction of failure displacement at maximum normal force
- property Spr2.xit: float¶
Fraction of failure displacement at maximum tangential force
Constructor¶
Static methods¶
- classmethod Spr2.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the spr2s in the model
- Parameters:
model (Model) –
Model
that all spr2s will be blanked inredraw (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 spr2s in model m:
Oasys.PRIMER.Spr2.BlankAll(m)
- classmethod Spr2.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged spr2s in the model
- Parameters:
model (Model) –
Model
that all the flagged spr2s will be blanked inflag (Flag) – Flag set on the spr2s 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 spr2s in model m flagged with f:
Oasys.PRIMER.Spr2.BlankFlagged(m, f)
- classmethod Spr2.First(model)¶
Returns the first spr2 in the model
- Parameters:
model (Model) –
Model
to get first spr2 in- Returns:
Spr2 object (or None if there are no spr2s in the model)
- Return type:
Spr2
Example
To get the first spr2 in model m:
s = Oasys.PRIMER.Spr2.First(m)
- classmethod Spr2.FlagAll(model, flag)¶
Flags all of the spr2s in the model with a defined flag
- Parameters:
model (Model) –
Model
that all spr2s will be flagged inflag (Flag) – Flag to set on the spr2s
- Returns:
No return value
- Return type:
None
Example
To flag all of the spr2s with flag f in model m:
Oasys.PRIMER.Spr2.FlagAll(m, f)
- classmethod Spr2.GetAll(model)¶
Returns a list of Spr2 objects for all of the spr2s in a model in PRIMER
- Parameters:
model (Model) –
Model
to get spr2s from- Returns:
List of Spr2 objects
- Return type:
list
Example
To make a list of Spr2 objects for all of the spr2s in model m
s = Oasys.PRIMER.Spr2.GetAll(m)
- classmethod Spr2.GetFlagged(model, flag)¶
Returns a list of Spr2 objects for all of the flagged spr2s in a model in PRIMER
- Parameters:
model (Model) –
Model
to get spr2s fromflag (Flag) – Flag set on the spr2s that you want to retrieve
- Returns:
List of Spr2 objects
- Return type:
list
Example
To make a list of Spr2 objects for all of the spr2s in model m flagged with f
s = Oasys.PRIMER.Spr2.GetFlagged(m, f)
- classmethod Spr2.GetFromID(model, number)¶
Returns the Spr2 object for a spr2 ID
- Parameters:
model (Model) –
Model
to find the spr2 innumber (integer) – number of the spr2 you want the Spr2 object for
- Returns:
Spr2 object (or None if spr2 does not exist)
- Return type:
Spr2
Example
To get the Spr2 object for spr2 100 in model m
s = Oasys.PRIMER.Spr2.GetFromID(m, 100)
- classmethod Spr2.Last(model)¶
Returns the last spr2 in the model
- Parameters:
model (Model) –
Model
to get last spr2 in- Returns:
Spr2 object (or None if there are no spr2s in the model)
- Return type:
Spr2
Example
To get the last spr2 in model m:
s = Oasys.PRIMER.Spr2.Last(m)
- classmethod Spr2.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a spr2
- 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 spr2s from that model can be picked. If the argument is aFlag
then only spr2s that are flagged with limit can be selected. If omitted, or None, any spr2s from any model can be selected. from any modelmodal (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:
Spr2 object (or None if not picked)
- Return type:
dict
Example
To pick a spr2 from model m giving the prompt ‘Pick spr2 from screen’:
s = Oasys.PRIMER.Spr2.Pick('Pick spr2 from screen', m)
- classmethod Spr2.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select spr2s using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting spr2s
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only spr2s from that model can be selected. If the argument is aFlag
then only spr2s that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any spr2s 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 spr2s selected or None if menu cancelled
- Return type:
int
Example
To select spr2s from model m, flagging those selected with flag f, giving the prompt ‘Select spr2s’:
Oasys.PRIMER.Spr2.Select(f, 'Select spr2s', m)To select spr2s, flagging those selected with flag f but limiting selection to spr2s flagged with flag l, giving the prompt ‘Select spr2s’:
Oasys.PRIMER.Spr2.Select(f, 'Select spr2s', l)
- classmethod Spr2.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged spr2s in the model. The spr2s will be sketched until you either call
Spr2.Unsketch()
,Spr2.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged spr2s will be sketched inflag (Flag) – Flag set on the spr2s that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the spr2s are sketched. If omitted redraw is true. If you want to sketch flagged spr2s 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 spr2s flagged with flag in model m:
Oasys.PRIMER.Spr2.SketchFlagged(m, flag)
- classmethod Spr2.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of spr2s in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing spr2s should be counted. If false or omitted referenced but undefined spr2s will also be included in the total
- Returns:
number of spr2s
- Return type:
int
Example
To get the total number of spr2s in model m:
total = Oasys.PRIMER.Spr2.Total(m)
- classmethod Spr2.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the spr2s in the model
- Parameters:
model (Model) –
Model
that all spr2s will be unblanked inredraw (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 spr2s in model m:
Oasys.PRIMER.Spr2.UnblankAll(m)
- classmethod Spr2.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged spr2s in the model
- Parameters:
model (Model) –
Model
that the flagged spr2s will be unblanked inflag (Flag) – Flag set on the spr2s 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 spr2s in model m flagged with f:
Oasys.PRIMER.Spr2.UnblankFlagged(m, f)
- classmethod Spr2.UnflagAll(model, flag)¶
Unsets a defined flag on all of the spr2s in the model
- Parameters:
model (Model) –
Model
that the defined flag for all spr2s will be unset inflag (Flag) – Flag to unset on the spr2s
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the spr2s in model m:
Oasys.PRIMER.Spr2.UnflagAll(m, f)
- classmethod Spr2.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all spr2s
- Parameters:
model (Model) –
Model
that all spr2s will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the spr2s 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 spr2s in model m:
Oasys.PRIMER.Spr2.UnsketchAll(m)
- classmethod Spr2.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged spr2s in the model
- Parameters:
model (Model) –
Model
that all spr2s will be unsketched inflag (Flag) – Flag set on the spr2s that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the spr2s 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 spr2s flagged with flag in model m:
Oasys.PRIMER.Spr2.UnsketchAll(m, flag)
Instance methods¶
- Spr2.AssociateComment(comment)¶
Associates a comment with a spr2
- Parameters:
comment (Comment) –
Comment
that will be attached to the spr2- Returns:
No return value
- Return type:
None
Example
To associate comment c to the spr2 s:
s.AssociateComment(c)
- Spr2.Blank()¶
Blanks the spr2
- Returns:
No return value
- Return type:
None
Example
To blank spr2 s:
s.Blank()
- Spr2.Blanked()¶
Checks if the spr2 is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if spr2 s is blanked:
if s.Blanked(): do_something..
- Spr2.ClearFlag(flag)¶
Clears a flag on the spr2
- Parameters:
flag (Flag) – Flag to clear on the spr2
- Returns:
No return value
- Return type:
None
Example
To clear flag f for spr2 s:
s.ClearFlag(f)
- Spr2.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the spr2. The target include of the copied spr2 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:
Spr2 object
- Return type:
Spr2
Example
To copy spr2 s into spr2 z:
z = s.Copy()
- Spr2.DetachComment(comment)¶
Detaches a comment from a spr2
- Parameters:
comment (Comment) –
Comment
that will be detached from the spr2- Returns:
No return value
- Return type:
None
Example
To detach comment c from the spr2 s:
s.DetachComment(c)
- Spr2.Flagged(flag)¶
Checks if the spr2 is flagged or not
- Parameters:
flag (Flag) – Flag to test on the spr2
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if spr2 s has flag f set on it:
if s.Flagged(f): do_something..
- Spr2.GetComments()¶
Extracts the comments associated to a spr2
- 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 spr2 s:
comm_list = s.GetComments()
- Spr2.GetParameter(prop)¶
Checks if a Spr2 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 theSpr2.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – spr2 property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Spr2 property s.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if s.GetParameter(s.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Spr2 property s.example is a parameter by using the GetParameter method:
if s.ViewParameters().GetParameter(s.example): do_something..
- Spr2.Keyword()¶
Returns the keyword for this spr2 (*CONSTRAINED_SPR2). Note that a carriage return is not added. See also
Spr2.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for spr2 s:
key = s.Keyword()
- Spr2.KeywordCards()¶
Returns the keyword cards for the spr2. Note that a carriage return is not added. See also
Spr2.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for spr2 s:
cards = s.KeywordCards()
- Spr2.Next()¶
Returns the next spr2 in the model
- Returns:
Spr2 object (or None if there are no more spr2s in the model)
- Return type:
Spr2
Example
To get the spr2 in model m after spr2 s:
s = s.Next()
- Spr2.Previous()¶
Returns the previous spr2 in the model
- Returns:
Spr2 object (or None if there are no more spr2s in the model)
- Return type:
Spr2
Example
To get the spr2 in model m before spr2 s:
s = s.Previous()
- Spr2.SetFlag(flag)¶
Sets a flag on the spr2
- Parameters:
flag (Flag) – Flag to set on the spr2
- Returns:
No return value
- Return type:
None
Example
To set flag f for spr2 s:
s.SetFlag(f)
- Spr2.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the spr2. The spr2 will be sketched until you either call
Spr2.Unsketch()
,Spr2.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the spr2 is sketched. If omitted redraw is true. If you want to sketch several spr2s 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 spr2 s:
s.Sketch()
- Spr2.Unblank()¶
Unblanks the spr2
- Returns:
No return value
- Return type:
None
Example
To unblank spr2 s:
s.Unblank()
- Spr2.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the spr2
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the spr2 is unsketched. If omitted redraw is true. If you want to unsketch several spr2s 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 spr2 s:
s.Unsketch()
- Spr2.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:
Spr2 object
- Return type:
dict
Example
To check if Spr2 property s.example is a parameter by using the
Spr2.GetParameter()
method:if s.ViewParameters().GetParameter(s.example): do_something..
- Spr2.Xrefs()¶
Returns the cross references for this spr2
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for spr2 s:
xrefs = s.Xrefs()