Oasys.PRIMER.Linear class

Constants

Linear.GLOBAL

CNST is *CONSTRAINED_LINEAR_GLOBAL

Linear.LOCAL

CNST is *CONSTRAINED_LINEAR_LOCAL

Properties

property Linear.exists(read only): boolean

true if Linear exists, false if referred to but not defined

property Linear.format: constant

The Constrained Linear option. Can be Linear.GLOBAL or Linear.LOCAL

property Linear.include: integer

The Include file number that the Linear is in

property Linear.lcid: integer

Linear label

property Linear.model(read only): integer

The Model number that the constrained linear is in

property Linear.total(read only): integer

Number of degree-of-freedom cards

Constructor

classmethod Linear(model, format, lcid, nid, dof, coeff, cid=Oasys.gRPC.defaultArg)

Create a new Linear object

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

  • format (constant) – Specify the type of constrained linear. Can be Linear.GLOBAL or Linear.LOCAL)

  • lcid (integer) – Linear label

  • nid (integer) – Node id

  • dof (integer) – Degrees-of-Freedom

  • coeff (float) – Non-zero coefficient

  • cid (integer) – Optional. Coordinate System ID if format is Linear.LOCAL. The default value is 0

Returns:

Linear object

Return type:

dict

Example

To create a new constrained linear in model m of type LOCAL with lcid 1, nid 1, dof 3, coeff 0.5 and cid 2

c_l = Oasys.PRIMER.Linear(m,Oasys.PRIMER.Linear.LOCAL,1,1,3,0.5,2)

Static methods

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

Blanks all of the constrained linears in the model

Parameters:
  • model (Model) – Model that all constrained linears 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 constrained linears in model m:

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

Blanks all of the flagged constrained linears in the model

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

  • flag (Flag) – Flag set on the constrained linears 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 constrained linears in model m flagged with f:

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

Starts an interactive editing panel to create a Linear

Parameters:
  • model (Model) – Model that the constrainedLinear 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:

Linear object (or None if not made)

Return type:

dict

Example

To start creating a constrainedLinear in model m:

c_l = Oasys.PRIMER.Linear.Create(m)
classmethod Linear.First(model)

Returns the first constrained linear in the model

Parameters:

model (Model) – Model to get first constrained linear in

Returns:

Linear object (or None if there are no constrained linears in the model)

Return type:

Linear

Example

To get the first constrained linear in model m:

c_l = Oasys.PRIMER.Linear.First(m)
classmethod Linear.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the first free constrained linear label in the model. Also see Linear.LastFreeLabel(), Linear.NextFreeLabel() and Model.FirstFreeItemLabel()

Parameters:
  • model (Model) – Model to get first free constrained linear label in

  • layer (Include number) – Optional. Include file (0 for the main file) to search for labels in (Equivalent to First free in layer in editing panels). If omitted the whole model will be used (Equivalent to First free in editing panels)

Returns:

Linear label

Return type:

int

Example

To get the first free constrained linear label in model m:

label = Oasys.PRIMER.Linear.FirstFreeLabel(m)
classmethod Linear.FlagAll(model, flag)

Flags all of the constrained linears in the model with a defined flag

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

  • flag (Flag) – Flag to set on the constrained linears

Returns:

No return value

Return type:

None

Example

To flag all of the constrained linears with flag f in model m:

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

Returns a list of Linear objects for all of the constrained linears in a model in PRIMER

Parameters:

model (Model) – Model to get constrained linears from

Returns:

List of Linear objects

Return type:

list

Example

To make a list of Linear objects for all of the constrained linears in model m

c_l = Oasys.PRIMER.Linear.GetAll(m)
classmethod Linear.GetFlagged(model, flag)

Returns a list of Linear objects for all of the flagged constrained linears in a model in PRIMER

Parameters:
  • model (Model) – Model to get constrained linears from

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

Returns:

List of Linear objects

Return type:

list

Example

To make a list of Linear objects for all of the constrained linears in model m flagged with f

c_l = Oasys.PRIMER.Linear.GetFlagged(m, f)
classmethod Linear.GetFromID(model, number)

Returns the Linear object for a constrained linear ID

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

  • number (integer) – number of the constrained linear you want the Linear object for

Returns:

Linear object (or None if constrained linear does not exist)

Return type:

Linear

Example

To get the Linear object for constrained linear 100 in model m

c_l = Oasys.PRIMER.Linear.GetFromID(m, 100)
classmethod Linear.Last(model)

Returns the last constrained linear in the model

Parameters:

model (Model) – Model to get last constrained linear in

Returns:

Linear object (or None if there are no constrained linears in the model)

Return type:

Linear

Example

To get the last constrained linear in model m:

c_l = Oasys.PRIMER.Linear.Last(m)
classmethod Linear.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the last free constrained linear label in the model. Also see Linear.FirstFreeLabel(), Linear.NextFreeLabel() and see Model.LastFreeItemLabel()

Parameters:
  • model (Model) – Model to get last free constrained linear label in

  • layer (Include number) – Optional. Include file (0 for the main file) to search for labels in (Equivalent to Highest free in layer in editing panels). If omitted the whole model will be used

Returns:

Linear label

Return type:

int

Example

To get the last free constrained linear label in model m:

label = Oasys.PRIMER.Linear.LastFreeLabel(m)
classmethod Linear.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the next free (highest+1) constrained linear label in the model. Also see Linear.FirstFreeLabel(), Linear.LastFreeLabel() and Model.NextFreeItemLabel()

Parameters:
  • model (Model) – Model to get next free constrained linear label in

  • layer (Include number) – Optional. Include file (0 for the main file) to search for labels in (Equivalent to Highest+1 in layer in editing panels). If omitted the whole model will be used (Equivalent to Highest+1 in editing panels)

Returns:

Linear label

Return type:

int

Example

To get the next free constrained linear label in model m:

label = Oasys.PRIMER.Linear.NextFreeLabel(m)
classmethod Linear.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)

Allows the user to pick a constrained linear

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 constrained linears from that model can be picked. If the argument is a Flag then only constrained linears that are flagged with limit can be selected. If omitted, or None, any constrained linears 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:

Linear object (or None if not picked)

Return type:

dict

Example

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

c_l = Oasys.PRIMER.Linear.Pick('Pick constrained linear from screen', m)
classmethod Linear.RenumberAll(model, start)

Renumbers all of the constrained linears in the model

Parameters:
  • model (Model) – Model that all constrained linears will be renumbered in

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the constrained linears in model m, from 1000000:

Oasys.PRIMER.Linear.RenumberAll(m, 1000000)
classmethod Linear.RenumberFlagged(model, flag, start)

Renumbers all of the flagged constrained linears in the model

Parameters:
  • model (Model) – Model that all the flagged constrained linears will be renumbered in

  • flag (Flag) – Flag set on the constrained linears that you want to renumber

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the constrained linears in model m flagged with f, from 1000000:

Oasys.PRIMER.Linear.RenumberFlagged(m, f, 1000000)
classmethod Linear.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select constrained linears using standard PRIMER object menus

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

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

  • limit (Model or Flag) – Optional. If the argument is a Model then only constrained linears from that model can be selected. If the argument is a Flag then only constrained linears that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any constrained linears 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 constrained linears selected or None if menu cancelled

Return type:

int

Example

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

Oasys.PRIMER.Linear.Select(f, 'Select constrained linears', m)

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

Oasys.PRIMER.Linear.Select(f, 'Select constrained linears', l)
classmethod Linear.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

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

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

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

  • redraw (boolean) – Optional. If model should be redrawn or not after the constrained linears are sketched. If omitted redraw is true. If you want to sketch flagged constrained linears 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 constrained linears flagged with flag in model m:

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

Returns the total number of constrained linears in the model

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

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

Returns:

number of constrained linears

Return type:

int

Example

To get the total number of constrained linears in model m:

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

Unblanks all of the constrained linears in the model

Parameters:
  • model (Model) – Model that all constrained linears 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 constrained linears in model m:

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

Unblanks all of the flagged constrained linears in the model

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

  • flag (Flag) – Flag set on the constrained linears 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 constrained linears in model m flagged with f:

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

Unsets a defined flag on all of the constrained linears in the model

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

  • flag (Flag) – Flag to unset on the constrained linears

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the constrained linears in model m:

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

Unsketches all constrained linears

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

  • redraw (boolean) – Optional. If model should be redrawn or not after the constrained linears 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 constrained linears in model m:

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

Unsketches all flagged constrained linears in the model

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

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

  • redraw (boolean) – Optional. If model should be redrawn or not after the constrained linears 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 constrained linears flagged with flag in model m:

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

Instance methods

Linear.AddRowData(nid, dof, coeff, cid=Oasys.gRPC.defaultArg)

Used to add additional independent card 2 to the keyword. Adds this data to the end of the selected *CONSTRAINED_LINEAR

Parameters:
  • nid (integer) – Node id

  • dof (integer) – Degrees-of-Freedom

  • coeff (float) – Non-zero coefficient

  • cid (integer) – Optional. Coordinate System ID if format is Linear.LOCAL. The default value is 0

Returns:

No return value

Return type:

None

Example

To add NID 10 to the keyword c_l with dof 4, coeff 1.3, cid 2:

c_l.AddRowData(10,4,1.3,2)
Linear.AssociateComment(comment)

Associates a comment with a constrained linear

Parameters:

comment (Comment) – Comment that will be attached to the constrained linear

Returns:

No return value

Return type:

None

Example

To associate comment c to the constrained linear c_l:

c_l.AssociateComment(c)
Linear.Blank()

Blanks the constrained linear

Returns:

No return value

Return type:

None

Example

To blank constrained linear c_l:

c_l.Blank()
Linear.Blanked()

Checks if the constrained linear is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if constrained linear c_l is blanked:

if c_l.Blanked():
    do_something..
Linear.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 constrained linear c_l:

c_l.Browse()
Linear.ClearFlag(flag)

Clears a flag on the constrained linear

Parameters:

flag (Flag) – Flag to clear on the constrained linear

Returns:

No return value

Return type:

None

Example

To clear flag f for constrained linear c_l:

c_l.ClearFlag(f)
Linear.Copy(range=Oasys.gRPC.defaultArg)

Copies the constrained linear. The target include of the copied constrained linear 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:

Linear object

Return type:

Linear

Example

To copy constrained linear c_l into constrained linear z:

z = c_l.Copy()
Linear.DetachComment(comment)

Detaches a comment from a constrained linear

Parameters:

comment (Comment) – Comment that will be detached from the constrained linear

Returns:

No return value

Return type:

None

Example

To detach comment c from the constrained linear c_l:

c_l.DetachComment(c)
Linear.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 constrained linear c_l:

c_l.Edit()
Linear.Flagged(flag)

Checks if the constrained linear is flagged or not

Parameters:

flag (Flag) – Flag to test on the constrained linear

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if constrained linear c_l has flag f set on it:

if c_l.Flagged(f):
    do_something..
Linear.GetComments()

Extracts the comments associated to a constrained linear

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 constrained linear c_l:

comm_list = c_l.GetComments()
Linear.GetParameter(prop)

Checks if a Linear 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 Linear.ViewParameters() method and ‘method chaining’ (see the examples below)

Parameters:

prop (string) – constrained linear property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if Linear property c_l.example is a parameter:

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

To check if Linear property c_l.example is a parameter by using the GetParameter method:

if c_l.ViewParameters().GetParameter(c_l.example):
    do_something..
Linear.GetRowData(row_index)

Returns independent card 2 for the selected row of the *CONSTRAINED_LINEAR

Parameters:

row_index (Integer) – The row index of the data to return. Note that indices start at 0, not 1.
0 <= row_index < Linear.total

Returns:

List containing data

Return type:

list

Example

To loop over all the lines of the keyword for c_l:

for i in range(c_l.total):
    data = c_l.GetRowData(i)
Linear.Keyword()

Returns the keyword for this Linear (*constrained_linear). Note that a carriage return is not added. See also Linear.KeywordCards()

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for Linear c_l:

key = c_l.Keyword()
Linear.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for Linear c_l:

cards = c_l.KeywordCards()
Linear.Next()

Returns the next constrained linear in the model

Returns:

Linear object (or None if there are no more constrained linears in the model)

Return type:

Linear

Example

To get the constrained linear in model m after constrained linear c_l:

c_l = c_l.Next()
Linear.Previous()

Returns the previous constrained linear in the model

Returns:

Linear object (or None if there are no more constrained linears in the model)

Return type:

Linear

Example

To get the constrained linear in model m before constrained linear c_l:

c_l = c_l.Previous()
Linear.RemoveRowData(row_index)

Removes an independent card 2 for the selected row on the *CONSTRAINED_LINEAR

Parameters:

row_index (Integer) – The row index of the data to return. Note that indices start at 0, not 1.
0 <= row_index < Linear.total

Returns:

No return value

Return type:

None

Example

To remove row 2 for c_l:

c_l.RemoveRowData(1)
Linear.SetFlag(flag)

Sets a flag on the constrained linear

Parameters:

flag (Flag) – Flag to set on the constrained linear

Returns:

No return value

Return type:

None

Example

To set flag f for constrained linear c_l:

c_l.SetFlag(f)
Linear.SetRowData(row_index, nid, dof, coeff, cid=Oasys.gRPC.defaultArg)

Used to reset values in already existing card 2 in the selected row of *CONSTRAINED_LINEAR

Parameters:
  • row_index (Integer) – The row index of the data to return. Note that indices start at 0, not 1.
    0 <= row_index < Linear.total

  • nid (integer) – Node id

  • dof (integer) – Degrees-of-Freedom

  • coeff (float) – Non-zero coefficient

  • cid (integer) – Optional. Coordinate System ID if format is Linear.LOCAL. The default value is 0

Returns:

No return value

Return type:

None

Example

To reset the values of row 3 of the keyword with NID 11, dof 2, coeff 3.2, cid 4:

c_l.SetRowData(2,11,2,3.2,4)
Linear.Sketch(redraw=Oasys.gRPC.defaultArg)

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

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the constrained linear is sketched. If omitted redraw is true. If you want to sketch several constrained linears 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 constrained linear c_l:

c_l.Sketch()
Linear.Unblank()

Unblanks the constrained linear

Returns:

No return value

Return type:

None

Example

To unblank constrained linear c_l:

c_l.Unblank()
Linear.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the constrained linear

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the constrained linear is unsketched. If omitted redraw is true. If you want to unsketch several constrained linears 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 constrained linear c_l:

c_l.Unsketch()
Linear.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:

Linear object

Return type:

dict

Example

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

if c_l.ViewParameters().GetParameter(c_l.example):
    do_something..
Linear.Xrefs()

Returns the cross references for this constrained linear

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for constrained linear c_l:

xrefs = c_l.Xrefs()