The Box class gives you access to define box cards in PRIMER. More...
The PRIMER JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Type | Description |
| bid | integer | Box number. Also see the label property which is an alternative name for this. |
| brmax | real | Maximum mesh size in 3D tetrahedron adaptivity |
| brmin | real | Minimum mesh size in 3D tetrahedron adaptivity |
| cid | integer | Optional coordinate system ID for tubular drawbead |
| cx | real | X coordinate of offset vector to local origin |
| cy | real | Y coordinate of offset vector to local origin |
| cz | real | Z coordinate of offset vector to local origin |
| exists (read only) | logical | true if box exists, false if referred to but not defined. |
| heading | string | Box heading |
| idir | integer | Direction of tooling movement. 1: x-direction, 2: y-direction, 3: z-direction |
| iflag | integer | Element protection flag. 0: elements inside, 1: elements outside box cannot be coarsened. |
| include | integer | The Include file number that the box is in. |
| label | integer | Box number. Also see the bid property which is an alternative name for this. |
| lcid | integer | Load curve ID to describe motion value versus time |
| level | integer | Maximum number of refinement levels for elements contained in box |
| lidx | integer | Box movement in global X axis or by node. The ndid property is an alternative name for this. |
| lidy | integer | Box movement in global Y axis |
| lidz | integer | Box movement in global Z axis |
| local | logical | Turns _LOCAL on or off |
| model (read only) | integer | The Model number that the box is in. |
| ndid | integer | Box movement in global X axis or by node. The lidx property is an alternative name for this. |
| nid | integer | Referential nodal ID for vd = 2 |
| option | constant | The box option. Can be Box.BOX, Box.BOX_ADAPTIVE, Box.BOX_COARSEN, Box.BOX_DRAWBEAD or Box.BOX_SPH. |
| pid_adaptive | integer | Part ID for Box.BOX_ADAPTIVE option |
| pid_drawbead | integer | Part ID of blank for Box.BOX_DRAWBEAD option |
| radius | real | Radius of tube centered around draw bead |
| sid | integer | Part set, part or node set defining the nodal points along draw bead |
| stype | integer | Set type for stype. 2: part set ID, 3: part ID, 4: node set ID |
| vd | integer | Velocity/Displacement flag. 0: velocity, 1: displacement, 2: referential node |
| vid | integer | Vector ID of DOF |
| xmn | real | Minimum X coordinate |
| xmx | real | Maximum X coordinate |
| xv | real | Local V vector X coordinate |
| xx | real | Local X vector X coordinate |
| ymn | real | Minimum Y coordinate |
| ymx | real | Maximum Y coordinate |
| yv | real | Local V vector Y coordinate |
| yx | real | Local X vector Y coordinate |
| zmn | real | Minimum Z coordinate |
| zmx | real | Maximum Z coordinate |
| zv | real | Local V vector Z coordinate |
| zx | real | Local X vector Z coordinate |
Detailed DescriptionThe Box class allows you to create, modify, edit and manipulate box cards. See the documentation below for more details. |
Constructornew Box(Model[Model], bid[integer], xmn[real], xmx[real], ymn[real], ymx[real], zmn[real], zmx[real], heading (optional)[string])DescriptionCreate a new Box object. |
Model that box will be created in
Box number
Minimum X coordinate
Maximum X coordinate
Minimum Y coordinate
Maximum Y coordinate
Minimum Z coordinate
Maximum Z coordinate
Title for the box
ReturnsBox object Return typeBox |
ExampleTo create a new box in model m with label 200 var b = new Box(m, 200, 1.5, 2.5, 1.0, 4.5, -4.0, 3.0);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a box. |
Comment that will be attached to the box
ReturnsNo return value |
ExampleTo associate comment c to the box b: b.AssociateComment(c);
|
Blank()DescriptionBlanks the box |
No arguments
ReturnsNo return value |
ExampleTo blank box b: b.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the boxs in the model. |
Model that all boxs will be blanked in
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().
ReturnsNo return value |
ExampleTo blank all of the boxs in model m: Box.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged boxs in the model. |
Model that all the flagged boxs will be blanked in
Flag set on the boxs that you want to blank
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().
ReturnsNo return value |
ExampleTo blank all of the boxs in model m flagged with f: Box.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the box is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if box b is blanked: if (b.Blanked() ) do_something...
|
Browse(modal (optional)[boolean])DescriptionStarts an edit panel in Browse mode. |
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.
Returnsno return value |
ExampleTo Browse box b: b.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the box. |
Flag to clear on the box
ReturnsNo return value |
ExampleTo clear flag f for box b: b.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the box. The target include of the copied box can be set using Options.copy_target_include. |
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().
ReturnsBox object Return typeBox |
ExampleTo copy box b into box z: var z = b.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a box |
Model that the box will be created in.
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.
ReturnsBox object (or null if not made). Return typeBox |
ExampleTo start creating a box in model m: var b = Box.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a box. |
Comment that will be detached from the box
ReturnsNo return value |
ExampleTo detach comment c from the box b: b.DetachComment(c);
|
Edit(modal (optional)[boolean])DescriptionStarts an interactive editing panel. |
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.
Returnsno return value |
ExampleTo Edit box b: b.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for box. For more details on checking see the Check class. |
The error message to give
An optional detailed error message
ReturnsNo return value |
ExampleTo add an error message "My custom error" for box b: b.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first box in the model. |
Model to get first box in
ReturnsBox object (or null if there are no boxs in the model). Return typeBox |
ExampleTo get the first box in model m: var b = Box.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free box label in the model. Also see Box.LastFreeLabel(), Box.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free box label in
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).
ReturnsBox label. Return typeNumber |
ExampleTo get the first free box label in model m: var label = Box.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the boxs in the model with a defined flag. |
Model that all boxs will be flagged in
Flag to set on the boxs
ReturnsNo return value |
ExampleTo flag all of the boxs with flag f in model m: Box.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the box is flagged or not. |
Flag to test on the box
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if box b has flag f set on it: if (b.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each box in the model. |
Model that all boxs are in
Function to call for each box
An optional extra object/array/string etc that will appended to arguments when calling the function
ReturnsNo return value |
GetAll(Model[Model], property (optional)[string]) [static]DescriptionReturns an array of Box objects or properties for all of the boxs in a model in PRIMER. If the optional property argument is not given then an array of Box objects is returned. If the property argument is given, that property value for each box is returned in the array instead of a Box object |
Model to get boxs from
Name for property to get for all boxs in the model
ReturnsArray of Box objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a box. |
No arguments
ReturnsArray of Comment objects (or null if there are no comments associated to the node). Return typeArray |
ExampleTo get the array of comments associated to the box b: var comm_array = b.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Box objects for all of the flagged boxs in a model in PRIMER If the optional property argument is not given then an array of Box objects is returned. If the property argument is given, then that property value for each box is returned in the array instead of a Box object |
Model to get boxs from
Flag set on the boxs that you want to retrieve
Name for property to get for all flagged boxs in the model
ReturnsArray of Box objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Box object for a box ID. |
Model to find the box in
number of the box you want the Box object for
ReturnsBox object (or null if box does not exist). Return typeBox |
ExampleTo get the Box object for box 100 in model m var b = Box.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks 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). |
box property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
Keyword()DescriptionReturns the keyword for this box (*DEFINE_BOX). Note that a carriage return is not added. See also Box.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for box m: var key = m.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the box. Note that a carriage return is not added. See also Box.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for box b: var cards = b.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last box in the model. |
Model to get last box in
ReturnsBox object (or null if there are no boxs in the model). Return typeBox |
ExampleTo get the last box in model m: var b = Box.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free box label in the model. Also see Box.FirstFreeLabel(), Box.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free box label in
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.
ReturnsBox label. Return typeNumber |
ExampleTo get the last free box label in model m: var label = Box.LastFreeLabel(m);
|
Next()DescriptionReturns the next box in the model. |
No arguments
ReturnsBox object (or null if there are no more boxs in the model). Return typeBox |
ExampleTo get the box in model m after box b: var b = b.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) box label in the model. Also see Box.FirstFreeLabel(), Box.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free box label in
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).
ReturnsBox label. Return typeNumber |
ExampleTo get the next free box label in model m: var label = Box.NextFreeLabel(m);
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a box. |
Text to display as a prompt to the user
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 null, any boxs from any model can be selected. from any model.
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.
By default the window with the prompt will have a button labelled 'Cancel' which if pressed will cancel the pick and return null. If you want to change the text on the button use this argument. If omitted 'Cancel' will be used.
ReturnsBox object (or null if not picked) Return typeBox |
ExampleTo pick a box from model m giving the prompt 'Pick box from screen': var b = Box.Pick('Pick box from screen', m);
|
Previous()DescriptionReturns the previous box in the model. |
No arguments
ReturnsBox object (or null if there are no more boxs in the model). Return typeBox |
ExampleTo get the box in model m before box b: var b = b.Previous();
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the boxs in the model. |
Model that all boxs will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the boxs in model m, from 1000000: Box.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged boxs in the model. |
Model that all the flagged boxs will be renumbered in
Flag set on the boxs that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the boxs in model m flagged with f, from 1000000: Box.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select boxs using standard PRIMER object menus. |
Flag to use when selecting boxs
Text to display as a prompt to the user
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 null, any boxs can be selected. from any model.
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.
ReturnsNumber of boxs selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the box. |
Flag to set on the box
ReturnsNo return value |
ExampleTo set flag f for box b: b.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the box. The box will be sketched until you either call Box.Unsketch(), Box.UnsketchAll(), Model.UnsketchAll(), or delete the model |
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().
ReturnsNo return value |
ExampleTo sketch box b: b.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches 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 |
Model that all the flagged boxs will be sketched in
Flag set on the boxs that you want to sketch
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().
ReturnsNo return value |
ExampleTo sketch all boxs flagged with flag in model m: Box.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of boxs in the model. |
Model to get total for
true if only existing boxs should be counted. If false or omitted referenced but undefined boxs will also be included in the total.
Returnsnumber of boxs Return typeNumber |
ExampleTo get the total number of boxs in model m: var total = Box.Total(m);
|
Unblank()DescriptionUnblanks the box |
No arguments
ReturnsNo return value |
ExampleTo unblank box b: b.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the boxs in the model. |
Model that all boxs will be unblanked in
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().
ReturnsNo return value |
ExampleTo unblank all of the boxs in model m: Box.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged boxs in the model. |
Model that the flagged boxs will be unblanked in
Flag set on the boxs that you want to unblank
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().
ReturnsNo return value |
ExampleTo unblank all of the boxs in model m flagged with f: Box.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the boxs in the model. |
Model that the defined flag for all boxs will be unset in
Flag to unset on the boxs
ReturnsNo return value |
ExampleTo unset the flag f on all the boxs in model m: Box.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the box. |
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().
ReturnsNo return value |
ExampleTo unsketch box b: b.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all boxs. |
Model that all boxs will be unblanked in
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().
ReturnsNo return value |
ExampleTo unsketch all boxs in model m: Box.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged boxs in the model. |
Model that all boxs will be unsketched in
Flag set on the boxs that you want to unsketch
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().
ReturnsNo return value |
ExampleTo unsketch all boxs flagged with flag in model m: Box.UnsketchAll(m, flag);
|
No arguments
ReturnsBox object. Return typeBox |
ExampleTo check if Box property b.example is a parameter by using the Box.GetParameter() method: if (b.ViewParameters().GetParameter(b.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for box. For more details on checking see the Check class. |
The warning message to give
An optional detailed warning message
ReturnsNo return value |
ExampleTo add a warning message "My custom warning" for box b: b.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this box. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for box b: var xrefs = b.Xrefs();
|
toString()DescriptionCreates a string containing the box data in keyword format. Note that this contains the keyword header and the keyword cards. See also Box.Keyword() and Box.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for box b in keyword format var s = b.toString();
|