The GeometrySurface class gives you access to surfaces 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 surface exists, false if referred to but not defined. |
| id (read only) | integer | GeometrySurface number. Also see the label property which is an alternative name for this. |
| include | integer | The Include file number that the surface is in. |
| label (read only) | integer | GeometrySurface number. Also see the id property which is an alternative name for this. |
| model (read only) | integer | The Model number that the surface is in. |
Detailed DescriptionThe GeometrySurface class allows you to create, modify, edit and manipulate surfaces cards. See the documentation below for more details. |
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a surface. |
Comment that will be attached to the surface
ReturnsNo return value |
ExampleTo associate comment c to the surface s: s.AssociateComment(c);
|
Blank()DescriptionBlanks the surface |
No arguments
ReturnsNo return value |
ExampleTo blank surface s: s.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the surfaces in the model. |
Model that all surfaces 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 surfaces in model m: GeometrySurface.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged surfaces in the model. |
Model that all the flagged surfaces will be blanked in
Flag set on the surfaces 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 surfaces in model m flagged with f: GeometrySurface.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the surface is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if surface s is blanked: if (s.Blanked() ) do_something...
|
CalculateNormal(u[real], y[real])DescriptionCalculate the normal vector for a parametric point on a surface. |
u parametric coordinate
v parametric coordinate
ReturnsArray containing x, y and z values. Return typeArray |
ExampleTo obtain the surface normal at parametric point (0.2, 0.3) on surface s: var coords = s.CalculateNormal(0.2, 0.3);
|
CalculatePoint(u[real], v[real])DescriptionCalculate the X, Y and Z coordinates for a parametric point on a surface. |
u parametric coordinate
v parametric coordinate
ReturnsArray containing x, y and z values. Return typeArray |
ExampleTo obtain the coordinates of parametric point (0.2, 0.3) on surface s: var coords = s.CalculatePoint(0.2, 0.3);
|
ClearFlag(flag[Flag])DescriptionClears a flag on the surface. |
Flag to clear on the surface
ReturnsNo return value |
ExampleTo clear flag f for surface s: s.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the surface. The target include of the copied surface 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().
ReturnsGeometrySurface object Return typeGeometrySurface |
ExampleTo copy surface s into surface z: var z = s.Copy();
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a surface. |
Comment that will be detached from the surface
ReturnsNo return value |
ExampleTo detach comment c from the surface s: s.DetachComment(c);
|
Error(message[string], details (optional)[string])DescriptionAdds an error for surface. 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 surface s: s.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first surface in the model. |
Model to get first surface in
ReturnsGeometrySurface object (or null if there are no surfaces in the model). Return typeGeometrySurface |
ExampleTo get the first surface in model m: var s = GeometrySurface.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free surface label in the model. Also see GeometrySurface.LastFreeLabel(), GeometrySurface.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free surface 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).
ReturnsGeometrySurface label. Return typeNumber |
ExampleTo get the first free surface label in model m: var label = GeometrySurface.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the surfaces in the model with a defined flag. |
Model that all surfaces will be flagged in
Flag to set on the surfaces
ReturnsNo return value |
ExampleTo flag all of the surfaces with flag f in model m: GeometrySurface.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the surface is flagged or not. |
Flag to test on the surface
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if surface s has flag f set on it: if (s.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each surface in the model. |
Model that all surfaces are in
Function to call for each surface
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 GeometrySurface objects or properties for all of the surfaces in a model in PRIMER. If the optional property argument is not given then an array of GeometrySurface objects is returned. If the property argument is given, that property value for each surface is returned in the array instead of a GeometrySurface object |
Model to get surfaces from
Name for property to get for all surfaces in the model
ReturnsArray of GeometrySurface objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a surface. |
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 surface s: var comm_array = s.GetComments();
|
GetEdgeIndices()DescriptionReturn an array of all the edge indices for a surface (in pairs). |
No arguments
ReturnsArray of indices Return typeArray |
ExampleTo get edge indices for surface s var edges = s.GetEdgeIndices();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of GeometrySurface objects for all of the flagged surfaces in a model in PRIMER If the optional property argument is not given then an array of GeometrySurface objects is returned. If the property argument is given, then that property value for each surface is returned in the array instead of a GeometrySurface object |
Model to get surfaces from
Flag set on the surfaces that you want to retrieve
Name for property to get for all flagged surfaces in the model
ReturnsArray of GeometrySurface objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the GeometrySurface object for a surface ID. |
Model to find the surface in
number of the surface you want the GeometrySurface object for
ReturnsGeometrySurface object (or null if surface does not exist). Return typeGeometrySurface |
ExampleTo get the GeometrySurface object for surface 100 in model m var s = GeometrySurface.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a GeometrySurface 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 GeometrySurface.ViewParameters() method and 'method chaining' (see the examples below). |
surface property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetTriaIndices()DescriptionReturn an array of all the tria indices for a surface (in triplets). |
No arguments
ReturnsArray of indices Return typeArray |
ExampleTo get tria indices for surface s var trias = s.GetTriaIndices();
|
GetVertices()DescriptionReturn an array of all the vertex coordinates for a surface (in triplets). |
No arguments
ReturnsArray of indices Return typeArray |
ExampleTo get vertex coordinates for surface s var vertices = s.GetVertices();
|
Last(Model[Model]) [static]DescriptionReturns the last surface in the model. |
Model to get last surface in
ReturnsGeometrySurface object (or null if there are no surfaces in the model). Return typeGeometrySurface |
ExampleTo get the last surface in model m: var s = GeometrySurface.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free surface label in the model. Also see GeometrySurface.FirstFreeLabel(), GeometrySurface.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free surface 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.
ReturnsGeometrySurface label. Return typeNumber |
ExampleTo get the last free surface label in model m: var label = GeometrySurface.LastFreeLabel(m);
|
Next()DescriptionReturns the next surface in the model. |
No arguments
ReturnsGeometrySurface object (or null if there are no more surfaces in the model). Return typeGeometrySurface |
ExampleTo get the surface in model m after surface s: var s = s.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) surface label in the model. Also see GeometrySurface.FirstFreeLabel(), GeometrySurface.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free surface 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).
ReturnsGeometrySurface label. Return typeNumber |
ExampleTo get the next free surface label in model m: var label = GeometrySurface.NextFreeLabel(m);
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a surface. |
Text to display as a prompt to the user
If the argument is a Model then only surfaces from that model can be picked. If the argument is a Flag then only surfaces that are flagged with limit can be selected. If omitted, or null, any surfaces 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.
ReturnsGeometrySurface object (or null if not picked) Return typeGeometrySurface |
ExampleTo pick a surface from model m giving the prompt 'Pick surface from screen': var s = GeometrySurface.Pick('Pick surface from screen', m);
|
Previous()DescriptionReturns the previous surface in the model. |
No arguments
ReturnsGeometrySurface object (or null if there are no more surfaces in the model). Return typeGeometrySurface |
ExampleTo get the surface in model m before surface s: var s = s.Previous();
|
ProjectPoint(x[real], y[real], z[real])DescriptionProject a point onto the surface. |
X coordinate of point to project
Y coordinate of point to project
Z coordinate of point to project
ReturnsArray containing u and v values. Return typeArray |
ExampleTo obtain the projection of point (1, 2, 3) on to surface s: var projection = s.ProjectPoint(1, 2, 3);
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the surfaces in the model. |
Model that all surfaces will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the surfaces in model m, from 1000000: GeometrySurface.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged surfaces in the model. |
Model that all the flagged surfaces will be renumbered in
Flag set on the surfaces that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the surfaces in model m flagged with f, from 1000000: GeometrySurface.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select surfaces using standard PRIMER object menus. |
Flag to use when selecting surfaces
Text to display as a prompt to the user
If the argument is a Model then only surfaces from that model can be selected. If the argument is a Flag then only surfaces that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any surfaces 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 surfaces selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the surface. |
Flag to set on the surface
ReturnsNo return value |
ExampleTo set flag f for surface s: s.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the surface. The surface will be sketched until you either call GeometrySurface.Unsketch(), GeometrySurface.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the surface is sketched. If omitted redraw is true. If you want to sketch several surfaces and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch surface s: s.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged surfaces in the model. The surfaces will be sketched until you either call GeometrySurface.Unsketch(), GeometrySurface.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged surfaces will be sketched in
Flag set on the surfaces that you want to sketch
If model should be redrawn or not after the surfaces are sketched. If omitted redraw is true. If you want to sketch flagged surfaces several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all surfaces flagged with flag in model m: GeometrySurface.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of surfaces in the model. |
Model to get total for
true if only existing surfaces should be counted. If false or omitted referenced but undefined surfaces will also be included in the total.
Returnsnumber of surfaces Return typeNumber |
ExampleTo get the total number of surfaces in model m: var total = GeometrySurface.Total(m);
|
Unblank()DescriptionUnblanks the surface |
No arguments
ReturnsNo return value |
ExampleTo unblank surface s: s.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the surfaces in the model. |
Model that all surfaces 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 surfaces in model m: GeometrySurface.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged surfaces in the model. |
Model that the flagged surfaces will be unblanked in
Flag set on the surfaces 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 surfaces in model m flagged with f: GeometrySurface.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the surfaces in the model. |
Model that the defined flag for all surfaces will be unset in
Flag to unset on the surfaces
ReturnsNo return value |
ExampleTo unset the flag f on all the surfaces in model m: GeometrySurface.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the surface. |
If model should be redrawn or not after the surface is unsketched. If omitted redraw is true. If you want to unsketch several surfaces and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch surface s: s.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all surfaces. |
Model that all surfaces will be unblanked in
If model should be redrawn or not after the surfaces 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 surfaces in model m: GeometrySurface.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged surfaces in the model. |
Model that all surfaces will be unsketched in
Flag set on the surfaces that you want to unsketch
If model should be redrawn or not after the surfaces 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 surfaces flagged with flag in model m: GeometrySurface.UnsketchAll(m, flag);
|
No arguments
ReturnsGeometrySurface object. Return typeGeometrySurface |
ExampleTo check if GeometrySurface property s.example is a parameter by using the GeometrySurface.GetParameter() method: if (s.ViewParameters().GetParameter(s.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for surface. 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 surface s: s.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this surface. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for surface s: var xrefs = s.Xrefs();
|