Oasys.PRIMER.Box class

Constants

Box.BOX

Box is *DEFINE_BOX

Box.BOX_ADAPTIVE

Box is *DEFINE_BOX_ADAPTIVE

Box.BOX_COARSEN

Box is *DEFINE_BOX_COARSEN

Box.BOX_DRAWBEAD

Box is *DEFINE_BOX_DRAWBEAD

Box.BOX_SPH

Box is *DEFINE_BOX_SPH

Properties

property Box.bid: integer

Box number. Also see the label property which is an alternative name for this

property Box.brmax: float

Maximum mesh size in 3D tetrahedron adaptivity

property Box.brmin: float

Minimum mesh size in 3D tetrahedron adaptivity

property Box.cid: integer

Optional coordinate system ID for tubular drawbead

property Box.cx: float

X coordinate of offset vector to local origin

property Box.cy: float

Y coordinate of offset vector to local origin

property Box.cz: float

Z coordinate of offset vector to local origin

property Box.exists(read only): boolean

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

property Box.heading: string

Box heading

property Box.idir: integer

Direction of tooling movement. 1: x-direction, 2: y-direction, 3: z-direction

property Box.iflag: integer

Element protection flag. 0: elements inside, 1: elements outside box cannot be coarsened

property Box.include: integer

The Include file number that the box is in

property Box.label: integer

Box number. Also see the bid property which is an alternative name for this

property Box.lcid: integer

Load curve ID to describe motion value versus time

property Box.level: integer

Maximum number of refinement levels for elements contained in box

property Box.lidx: integer

Box movement in global X axis or by node. The ndid property is an alternative name for this

property Box.lidy: integer

Box movement in global Y axis

property Box.lidz: integer

Box movement in global Z axis

property Box.local: boolean

Turns _LOCAL on or off

property Box.model(read only): integer

The Model number that the box is in

property Box.ndid: integer

Box movement in global X axis or by node. The lidx property is an alternative name for this

property Box.nid: integer

Referential nodal ID for vd = 2

property Box.option: constant

The box option. Can be Box.BOX, Box.BOX_ADAPTIVE, Box.BOX_COARSEN, Box.BOX_DRAWBEAD or Box.BOX_SPH

property Box.pid_adaptive: integer

Part ID for Box.BOX_ADAPTIVE option

property Box.pid_drawbead: integer

Part ID of blank for Box.BOX_DRAWBEAD option

property Box.radius: float

Radius of tube centered around draw bead

property Box.sid: integer

Part set, part or node set defining the nodal points along draw bead

property Box.stype: integer

Set type for stype. 2: part set ID, 3: part ID, 4: node set ID

property Box.vd: integer

Velocity/Displacement flag. 0: velocity, 1: displacement, 2: referential node

property Box.vid: integer

Vector ID of DOF

property Box.xmn: float

Minimum X coordinate

property Box.xmx: float

Maximum X coordinate

property Box.xv: float

Local V vector X coordinate

property Box.xx: float

Local X vector X coordinate

property Box.ymn: float

Minimum Y coordinate

property Box.ymx: float

Maximum Y coordinate

property Box.yv: float

Local V vector Y coordinate

property Box.yx: float

Local X vector Y coordinate

property Box.zmn: float

Minimum Z coordinate

property Box.zmx: float

Maximum Z coordinate

property Box.zv: float

Local V vector Z coordinate

property Box.zx: float

Local X vector Z coordinate

Constructor

classmethod Box(model, bid, xmn, xmx, ymn, ymx, zmn, zmx, heading=Oasys.gRPC.defaultArg)

Create a new Box object

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

  • bid (integer) – Box number

  • xmn (float) – Minimum X coordinate

  • xmx (float) – Maximum X coordinate

  • ymn (float) – Minimum Y coordinate

  • ymx (float) – Maximum Y coordinate

  • zmn (float) – Minimum Z coordinate

  • zmx (float) – Maximum Z coordinate

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

Returns:

Box object

Return type:

dict

Example

To create a new box in model m with label 200

b = Oasys.PRIMER.Box(m, 200, 1.5, 2.5, 1.0, 4.5, -4.0, 3.0)

Static methods

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

Blanks all of the boxs in the model

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

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

Blanks all of the flagged boxs in the model

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

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

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

Starts an interactive editing panel to create a box

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

Box object (or None if not made)

Return type:

dict

Example

To start creating a box in model m:

m = Oasys.PRIMER.Box.Create(m)
classmethod Box.First(model)

Returns the first box in the model

Parameters:

model (Model) – Model to get first box in

Returns:

Box object (or None if there are no boxs in the model)

Return type:

Box

Example

To get the first box in model m:

b = Oasys.PRIMER.Box.First(m)
classmethod Box.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

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

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

Box label

Return type:

int

Example

To get the first free box label in model m:

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

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

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

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

Returns:

No return value

Return type:

None

Example

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

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

Returns a list of Box objects for all of the boxs in a model in PRIMER

Parameters:

model (Model) – Model to get boxs from

Returns:

List of Box objects

Return type:

list

Example

To make a list of Box objects for all of the boxs in model m

b = Oasys.PRIMER.Box.GetAll(m)
classmethod Box.GetFlagged(model, flag)

Returns a list of Box objects for all of the flagged boxs in a model in PRIMER

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

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

Returns:

List of Box objects

Return type:

list

Example

To make a list of Box objects for all of the boxs in model m flagged with f

b = Oasys.PRIMER.Box.GetFlagged(m, f)
classmethod Box.GetFromID(model, number)

Returns the Box object for a box ID

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

  • number (integer) – number of the box you want the Box object for

Returns:

Box object (or None if box does not exist)

Return type:

Box

Example

To get the Box object for box 100 in model m

b = Oasys.PRIMER.Box.GetFromID(m, 100)
classmethod Box.Last(model)

Returns the last box in the model

Parameters:

model (Model) – Model to get last box in

Returns:

Box object (or None if there are no boxs in the model)

Return type:

Box

Example

To get the last box in model m:

b = Oasys.PRIMER.Box.Last(m)
classmethod Box.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

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

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

Box label

Return type:

int

Example

To get the last free box label in model m:

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

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

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

Box label

Return type:

int

Example

To get the next free box label in model m:

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

Allows the user to pick a box

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

Box object (or None if not picked)

Return type:

dict

Example

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

b = Oasys.PRIMER.Box.Pick('Pick box from screen', m)
classmethod Box.RenumberAll(model, start)

Renumbers all of the boxs in the model

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Renumbers all of the flagged boxs in the model

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

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Allows the user to select boxs using standard PRIMER object menus

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

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

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

Return type:

int

Example

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

Oasys.PRIMER.Box.Select(f, 'Select boxs', m)

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

Oasys.PRIMER.Box.Select(f, 'Select boxs', l)
classmethod Box.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

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

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

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

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

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

Returns the total number of boxs in the model

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

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

Returns:

number of boxs

Return type:

int

Example

To get the total number of boxs in model m:

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

Unblanks all of the boxs in the model

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

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

Unblanks all of the flagged boxs in the model

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

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

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

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

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

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

Returns:

No return value

Return type:

None

Example

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

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

Unsketches all boxs

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

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

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

Unsketches all flagged boxs in the model

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

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

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

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

Instance methods

Box.AssociateComment(comment)

Associates a comment with a box

Parameters:

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

Returns:

No return value

Return type:

None

Example

To associate comment c to the box b:

b.AssociateComment(c)
Box.Blank()

Blanks the box

Returns:

No return value

Return type:

None

Example

To blank box b:

b.Blank()
Box.Blanked()

Checks if the box is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if box b is blanked:

if b.Blanked():
    do_something..
Box.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 box b:

b.Browse()
Box.ClearFlag(flag)

Clears a flag on the box

Parameters:

flag (Flag) – Flag to clear on the box

Returns:

No return value

Return type:

None

Example

To clear flag f for box b:

b.ClearFlag(f)
Box.Copy(range=Oasys.gRPC.defaultArg)

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

Box object

Return type:

Box

Example

To copy box b into box z:

z = b.Copy()
Box.DetachComment(comment)

Detaches a comment from a box

Parameters:

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

Returns:

No return value

Return type:

None

Example

To detach comment c from the box b:

b.DetachComment(c)
Box.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 box b:

b.Edit()
Box.Flagged(flag)

Checks if the box is flagged or not

Parameters:

flag (Flag) – Flag to test on the box

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if box b has flag f set on it:

if b.Flagged(f):
    do_something..
Box.GetComments()

Extracts the comments associated to a box

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 box b:

comm_list = b.GetComments()
Box.GetParameter(prop)

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

Parameters:

prop (string) – box property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if Box property b.example is a parameter:

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

To check if Box property b.example is a parameter by using the GetParameter method:

if b.ViewParameters().GetParameter(b.example):
    do_something..
Box.Keyword()

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

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for box m:

key = m.Keyword()
Box.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for box b:

cards = b.KeywordCards()
Box.Next()

Returns the next box in the model

Returns:

Box object (or None if there are no more boxs in the model)

Return type:

Box

Example

To get the box in model m after box b:

b = b.Next()
Box.Previous()

Returns the previous box in the model

Returns:

Box object (or None if there are no more boxs in the model)

Return type:

Box

Example

To get the box in model m before box b:

b = b.Previous()
Box.SetFlag(flag)

Sets a flag on the box

Parameters:

flag (Flag) – Flag to set on the box

Returns:

No return value

Return type:

None

Example

To set flag f for box b:

b.SetFlag(f)
Box.Sketch(redraw=Oasys.gRPC.defaultArg)

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

Parameters:

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

b.Sketch()
Box.Unblank()

Unblanks the box

Returns:

No return value

Return type:

None

Example

To unblank box b:

b.Unblank()
Box.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the box

Parameters:

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

b.Unsketch()
Box.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:

Box object

Return type:

dict

Example

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

if b.ViewParameters().GetParameter(b.example):
    do_something..
Box.Xrefs()

Returns the cross references for this box

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for box b:

xrefs = b.Xrefs()