Oasys.PRIMER.Spc class

Constants

sketching mode

Spc.ROTATIONAL

Sketch rotational degrees of freedom

Spc.TRANSLATIONAL

Sketch translational degrees of freedom

suffix

Spc.NODE

SPC is *BOUNDARY_SPC_NODE

Spc.SET

SPC is *BOUNDARY_SPC_SET

Properties

property Spc.cid: integer

Coordinate system ID

property Spc.dofrx: integer

Rotational constraint in local x direction

property Spc.dofry: integer

Rotational constraint in local y direction

property Spc.dofrz: integer

Rotational constraint in local z direction

property Spc.dofx: integer

Translational constraint in local x direction

property Spc.dofy: integer

Translational constraint in local y direction

property Spc.dofz: integer

Translational constraint in local z direction

property Spc.exists(read only): boolean

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

property Spc.heading: string

Spc heading

property Spc.id: boolean

true if _ID option is set, false if not

property Spc.include: integer

The Include file number that the spc is in

property Spc.label: integer

Spc number

property Spc.model(read only): integer

The Model number that the boundary SPC is in

property Spc.nid: integer

Node ID or node set ID

property Spc.type: constant

The Spc type. Can be Spc.NODE or Spc.SET

_BIRTH_DEATH option

property Spc.bd_flag: boolean

true if _BIRTH_DEATH option is set, false if not

property Spc.birth: float

Activation time for constraint

property Spc.death: float

Deactivation time for constraint

Constructor

classmethod Spc(model, nid, cid, dofx, dofy, dofz, dofrx, dofry, dofrz, type, label=Oasys.gRPC.defaultArg, heading=Oasys.gRPC.defaultArg)

Create a new Spc object

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

  • nid (integer) – Node ID or node set ID

  • cid (integer) – Coordinate system ID

  • dofx (integer) – Translational constraint in local x direction

  • dofy (integer) – Translational constraint in local y direction

  • dofz (integer) – Translational constraint in local z direction

  • dofrx (integer) – Rotational constraint in local x direction

  • dofry (integer) – Rotational constraint in local y direction

  • dofrz (integer) – Rotational constraint in local z direction

  • type (constant) – Specify the type of boundary spc (Can be Spc.NODE or Spc.SET)

  • label (integer) – Optional. Spc number

  • heading (string) – Optional. Title for the spc

Returns:

Spc object

Return type:

dict

Example

To create a new boundary spc in model m with label 200, of type SET

b = Oasys.PRIMER.Spc(m, 200, 0, 1, 0, 0, 1, 0, 0, Oasys.PRIMER.Spc.SET, 200)

Static methods

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

Blanks all of the boundary SPCs in the model

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

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

Blanks all of the flagged boundary SPCs in the model

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

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

Oasys.PRIMER.Spc.BlankFlagged(m, f)
classmethod Spc.First(model)

Returns the first boundary SPC in the model

Parameters:

model (Model) – Model to get first boundary SPC in

Returns:

Spc object (or None if there are no boundary SPCs in the model)

Return type:

Spc

Example

To get the first boundary SPC in model m:

s = Oasys.PRIMER.Spc.First(m)
classmethod Spc.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the first free boundary SPC label in the model. Also see Spc.LastFreeLabel(), Spc.NextFreeLabel() and Model.FirstFreeItemLabel()

Parameters:
  • model (Model) – Model to get first free boundary SPC 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:

Spc label

Return type:

int

Example

To get the first free boundary SPC label in model m:

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

Flags all of the boundary SPCs in the model with a defined flag

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

  • flag (Flag) – Flag to set on the boundary SPCs

Returns:

No return value

Return type:

None

Example

To flag all of the boundary SPCs with flag f in model m:

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

Returns a list of Spc objects for all of the boundary SPCs in a model in PRIMER

Parameters:

model (Model) – Model to get boundary SPCs from

Returns:

List of Spc objects

Return type:

list

Example

To make a list of Spc objects for all of the boundary SPCs in model m

s = Oasys.PRIMER.Spc.GetAll(m)
classmethod Spc.GetFlagged(model, flag)

Returns a list of Spc objects for all of the flagged boundary SPCs in a model in PRIMER

Parameters:
  • model (Model) – Model to get boundary SPCs from

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

Returns:

List of Spc objects

Return type:

list

Example

To make a list of Spc objects for all of the boundary SPCs in model m flagged with f

s = Oasys.PRIMER.Spc.GetFlagged(m, f)
classmethod Spc.GetFromID(model, number)

Returns the Spc object for a boundary SPC ID

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

  • number (integer) – number of the boundary SPC you want the Spc object for

Returns:

Spc object (or None if boundary SPC does not exist)

Return type:

Spc

Example

To get the Spc object for boundary SPC 100 in model m

s = Oasys.PRIMER.Spc.GetFromID(m, 100)
classmethod Spc.Last(model)

Returns the last boundary SPC in the model

Parameters:

model (Model) – Model to get last boundary SPC in

Returns:

Spc object (or None if there are no boundary SPCs in the model)

Return type:

Spc

Example

To get the last boundary SPC in model m:

s = Oasys.PRIMER.Spc.Last(m)
classmethod Spc.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the last free boundary SPC label in the model. Also see Spc.FirstFreeLabel(), Spc.NextFreeLabel() and see Model.LastFreeItemLabel()

Parameters:
  • model (Model) – Model to get last free boundary SPC 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:

Spc label

Return type:

int

Example

To get the last free boundary SPC label in model m:

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

Returns the next free (highest+1) boundary SPC label in the model. Also see Spc.FirstFreeLabel(), Spc.LastFreeLabel() and Model.NextFreeItemLabel()

Parameters:
  • model (Model) – Model to get next free boundary SPC 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:

Spc label

Return type:

int

Example

To get the next free boundary SPC label in model m:

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

Allows the user to pick a boundary SPC

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

Spc object (or None if not picked)

Return type:

dict

Example

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

s = Oasys.PRIMER.Spc.Pick('Pick boundary SPC from screen', m)
classmethod Spc.RenumberAll(model, start)

Renumbers all of the boundary SPCs in the model

Parameters:
  • model (Model) – Model that all boundary SPCs will be renumbered in

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the boundary SPCs in model m, from 1000000:

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

Renumbers all of the flagged boundary SPCs in the model

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

  • flag (Flag) – Flag set on the boundary SPCs that you want to renumber

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the boundary SPCs in model m flagged with f, from 1000000:

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

Allows the user to select boundary SPCs using standard PRIMER object menus

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

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

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

Return type:

int

Example

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

Oasys.PRIMER.Spc.Select(f, 'Select boundary SPCs', m)

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

Oasys.PRIMER.Spc.Select(f, 'Select boundary SPCs', l)
classmethod Spc.SketchFlagged(type, model, flag)

Sketches all the flagged boundary SPCs in the model and update the plot. The SPCs will be sketched until you do a graphics update or delete the model

Parameters:
  • type (integer) – Type of constraints to be drawn. Can be Spc.TRANSLATIONAL or Spc.ROTATIONAL

  • model (Model) – Model that all the flagged boundary SPCs will be sketched in

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

Returns:

No return value

Return type:

None

Example

To sketch translational SPCs flagged with f in model m and redraw

Oasys.PRIMER.Spc.SketchFlagged(Oasys.PRIMER.Spc.TRANSLATIONAL, m, f)
classmethod Spc.Total(model, exists=Oasys.gRPC.defaultArg)

Returns the total number of boundary SPCs in the model

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

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

Returns:

number of boundary SPCs

Return type:

int

Example

To get the total number of boundary SPCs in model m:

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

Unblanks all of the boundary SPCs in the model

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

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

Unblanks all of the flagged boundary SPCs in the model

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

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

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

Unsets a defined flag on all of the boundary SPCs in the model

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

  • flag (Flag) – Flag to unset on the boundary SPCs

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the boundary SPCs in model m:

Oasys.PRIMER.Spc.UnflagAll(m, f)
classmethod Spc.UnsketchAll(model)

Unsketches all SPCs

Parameters:

model (Model) – Model that all SPCs will be unblanked in

Returns:

No return value

Return type:

None

Example

To unsketch all SPCs in model m and redraw:

SPC.UnsketchAll(m)
classmethod Spc.UnsketchFlagged(model, flag)

Unsketches all flagged SPCs

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

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

Returns:

No return value

Return type:

None

Example

To unsketch all SPCs in model m which are flagged with f and redraw:

SPC.UnsketchFlagged(m, f)

Instance methods

Spc.AssociateComment(comment)

Associates a comment with a boundary SPC

Parameters:

comment (Comment) – Comment that will be attached to the boundary SPC

Returns:

No return value

Return type:

None

Example

To associate comment c to the boundary SPC s:

s.AssociateComment(c)
Spc.Blank()

Blanks the boundary SPC

Returns:

No return value

Return type:

None

Example

To blank boundary SPC s:

s.Blank()
Spc.Blanked()

Checks if the boundary SPC is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if boundary SPC s is blanked:

if s.Blanked():
    do_something..
Spc.ClearFlag(flag)

Clears a flag on the boundary SPC

Parameters:

flag (Flag) – Flag to clear on the boundary SPC

Returns:

No return value

Return type:

None

Example

To clear flag f for boundary SPC s:

s.ClearFlag(f)
Spc.Copy(range=Oasys.gRPC.defaultArg)

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

Spc object

Return type:

Spc

Example

To copy boundary SPC s into boundary SPC z:

z = s.Copy()
Spc.DetachComment(comment)

Detaches a comment from a boundary SPC

Parameters:

comment (Comment) – Comment that will be detached from the boundary SPC

Returns:

No return value

Return type:

None

Example

To detach comment c from the boundary SPC s:

s.DetachComment(c)
Spc.Flagged(flag)

Checks if the boundary SPC is flagged or not

Parameters:

flag (Flag) – Flag to test on the boundary SPC

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if boundary SPC s has flag f set on it:

if s.Flagged(f):
    do_something..
Spc.GetComments()

Extracts the comments associated to a boundary SPC

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 boundary SPC s:

comm_list = s.GetComments()
Spc.GetParameter(prop)

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

Parameters:

prop (string) – boundary SPC property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if Spc 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 = False

To check if Spc property s.example is a parameter by using the GetParameter method:

if s.ViewParameters().GetParameter(s.example):
    do_something..
Spc.Keyword()

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

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for spc s:

key = s.Keyword()
Spc.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for spc s:

cards = s.KeywordCards()
Spc.Next()

Returns the next boundary SPC in the model

Returns:

Spc object (or None if there are no more boundary SPCs in the model)

Return type:

Spc

Example

To get the boundary SPC in model m after boundary SPC s:

s = s.Next()
Spc.Previous()

Returns the previous boundary SPC in the model

Returns:

Spc object (or None if there are no more boundary SPCs in the model)

Return type:

Spc

Example

To get the boundary SPC in model m before boundary SPC s:

s = s.Previous()
Spc.SetFlag(flag)

Sets a flag on the boundary SPC

Parameters:

flag (Flag) – Flag to set on the boundary SPC

Returns:

No return value

Return type:

None

Example

To set flag f for boundary SPC s:

s.SetFlag(f)
Spc.Sketch(type, redraw=Oasys.gRPC.defaultArg)

Sketches the Boundary SPC. The SPC will be sketched until you do a graphics update or delete the model

Parameters:
  • type (constant) – Type of constraints to be drawn. Can be Spc.TRANSLATIONAL or Spc.ROTATIONAL

  • redraw (boolean) – Optional. If set to true (or omitted) the plot will be redrawn each time. If sketching a large number of items, efficiency will be gained by setting the argument to false for all but the last item sketched. The final call will redraw

Returns:

No return value

Return type:

None

Example

To sketch SPC s - Translational constraint

s1.Sketch(Oasys.PRIMER.Spc.TRANSLATIONAL, False)
s2.Sketch(Oasys.PRIMER.Spc.TRANSLATIONAL, False)
s3.Sketch(Oasys.PRIMER.Spc.TRANSLATIONAL, True)
Spc.Unblank()

Unblanks the boundary SPC

Returns:

No return value

Return type:

None

Example

To unblank boundary SPC s:

s.Unblank()
Spc.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the Spc

Parameters:

redraw (boolean) – Optional. If set to true (or omitted) the plot will be redrawn each time. If unsketching a large number of items, efficiency will be gained by setting the argument to false for all but the last item unsketched. The final call will redraw

Returns:

No return value

Return type:

None

Example

To unsketch SPC s:

s.Unsketch()
Spc.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:

Spc object

Return type:

dict

Example

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

if s.ViewParameters().GetParameter(s.example):
    do_something..
Spc.Xrefs()

Returns the cross references for this boundary SPC

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for boundary SPC s:

xrefs = s.Xrefs()