Oasys.PRIMER.Hourglass class

Properties

property Hourglass.exists(read only): boolean

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

property Hourglass.hgid: integer or string

Hourglass number or character label. Also see the label property which is an alternative name for this

property Hourglass.ibq: integer

Bulk viscosity type

property Hourglass.ihq: integer

Hourglass control type

property Hourglass.include: integer

The Include file number that the hourglass is in

property Hourglass.label: integer or string

Hourglass number or character label. Also see the hgid property which is an alternative name for this

property Hourglass.model(read only): integer

The Model number that the hourglass is in

property Hourglass.q1: float

Quadratic bulk viscosity coefficient

property Hourglass.q2: float

Linear bulk viscosity coefficient

property Hourglass.qb: float

Coefficient for shell bending

property Hourglass.qm: float

Hourglass coefficient

property Hourglass.qw: float

Coefficient for shell warping

property Hourglass.title: string

Title for hourglass

property Hourglass.vdc: float

Viscous damping coefficient

Constructor

classmethod Hourglass(model, hgid, title=Oasys.gRPC.defaultArg)

Create a new Hourglass object

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

  • hgid (integer or string) – Hourglass number or character label

  • title (string) – Optional. Title for the hourglass

Returns:

Hourglass object

Return type:

dict

Example

To create a new hourglass in model m with label 100:

h = Oasys.PRIMER.Hourglass(m, 100)

Static methods

classmethod Hourglass.Create(model, modal=Oasys.gRPC.defaultArg)

Starts an interactive editing panel to create a hourglass

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

Hourglass object (or None if not made)

Return type:

dict

Example

To start creating a hourglass in model m:

h = Oasys.PRIMER.Hourglass.Create(m)
classmethod Hourglass.First(model)

Returns the first hourglass in the model

Parameters:

model (Model) – Model to get first hourglass in

Returns:

Hourglass object (or None if there are no hourglasss in the model)

Return type:

Hourglass

Example

To get the first hourglass in model m:

n = Oasys.PRIMER.Hourglass.First(m)
classmethod Hourglass.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the first free hourglass label in the model. Also see Hourglass.LastFreeLabel(), Hourglass.NextFreeLabel() and Model.FirstFreeItemLabel()

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

Hourglass label

Return type:

int

Example

To get the first free hourglass label in model m:

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

Flags all of the hourglasss in the model with a defined flag

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

  • flag (Flag) – Flag to set on the hourglasss

Returns:

No return value

Return type:

None

Example

To flag all of the hourglasss with flag f in model m:

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

Returns a list of Hourglass objects for all of the hourglasss in a model in PRIMER

Parameters:

model (Model) – Model to get hourglasss from

Returns:

List of Hourglass objects

Return type:

list

Example

To make a list of Hourglass objects for all of the hourglasss in model m

n = Oasys.PRIMER.Hourglass.GetAll(m)
classmethod Hourglass.GetFlagged(model, flag)

Returns a list of Hourglass objects for all of the flagged hourglasss in a model in PRIMER

Parameters:
  • model (Model) – Model to get hourglasss from

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

Returns:

List of Hourglass objects

Return type:

list

Example

To make a list of Hourglass objects for all of the hourglasss in model m flagged with f

n = Oasys.PRIMER.Hourglass.GetFlagged(m, f)
classmethod Hourglass.GetFromID(model, number)

Returns the Hourglass object for a hourglass ID

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

  • number (integer) – number of the hourglass you want the Hourglass object for

Returns:

Hourglass object (or None if hourglass does not exist)

Return type:

Hourglass

Example

To get the Hourglass object for hourglass 100 in model m

n = Oasys.PRIMER.Hourglass.GetFromID(m, 100)
classmethod Hourglass.Last(model)

Returns the last hourglass in the model

Parameters:

model (Model) – Model to get last hourglass in

Returns:

Hourglass object (or None if there are no hourglasss in the model)

Return type:

Hourglass

Example

To get the last hourglass in model m:

n = Oasys.PRIMER.Hourglass.Last(m)
classmethod Hourglass.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the last free hourglass label in the model. Also see Hourglass.FirstFreeLabel(), Hourglass.NextFreeLabel() and see Model.LastFreeItemLabel()

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

Hourglass label

Return type:

int

Example

To get the last free hourglass label in model m:

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

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

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

Hourglass label

Return type:

int

Example

To get the next free hourglass label in model m:

label = Oasys.PRIMER.Hourglass.NextFreeLabel(m)
classmethod Hourglass.RenumberAll(model, start)

Renumbers all of the hourglasss in the model

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Renumbers all of the flagged hourglasss in the model

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

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Allows the user to select hourglasss using standard PRIMER object menus

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

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

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

Return type:

int

Example

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

Oasys.PRIMER.Hourglass.Select(f, 'Select hourglasss', m)

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

Oasys.PRIMER.Hourglass.Select(f, 'Select hourglasss', l)
classmethod Hourglass.Total(model, exists=Oasys.gRPC.defaultArg)

Returns the total number of hourglasss in the model

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

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

Returns:

number of hourglasss

Return type:

int

Example

To get the total number of hourglasss in model m:

total = Oasys.PRIMER.Hourglass.Total(m)
classmethod Hourglass.UnflagAll(model, flag)

Unsets a defined flag on all of the hourglasss in the model

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

  • flag (Flag) – Flag to unset on the hourglasss

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the hourglasss in model m:

Oasys.PRIMER.Hourglass.UnflagAll(m, f)

Instance methods

Hourglass.AssociateComment(comment)

Associates a comment with a hourglass

Parameters:

comment (Comment) – Comment that will be attached to the hourglass

Returns:

No return value

Return type:

None

Example

To associate comment c to the hourglass n:

n.AssociateComment(c)
Hourglass.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 hourglass n:

n.Browse()
Hourglass.ClearFlag(flag)

Clears a flag on the hourglass

Parameters:

flag (Flag) – Flag to clear on the hourglass

Returns:

No return value

Return type:

None

Example

To clear flag f for hourglass n:

n.ClearFlag(f)
Hourglass.Copy(range=Oasys.gRPC.defaultArg)

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

Hourglass object

Return type:

Hourglass

Example

To copy hourglass n into hourglass z:

z = n.Copy()
Hourglass.DetachComment(comment)

Detaches a comment from a hourglass

Parameters:

comment (Comment) – Comment that will be detached from the hourglass

Returns:

No return value

Return type:

None

Example

To detach comment c from the hourglass n:

n.DetachComment(c)
Hourglass.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 hourglass n:

n.Edit()
Hourglass.Flagged(flag)

Checks if the hourglass is flagged or not

Parameters:

flag (Flag) – Flag to test on the hourglass

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if hourglass n has flag f set on it:

if n.Flagged(f):
    do_something..
Hourglass.GetComments()

Extracts the comments associated to a hourglass

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 hourglass n:

comm_list = n.GetComments()
Hourglass.GetParameter(prop)

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

Parameters:

prop (string) – hourglass property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if Hourglass property n.example is a parameter:

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

To check if Hourglass property n.example is a parameter by using the GetParameter method:

if n.ViewParameters().GetParameter(n.example):
    do_something..
Hourglass.Keyword()

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

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for hourglass h:

key = h.Keyword()
Hourglass.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for hourglass h:

cards = h.KeywordCards()
Hourglass.Next()

Returns the next hourglass in the model

Returns:

Hourglass object (or None if there are no more hourglasss in the model)

Return type:

Hourglass

Example

To get the hourglass in model m after hourglass n:

n = n.Next()
Hourglass.Previous()

Returns the previous hourglass in the model

Returns:

Hourglass object (or None if there are no more hourglasss in the model)

Return type:

Hourglass

Example

To get the hourglass in model m before hourglass n:

n = n.Previous()
Hourglass.SetFlag(flag)

Sets a flag on the hourglass

Parameters:

flag (Flag) – Flag to set on the hourglass

Returns:

No return value

Return type:

None

Example

To set flag f for hourglass n:

n.SetFlag(f)
Hourglass.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:

Hourglass object

Return type:

dict

Example

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

if n.ViewParameters().GetParameter(n.example):
    do_something..
Hourglass.Xrefs()

Returns the cross references for this hourglass

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for hourglass n:

xrefs = n.Xrefs()