The MassPart class gives you access to element mass part 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 | Description |
| MassPart.PART | Element is *ELEMENT_MASS_PART. |
| MassPart.SET | Element is *ELEMENT_MASS_PART_SET. |
| Name | Type | Description |
| addmass | real | Added translational mass to be distributed to the nodes of the part or part set ID. |
| colour | Colour | The colour of the mass part |
| exists (read only) | logical | true if element mass part exists, false if referred to but not defined. |
| finmass | real | Final translational mass of the part or part set ID. |
| id | integer | Part or part set ID if the SET option is active. |
| include | integer | The Include file number that the element mass part is in. |
| lcid | integer | Optional load curve ID to scale the added mass at time = 0. |
| model (read only) | integer | The Model number that the element mass part is in. |
| mwd | integer | Optional flag for mass-weighted distribution. |
| option | constant | The Element Mass Part option. Can be MassPart.PART or MassPart.SET |
| transparency | integer | The transparency of the mass part (0-100) 0% is opaque, 100% is transparent. |
Detailed DescriptionThe MassPart class allows you to create, modify, edit and manipulate element mass part cards. See the documentation below for more details. |
Constructornew MassPart(Model[Model], option[constant], id[integer], addmass (optional)[real], finmass (optional)[real])DescriptionCreate a new MassPart object. |
Model that mass part will be created in
Suffix for element mass part. Can be MassPart.PART or MassPart.SET.
Part or part set ID.
Added translational mass.
Final translational mass.
ReturnsMassPart object Return typeMassPart |
ExampleTo create a new element mass part in model m with option _<BLANK> and part ID 10: var mp = new MassPart(m, MassPart.PART, 10);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a element mass part. |
Comment that will be attached to the element mass part
ReturnsNo return value |
ExampleTo associate comment c to the element mass part mp: mp.AssociateComment(c);
|
Blank()DescriptionBlanks the element mass part |
No arguments
ReturnsNo return value |
ExampleTo blank element mass part mp: mp.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the element mass parts in the model. |
Model that all element mass parts 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 element mass parts in model m: MassPart.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged element mass parts in the model. |
Model that all the flagged element mass parts will be blanked in
Flag set on the element mass parts 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 element mass parts in model m flagged with f: MassPart.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the element mass part is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if element mass part mp is blanked: if (mp.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 element mass part mp: mp.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the element mass part. |
Flag to clear on the element mass part
ReturnsNo return value |
ExampleTo clear flag f for element mass part mp: mp.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the element mass part. The target include of the copied element mass part 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().
ReturnsMassPart object Return typeMassPart |
ExampleTo copy element mass part mp into element mass part z: var z = mp.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a element mass part |
Model that the element mass part 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.
ReturnsMassPart object (or null if not made). Return typeMassPart |
ExampleTo start creating a element mass part in model m: var mp = MassPart.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a element mass part. |
Comment that will be detached from the element mass part
ReturnsNo return value |
ExampleTo detach comment c from the element mass part mp: mp.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 element mass part mp: mp.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for element mass part. 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 element mass part mp: mp.Error("My custom error");
|
ExtractColour()DescriptionExtracts the actual colour used for element mass part. |
No arguments
Returnscolour value (integer) Return typeNumber |
ExampleTo return the colour used for drawing element mass part mp: var colour = mp.ExtractColour();
|
First(Model[Model]) [static]DescriptionReturns the first element mass part in the model. |
Model to get first element mass part in
ReturnsMassPart object (or null if there are no element mass parts in the model). Return typeMassPart |
ExampleTo get the first element mass part in model m: var mp = MassPart.First(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the element mass parts in the model with a defined flag. |
Model that all element mass parts will be flagged in
Flag to set on the element mass parts
ReturnsNo return value |
ExampleTo flag all of the element mass parts with flag f in model m: MassPart.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the element mass part is flagged or not. |
Flag to test on the element mass part
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if element mass part mp has flag f set on it: if (mp.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each element mass part in the model. |
Model that all element mass parts are in
Function to call for each element mass part
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 MassPart objects or properties for all of the element mass parts in a model in PRIMER. If the optional property argument is not given then an array of MassPart objects is returned. If the property argument is given, that property value for each element mass part is returned in the array instead of a MassPart object |
Model to get element mass parts from
Name for property to get for all element mass parts in the model
ReturnsArray of MassPart objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a element mass part. |
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 element mass part mp: var comm_array = mp.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of MassPart objects for all of the flagged element mass parts in a model in PRIMER If the optional property argument is not given then an array of MassPart objects is returned. If the property argument is given, then that property value for each element mass part is returned in the array instead of a MassPart object |
Model to get element mass parts from
Flag set on the element mass parts that you want to retrieve
Name for property to get for all flagged element mass parts in the model
ReturnsArray of MassPart objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the MassPart object for a element mass part ID. |
Model to find the element mass part in
number of the element mass part you want the MassPart object for
ReturnsMassPart object (or null if element mass part does not exist). Return typeMassPart |
ExampleTo get the MassPart object for element mass part 100 in model m var mp = MassPart.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a MassPart 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 MassPart.ViewParameters() method and 'method chaining' (see the examples below). |
element mass part property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
Keyword()DescriptionReturns the keyword for this mass part (*ELEMENT_MASS_PART) Note that a carriage return is not added. See also MassPart.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for mass part mp: var key = mp.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the mass part. Note that a carriage return is not added. See also MassPart.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for mass part mp: var cards = mp.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last element mass part in the model. |
Model to get last element mass part in
ReturnsMassPart object (or null if there are no element mass parts in the model). Return typeMassPart |
ExampleTo get the last element mass part in model m: var mp = MassPart.Last(m);
|
Next()DescriptionReturns the next element mass part in the model. |
No arguments
ReturnsMassPart object (or null if there are no more element mass parts in the model). Return typeMassPart |
ExampleTo get the element mass part in model m after element mass part mp: var mp = mp.Next();
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a element mass part. |
Text to display as a prompt to the user
If the argument is a Model then only element mass parts from that model can be picked. If the argument is a Flag then only element mass parts that are flagged with limit can be selected. If omitted, or null, any element mass parts 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.
ReturnsMassPart object (or null if not picked) Return typeMassPart |
ExampleTo pick a element mass part from model m giving the prompt 'Pick element mass part from screen': var mp = MassPart.Pick('Pick element mass part from screen', m);
|
Previous()DescriptionReturns the previous element mass part in the model. |
No arguments
ReturnsMassPart object (or null if there are no more element mass parts in the model). Return typeMassPart |
ExampleTo get the element mass part in model m before element mass part mp: var mp = mp.Previous();
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select element mass parts using standard PRIMER object menus. |
Flag to use when selecting element mass parts
Text to display as a prompt to the user
If the argument is a Model then only element mass parts from that model can be selected. If the argument is a Flag then only element mass parts that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any element mass parts 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 element mass parts selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the element mass part. |
Flag to set on the element mass part
ReturnsNo return value |
ExampleTo set flag f for element mass part mp: mp.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the element mass part. The element mass part will be sketched until you either call MassPart.Unsketch(), MassPart.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the element mass part is sketched. If omitted redraw is true. If you want to sketch several element mass parts and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch element mass part mp: mp.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged element mass parts in the model. The element mass parts will be sketched until you either call MassPart.Unsketch(), MassPart.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged element mass parts will be sketched in
Flag set on the element mass parts that you want to sketch
If model should be redrawn or not after the element mass parts are sketched. If omitted redraw is true. If you want to sketch flagged element mass parts several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all element mass parts flagged with flag in model m: MassPart.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of element mass parts in the model. |
Model to get total for
true if only existing element mass parts should be counted. If false or omitted referenced but undefined element mass parts will also be included in the total.
Returnsnumber of element mass parts Return typeNumber |
ExampleTo get the total number of element mass parts in model m: var total = MassPart.Total(m);
|
Unblank()DescriptionUnblanks the element mass part |
No arguments
ReturnsNo return value |
ExampleTo unblank element mass part mp: mp.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the element mass parts in the model. |
Model that all element mass parts 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 element mass parts in model m: MassPart.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged element mass parts in the model. |
Model that the flagged element mass parts will be unblanked in
Flag set on the element mass parts 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 element mass parts in model m flagged with f: MassPart.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the element mass parts in the model. |
Model that the defined flag for all element mass parts will be unset in
Flag to unset on the element mass parts
ReturnsNo return value |
ExampleTo unset the flag f on all the element mass parts in model m: MassPart.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the element mass part. |
If model should be redrawn or not after the element mass part is unsketched. If omitted redraw is true. If you want to unsketch several element mass parts and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch element mass part mp: mp.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all element mass parts. |
Model that all element mass parts will be unblanked in
If model should be redrawn or not after the element mass parts 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 element mass parts in model m: MassPart.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged element mass parts in the model. |
Model that all element mass parts will be unsketched in
Flag set on the element mass parts that you want to unsketch
If model should be redrawn or not after the element mass parts 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 element mass parts flagged with flag in model m: MassPart.UnsketchAll(m, flag);
|
No arguments
ReturnsMassPart object. Return typeMassPart |
ExampleTo check if MassPart property mp.example is a parameter by using the MassPart.GetParameter() method: if (mp.ViewParameters().GetParameter(mp.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for element mass part. 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 element mass part mp: mp.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this element mass part. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for element mass part mp: var xrefs = mp.Xrefs();
|
toString()DescriptionCreates a string containing the mass part data in keyword format. Note that this contains the keyword header and the keyword cards. See also MassPart.Keyword() and MassPart.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for mass part mp in keyword format var str = mp.toString();
|