Oasys.PRIMER.Retractor class¶
Properties¶
- property Retractor.colour: Colour¶
The colour of the retractor
- property Retractor.exists(read only): boolean¶
true if retractor exists, false if referred to but not defined
- property Retractor.label: integer¶
Retractor
number. Also see thesbrid
property which is an alternative name for this
- property Retractor.lfed: float¶
Fed length
- property Retractor.nsbi: integer¶
Number of elements inside the retractor
- property Retractor.pull: float¶
Amount of pull out between time delay ending and retractor locking
- property Retractor.sbid: integer¶
Seatbelt1D
number (orSet Shell
number ifsbrnid
is negative)
- property Retractor.sbrid: integer¶
Retractor
number. Also see thelabel
property which is an alternative name for this
- property Retractor.shell_seatbelt(read only): boolean¶
true if retractor is used for shell (2D) seatbelt elements
- property Retractor.tdel: float¶
Time delay after sensor triggers
- property Retractor.transparency: integer¶
The transparency of the retractor (0-100) 0% is opaque, 100% is transparent
Constructor¶
- classmethod Retractor(model, sbrid, sbrnid, sbid, llcid, sid1, sid2=Oasys.gRPC.defaultArg, sid3=Oasys.gRPC.defaultArg, sid4=Oasys.gRPC.defaultArg, tdel=Oasys.gRPC.defaultArg, pull=Oasys.gRPC.defaultArg, ulcid=Oasys.gRPC.defaultArg, lfed=Oasys.gRPC.defaultArg)¶
Create a new
Seatbelt Retractor
object
- Parameters:
model (Model) –
Model
that retractor will be created insbrid (integer) –
Retractor
numbersbrnid (integer) –
Node
number (orSet Node
number if negative)sbid (integer) –
Seatbelt
number. (orSet Shell
number ifsbrnid
is negative)llcid (integer) –
Loadcurve
for loading (pull-out vs force)sid1 (integer) –
Sensor
number 1sid2 (integer) – Optional.
Sensor
number 2sid3 (integer) – Optional.
Sensor
number 3sid4 (integer) – Optional.
Sensor
number 4tdel (float) – Optional. Time delay after sensor triggers
pull (float) – Optional. Amount of pull out between time delay ending and retractor locking
ulcid (integer) – Optional.
Loadcurve
for unloading (pull-out vs force)lfed (float) – Optional. Fed length
- Returns:
Retractor object
- Return type:
dict
Example
To create a new seatbelt retractor in model m with label 100, retractor
Node
10, :py:class:` Seatbelt <Seatbelt1D>` 20, :py:class:` Loading curve <Curve>` 30 andSensor
40:a = Oasys.PRIMER.Retractor(m, 100, 10, 20, 30, 40)
Static methods¶
- classmethod Retractor.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the retractors in the model
- Parameters:
model (Model) –
Model
that all retractors 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 retractors in model m:
Oasys.PRIMER.Retractor.BlankAll(m)
- classmethod Retractor.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged retractors in the model
- Parameters:
model (Model) –
Model
that all the flagged retractors will be blanked inflag (Flag) – Flag set on the retractors 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 retractors in model m flagged with f:
Oasys.PRIMER.Retractor.BlankFlagged(m, f)
- classmethod Retractor.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a retractor
- Parameters:
model (Model) –
Model
that the retractor 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:
Retractor object (or None if not made)
- Return type:
dict
Example
To start creating an retractor in model m:
r = Oasys.PRIMER.Retractor.Create(m)
- classmethod Retractor.First(model)¶
Returns the first retractor in the model
- Parameters:
model (Model) –
Model
to get first retractor in- Returns:
Retractor object (or None if there are no retractors in the model)
- Return type:
Retractor
Example
To get the first retractor in model m:
r = Oasys.PRIMER.Retractor.First(m)
- classmethod Retractor.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free retractor label in the model. Also see
Retractor.LastFreeLabel()
,Retractor.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Retractor label
- Return type:
int
Example
To get the first free retractor label in model m:
label = Oasys.PRIMER.Retractor.FirstFreeLabel(m)
- classmethod Retractor.FlagAll(model, flag)¶
Flags all of the retractors in the model with a defined flag
- Parameters:
model (Model) –
Model
that all retractors will be flagged inflag (Flag) – Flag to set on the retractors
- Returns:
No return value
- Return type:
None
Example
To flag all of the retractors with flag f in model m:
Oasys.PRIMER.Retractor.FlagAll(m, f)
- classmethod Retractor.GetAll(model)¶
Returns a list of Retractor objects for all of the retractors in a model in PRIMER
- Parameters:
model (Model) –
Model
to get retractors from- Returns:
List of Retractor objects
- Return type:
list
Example
To make a list of Retractor objects for all of the retractors in model m
r = Oasys.PRIMER.Retractor.GetAll(m)
- classmethod Retractor.GetFlagged(model, flag)¶
Returns a list of Retractor objects for all of the flagged retractors in a model in PRIMER
- Parameters:
model (Model) –
Model
to get retractors fromflag (Flag) – Flag set on the retractors that you want to retrieve
- Returns:
List of Retractor objects
- Return type:
list
Example
To make a list of Retractor objects for all of the retractors in model m flagged with f
r = Oasys.PRIMER.Retractor.GetFlagged(m, f)
- classmethod Retractor.GetFromID(model, number)¶
Returns the Retractor object for a retractor ID
- Parameters:
model (Model) –
Model
to find the retractor innumber (integer) – number of the retractor you want the Retractor object for
- Returns:
Retractor object (or None if retractor does not exist)
- Return type:
Retractor
Example
To get the Retractor object for retractor 100 in model m
r = Oasys.PRIMER.Retractor.GetFromID(m, 100)
- classmethod Retractor.Last(model)¶
Returns the last retractor in the model
- Parameters:
model (Model) –
Model
to get last retractor in- Returns:
Retractor object (or None if there are no retractors in the model)
- Return type:
Retractor
Example
To get the last retractor in model m:
r = Oasys.PRIMER.Retractor.Last(m)
- classmethod Retractor.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free retractor label in the model. Also see
Retractor.FirstFreeLabel()
,Retractor.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Retractor label
- Return type:
int
Example
To get the last free retractor label in model m:
label = Oasys.PRIMER.Retractor.LastFreeLabel(m)
- classmethod Retractor.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) retractor label in the model. Also see
Retractor.FirstFreeLabel()
,Retractor.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Retractor label
- Return type:
int
Example
To get the next free retractor label in model m:
label = Oasys.PRIMER.Retractor.NextFreeLabel(m)
- classmethod Retractor.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a retractor
- 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 retractors from that model can be picked. If the argument is aFlag
then only retractors that are flagged with limit can be selected. If omitted, or None, any retractors 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:
Retractor object (or None if not picked)
- Return type:
dict
Example
To pick a retractor from model m giving the prompt ‘Pick retractor from screen’:
r = Oasys.PRIMER.Retractor.Pick('Pick retractor from screen', m)
- classmethod Retractor.RenumberAll(model, start)¶
Renumbers all of the retractors in the model
- Parameters:
model (Model) –
Model
that all retractors will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the retractors in model m, from 1000000:
Oasys.PRIMER.Retractor.RenumberAll(m, 1000000)
- classmethod Retractor.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged retractors in the model
- Parameters:
model (Model) –
Model
that all the flagged retractors will be renumbered inflag (Flag) – Flag set on the retractors that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the retractors in model m flagged with f, from 1000000:
Oasys.PRIMER.Retractor.RenumberFlagged(m, f, 1000000)
- classmethod Retractor.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select retractors using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting retractors
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only retractors from that model can be selected. If the argument is aFlag
then only retractors that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any retractors 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 retractors selected or None if menu cancelled
- Return type:
int
Example
To select retractors from model m, flagging those selected with flag f, giving the prompt ‘Select retractors’:
Oasys.PRIMER.Retractor.Select(f, 'Select retractors', m)To select retractors, flagging those selected with flag f but limiting selection to retractors flagged with flag l, giving the prompt ‘Select retractors’:
Oasys.PRIMER.Retractor.Select(f, 'Select retractors', l)
- classmethod Retractor.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged retractors in the model. The retractors will be sketched until you either call
Retractor.Unsketch()
,Retractor.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged retractors will be sketched inflag (Flag) – Flag set on the retractors that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the retractors are sketched. If omitted redraw is true. If you want to sketch flagged retractors 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 retractors flagged with flag in model m:
Oasys.PRIMER.Retractor.SketchFlagged(m, flag)
- classmethod Retractor.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of retractors in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing retractors should be counted. If false or omitted referenced but undefined retractors will also be included in the total
- Returns:
number of retractors
- Return type:
int
Example
To get the total number of retractors in model m:
total = Oasys.PRIMER.Retractor.Total(m)
- classmethod Retractor.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the retractors in the model
- Parameters:
model (Model) –
Model
that all retractors 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 retractors in model m:
Oasys.PRIMER.Retractor.UnblankAll(m)
- classmethod Retractor.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged retractors in the model
- Parameters:
model (Model) –
Model
that the flagged retractors will be unblanked inflag (Flag) – Flag set on the retractors 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 retractors in model m flagged with f:
Oasys.PRIMER.Retractor.UnblankFlagged(m, f)
- classmethod Retractor.UnflagAll(model, flag)¶
Unsets a defined flag on all of the retractors in the model
- Parameters:
model (Model) –
Model
that the defined flag for all retractors will be unset inflag (Flag) – Flag to unset on the retractors
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the retractors in model m:
Oasys.PRIMER.Retractor.UnflagAll(m, f)
- classmethod Retractor.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all retractors
- Parameters:
model (Model) –
Model
that all retractors will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the retractors 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 retractors in model m:
Oasys.PRIMER.Retractor.UnsketchAll(m)
- classmethod Retractor.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged retractors in the model
- Parameters:
model (Model) –
Model
that all retractors will be unsketched inflag (Flag) – Flag set on the retractors that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the retractors 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 retractors flagged with flag in model m:
Oasys.PRIMER.Retractor.UnsketchAll(m, flag)
Instance methods¶
- Retractor.AssociateComment(comment)¶
Associates a comment with a retractor
- Parameters:
comment (Comment) –
Comment
that will be attached to the retractor- Returns:
No return value
- Return type:
None
Example
To associate comment c to the retractor r:
r.AssociateComment(c)
- Retractor.Blank()¶
Blanks the retractor
- Returns:
No return value
- Return type:
None
Example
To blank retractor r:
r.Blank()
- Retractor.Blanked()¶
Checks if the retractor is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if retractor r is blanked:
if r.Blanked(): do_something..
- Retractor.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 retractor r:
r.Browse()
- Retractor.ClearFlag(flag)¶
Clears a flag on the retractor
- Parameters:
flag (Flag) – Flag to clear on the retractor
- Returns:
No return value
- Return type:
None
Example
To clear flag f for retractor r:
r.ClearFlag(f)
- Retractor.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the retractor. The target include of the copied retractor 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:
Retractor object
- Return type:
Retractor
Example
To copy retractor r into retractor z:
z = r.Copy()
- Retractor.DetachComment(comment)¶
Detaches a comment from a retractor
- Parameters:
comment (Comment) –
Comment
that will be detached from the retractor- Returns:
No return value
- Return type:
None
Example
To detach comment c from the retractor r:
r.DetachComment(c)
- Retractor.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 retractor r:
r.Edit()
- Retractor.ExtractColour()¶
Extracts the actual colour used for retractor.
By default in PRIMER many entities such as elements get their colour automatically from the part that they are in. PRIMER cycles through 13 default colours based on the label of the entity. In this case the retractorcolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the retractor
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing retractor r:
colour = r.ExtractColour()
- Retractor.Flagged(flag)¶
Checks if the retractor is flagged or not
- Parameters:
flag (Flag) – Flag to test on the retractor
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if retractor r has flag f set on it:
if r.Flagged(f): do_something..
- Retractor.GetComments()¶
Extracts the comments associated to a retractor
- 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 retractor r:
comm_list = r.GetComments()
- Retractor.GetParameter(prop)¶
Checks if a Retractor 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 theRetractor.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – retractor property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Retractor property r.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if r.GetParameter(r.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Retractor property r.example is a parameter by using the GetParameter method:
if r.ViewParameters().GetParameter(r.example): do_something..
- Retractor.Keyword()¶
Returns the keyword for this retractor (*ELEMENT_SEATBELT_RETREROMETER) Note that a carriage return is not added. See also
Retractor.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for retractor r:
key = r.Keyword()
- Retractor.KeywordCards()¶
Returns the keyword cards for the retractor. Note that a carriage return is not added. See also
Retractor.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for retractor r:
cards = r.KeywordCards()
- Retractor.Next()¶
Returns the next retractor in the model
- Returns:
Retractor object (or None if there are no more retractors in the model)
- Return type:
Retractor
Example
To get the retractor in model m after retractor r:
r = r.Next()
- Retractor.Previous()¶
Returns the previous retractor in the model
- Returns:
Retractor object (or None if there are no more retractors in the model)
- Return type:
Retractor
Example
To get the retractor in model m before retractor r:
r = r.Previous()
- Retractor.SetFlag(flag)¶
Sets a flag on the retractor
- Parameters:
flag (Flag) – Flag to set on the retractor
- Returns:
No return value
- Return type:
None
Example
To set flag f for retractor r:
r.SetFlag(f)
- Retractor.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the retractor. The retractor will be sketched until you either call
Retractor.Unsketch()
,Retractor.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the retractor is sketched. If omitted redraw is true. If you want to sketch several retractors 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 retractor r:
r.Sketch()
- Retractor.Unblank()¶
Unblanks the retractor
- Returns:
No return value
- Return type:
None
Example
To unblank retractor r:
r.Unblank()
- Retractor.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the retractor
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the retractor is unsketched. If omitted redraw is true. If you want to unsketch several retractors 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 retractor r:
r.Unsketch()
- Retractor.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:
Retractor object
- Return type:
dict
Example
To check if Retractor property r.example is a parameter by using the
Retractor.GetParameter()
method:if r.ViewParameters().GetParameter(r.example): do_something..
- Retractor.Xrefs()¶
Returns the cross references for this retractor
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for retractor r:
xrefs = r.Xrefs()