The Hourglass class gives you access to hourglass 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 |
| exists (read only) | logical | true if hourglass exists, false if referred to but not defined. |
| hgid | integer or string | Hourglass number or character label. Also see the label property which is an alternative name for this. |
| ibq | integer | Bulk viscosity type |
| ihq | integer | Hourglass control type |
| include | integer | The Include file number that the hourglass is in. |
| label | integer or string | Hourglass number or character label. Also see the hgid property which is an alternative name for this. |
| model (read only) | integer | The Model number that the hourglass is in. |
| q1 | real | Quadratic bulk viscosity coefficient |
| q2 | real | Linear bulk viscosity coefficient |
| qb | real | Coefficient for shell bending |
| qm | real | Hourglass coefficient |
| qw | real | Coefficient for shell warping |
| title | string | Title for hourglass |
| vdc | real | Viscous damping coefficient |
Detailed DescriptionThe Hourglass class allows you to create, modify, edit and manipulate hourglass cards. See the documentation below for more details. |
Constructornew Hourglass(Model[Model], hgid[integer or string], title (optional)[string])DescriptionCreate a new Hourglass object. |
Model that hourglass will be created in
Hourglass number or character label
Title for the hourglass
ReturnsHourglass object Return typeHourglass |
ExampleTo create a new hourglass in model m with label 100: var h = new Hourglass(m, 100);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a hourglass. |
Comment that will be attached to the hourglass
ReturnsNo return value |
ExampleTo associate comment c to the hourglass n: n.AssociateComment(c);
|
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 hourglass n: n.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the hourglass. |
Flag to clear on the hourglass
ReturnsNo return value |
ExampleTo clear flag f for hourglass n: n.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the hourglass. The target include of the copied hourglass 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().
ReturnsHourglass object Return typeHourglass |
ExampleTo copy hourglass n into hourglass z: var z = n.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a hourglass |
Model that the hourglass 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.
ReturnsHourglass object (or null if not made). Return typeHourglass |
ExampleTo start creating a hourglass in model m: var n = Hourglass.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a hourglass. |
Comment that will be detached from the hourglass
ReturnsNo return value |
ExampleTo detach comment c from the hourglass n: n.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 hourglass n: n.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for hourglass. 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 hourglass n: n.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first hourglass in the model. |
Model to get first hourglass in
ReturnsHourglass object (or null if there are no hourglasses in the model). Return typeHourglass |
ExampleTo get the first hourglass in model m: var n = Hourglass.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free hourglass label in the model. Also see Hourglass.LastFreeLabel(), Hourglass.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free hourglass 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).
ReturnsHourglass label. Return typeNumber |
ExampleTo get the first free hourglass label in model m: var label = Hourglass.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the hourglasses in the model with a defined flag. |
Model that all hourglasses will be flagged in
Flag to set on the hourglasses
ReturnsNo return value |
ExampleTo flag all of the hourglasses with flag f in model m: Hourglass.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the hourglass is flagged or not. |
Flag to test on the hourglass
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if hourglass n has flag f set on it: if (n.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each hourglass in the model. |
Model that all hourglasses are in
Function to call for each hourglass
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 Hourglass objects or properties for all of the hourglasses in a model in PRIMER. If the optional property argument is not given then an array of Hourglass objects is returned. If the property argument is given, that property value for each hourglass is returned in the array instead of a Hourglass object |
Model to get hourglasses from
Name for property to get for all hourglasses in the model
ReturnsArray of Hourglass objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a hourglass. |
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 hourglass n: var comm_array = n.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Hourglass objects for all of the flagged hourglasses in a model in PRIMER If the optional property argument is not given then an array of Hourglass objects is returned. If the property argument is given, then that property value for each hourglass is returned in the array instead of a Hourglass object |
Model to get hourglasses from
Flag set on the hourglasses that you want to retrieve
Name for property to get for all flagged hourglasses in the model
ReturnsArray of Hourglass objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Hourglass object for a hourglass ID. |
Model to find the hourglass in
number of the hourglass you want the Hourglass object for
ReturnsHourglass object (or null if hourglass does not exist). Return typeHourglass |
ExampleTo get the Hourglass object for hourglass 100 in model m var n = Hourglass.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks 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). |
hourglass property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
Keyword()DescriptionReturns the keyword for this hourglass (*HOURGLASS). Note that a carriage return is not added. See also Hourglass.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for hourglass h: var key = h.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the hourglass. Note that a carriage return is not added. See also Hourglass.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for hourglass h: var cards = h.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last hourglass in the model. |
Model to get last hourglass in
ReturnsHourglass object (or null if there are no hourglasses in the model). Return typeHourglass |
ExampleTo get the last hourglass in model m: var n = Hourglass.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free hourglass label in the model. Also see Hourglass.FirstFreeLabel(), Hourglass.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free hourglass 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.
ReturnsHourglass label. Return typeNumber |
ExampleTo get the last free hourglass label in model m: var label = Hourglass.LastFreeLabel(m);
|
Next()DescriptionReturns the next hourglass in the model. |
No arguments
ReturnsHourglass object (or null if there are no more hourglasses in the model). Return typeHourglass |
ExampleTo get the hourglass in model m after hourglass n: var n = n.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) hourglass label in the model. Also see Hourglass.FirstFreeLabel(), Hourglass.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free hourglass 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).
ReturnsHourglass label. Return typeNumber |
ExampleTo get the next free hourglass label in model m: var label = Hourglass.NextFreeLabel(m);
|
Previous()DescriptionReturns the previous hourglass in the model. |
No arguments
ReturnsHourglass object (or null if there are no more hourglasses in the model). Return typeHourglass |
ExampleTo get the hourglass in model m before hourglass n: var n = n.Previous();
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the hourglasses in the model. |
Model that all hourglasses will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the hourglasses in model m, from 1000000: Hourglass.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged hourglasses in the model. |
Model that all the flagged hourglasses will be renumbered in
Flag set on the hourglasses that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the hourglasses in model m flagged with f, from 1000000: Hourglass.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select hourglasses using standard PRIMER object menus. |
Flag to use when selecting hourglasses
Text to display as a prompt to the user
If the argument is a Model then only hourglasses from that model can be selected. If the argument is a Flag then only hourglasses that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any hourglasses 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 hourglasses selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the hourglass. |
Flag to set on the hourglass
ReturnsNo return value |
ExampleTo set flag f for hourglass n: n.SetFlag(f);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of hourglasses in the model. |
Model to get total for
true if only existing hourglasses should be counted. If false or omitted referenced but undefined hourglasses will also be included in the total.
Returnsnumber of hourglasses Return typeNumber |
ExampleTo get the total number of hourglasses in model m: var total = Hourglass.Total(m);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the hourglasses in the model. |
Model that the defined flag for all hourglasses will be unset in
Flag to unset on the hourglasses
ReturnsNo return value |
ExampleTo unset the flag f on all the hourglasses in model m: Hourglass.UnflagAll(m, f);
|
No arguments
ReturnsHourglass object. Return typeHourglass |
ExampleTo check if Hourglass property n.example is a parameter by using the Hourglass.GetParameter() method: if (n.ViewParameters().GetParameter(n.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for hourglass. 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 hourglass n: n.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this hourglass. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for hourglass n: var xrefs = n.Xrefs();
|
toString()DescriptionCreates a string containing the hourglass data in keyword format. Note that this contains the keyword header and the keyword cards. See also Hourglass.Keyword() and Hourglass.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for hourglass h in keyword format var s = h.toString();
|