Oasys.PRIMER.GeometrySurface class

Properties

property GeometrySurface.exists(read only): boolean

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

property GeometrySurface.id(read only): integer

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

property GeometrySurface.include: integer

The Include file number that the gsrf is in

property GeometrySurface.label(read only): integer

GeometrySurface number. Also see the id property which is an alternative name for this

property GeometrySurface.model(read only): integer

The Model number that the surface is in

Static methods

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

Blanks all of the surfaces in the model

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

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

Blanks all of the flagged surfaces in the model

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

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

Oasys.PRIMER.GeometrySurface.BlankFlagged(m, f)
classmethod GeometrySurface.First(model)

Returns the first surface in the model

Parameters:

model (Model) – Model to get first surface in

Returns:

GeometrySurface object (or None if there are no surfaces in the model)

Return type:

GeometrySurface

Example

To get the first surface in model m:

s = Oasys.PRIMER.GeometrySurface.First(m)
classmethod GeometrySurface.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

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

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

GeometrySurface label

Return type:

int

Example

To get the first free surface label in model m:

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

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

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

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

Returns:

No return value

Return type:

None

Example

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

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

Returns a list of GeometrySurface objects for all of the surfaces in a model in PRIMER

Parameters:

model (Model) – Model to get surfaces from

Returns:

List of GeometrySurface objects

Return type:

list

Example

To make a list of GeometrySurface objects for all of the surfaces in model m

s = Oasys.PRIMER.GeometrySurface.GetAll(m)
classmethod GeometrySurface.GetFlagged(model, flag)

Returns a list of GeometrySurface objects for all of the flagged surfaces in a model in PRIMER

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

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

Returns:

List of GeometrySurface objects

Return type:

list

Example

To make a list of GeometrySurface objects for all of the surfaces in model m flagged with f

s = Oasys.PRIMER.GeometrySurface.GetFlagged(m, f)
classmethod GeometrySurface.GetFromID(model, number)

Returns the GeometrySurface object for a surface ID

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

  • number (integer) – number of the surface you want the GeometrySurface object for

Returns:

GeometrySurface object (or None if surface does not exist)

Return type:

GeometrySurface

Example

To get the GeometrySurface object for surface 100 in model m

s = Oasys.PRIMER.GeometrySurface.GetFromID(m, 100)
classmethod GeometrySurface.Last(model)

Returns the last surface in the model

Parameters:

model (Model) – Model to get last surface in

Returns:

GeometrySurface object (or None if there are no surfaces in the model)

Return type:

GeometrySurface

Example

To get the last surface in model m:

s = Oasys.PRIMER.GeometrySurface.Last(m)
classmethod GeometrySurface.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

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

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

GeometrySurface label

Return type:

int

Example

To get the last free surface label in model m:

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

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

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

GeometrySurface label

Return type:

int

Example

To get the next free surface label in model m:

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

Allows the user to pick a surface

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 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 None, any surfaces 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:

GeometrySurface object (or None if not picked)

Return type:

dict

Example

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

s = Oasys.PRIMER.GeometrySurface.Pick('Pick surface from screen', m)
classmethod GeometrySurface.RenumberAll(model, start)

Renumbers all of the surfaces in the model

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Renumbers all of the flagged surfaces in the model

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

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

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

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

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

Allows the user to select surfaces using standard PRIMER object menus

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

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

  • limit (Model or Flag) – Optional. 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 None, any surfaces 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 surfaces selected or None if menu cancelled

Return type:

int

Example

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

Oasys.PRIMER.GeometrySurface.Select(f, 'Select surfaces', m)

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

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

Sketches 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

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

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

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To sketch all surfaces flagged with flag in model m:

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

Returns the total number of surfaces in the model

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

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

Returns:

number of surfaces

Return type:

int

Example

To get the total number of surfaces in model m:

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

Unblanks all of the surfaces in the model

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

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

Unblanks all of the flagged surfaces in the model

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

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

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

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

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

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

Returns:

No return value

Return type:

None

Example

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

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

Unsketches all surfaces

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

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To unsketch all surfaces in model m:

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

Unsketches all flagged surfaces in the model

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

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

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To unsketch all surfaces flagged with flag in model m:

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

Instance methods

GeometrySurface.AssociateComment(comment)

Associates a comment with a surface

Parameters:

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

Returns:

No return value

Return type:

None

Example

To associate comment c to the surface s:

s.AssociateComment(c)
GeometrySurface.Blank()

Blanks the surface

Returns:

No return value

Return type:

None

Example

To blank surface s:

s.Blank()
GeometrySurface.Blanked()

Checks if the surface is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if surface s is blanked:

if s.Blanked():
    do_something..
GeometrySurface.CalculateNormal(u, y)

Calculate the normal vector for a parametric point on a surface

Parameters:
  • u (real) – u parametric coordinate

  • y (real) – v parametric coordinate

Returns:

List containing x, y and z values

Return type:

list

Example

To obtain the surface normal at parametric point (0.2, 0.3) on surface s:

coords = s.CalculateNormal(0.2, 0.3)
GeometrySurface.CalculatePoint(u, v)

Calculate the X, Y and Z coordinates for a parametric point on a surface

Parameters:
  • u (real) – u parametric coordinate

  • v (real) – v parametric coordinate

Returns:

List containing x, y and z values

Return type:

list

Example

To obtain the coordinates of parametric point (0.2, 0.3) on surface s:

coords = s.CalculatePoint(0.2, 0.3)
GeometrySurface.ClearFlag(flag)

Clears a flag on the surface

Parameters:

flag (Flag) – Flag to clear on the surface

Returns:

No return value

Return type:

None

Example

To clear flag f for surface s:

s.ClearFlag(f)
GeometrySurface.Copy(range=Oasys.gRPC.defaultArg)

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

GeometrySurface object

Return type:

GeometrySurface

Example

To copy surface s into surface z:

z = s.Copy()
GeometrySurface.DetachComment(comment)

Detaches a comment from a surface

Parameters:

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

Returns:

No return value

Return type:

None

Example

To detach comment c from the surface s:

s.DetachComment(c)
GeometrySurface.Flagged(flag)

Checks if the surface is flagged or not

Parameters:

flag (Flag) – Flag to test on the surface

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if surface s has flag f set on it:

if s.Flagged(f):
    do_something..
GeometrySurface.GetComments()

Extracts the comments associated to a surface

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 surface s:

comm_list = s.GetComments()
GeometrySurface.GetEdgeIndices()

Return a list of all the edge indices for a surface (in pairs)

Returns:

List of indices

Return type:

list

Example

To get edge indices for surface s

edges = s.GetEdgeIndices()
GeometrySurface.GetParameter(prop)

Checks 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)

Parameters:

prop (string) – surface property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if GeometrySurface property s.example is a parameter:

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

To check if GeometrySurface property s.example is a parameter by using the GetParameter method:

if s.ViewParameters().GetParameter(s.example):
    do_something..
GeometrySurface.GetTriaIndices()

Return a list of all the tria indices for a surface (in triplets)

Returns:

List of indices

Return type:

list

Example

To get tria indices for surface s

trias = s.GetTriaIndices()
GeometrySurface.GetVertices()

Return a list of all the vertex coordinates for a surface (in triplets)

Returns:

List of indices

Return type:

list

Example

To get vertex coordinates for surface s

vertices = s.GetVertices()
GeometrySurface.Next()

Returns the next surface in the model

Returns:

GeometrySurface object (or None if there are no more surfaces in the model)

Return type:

GeometrySurface

Example

To get the surface in model m after surface s:

s = s.Next()
GeometrySurface.Previous()

Returns the previous surface in the model

Returns:

GeometrySurface object (or None if there are no more surfaces in the model)

Return type:

GeometrySurface

Example

To get the surface in model m before surface s:

s = s.Previous()
GeometrySurface.ProjectPoint(x, y, z)

Project a point onto the surface

Parameters:
  • x (real) – X coordinate of point to project

  • y (real) – Y coordinate of point to project

  • z (real) – Z coordinate of point to project

Returns:

List containing u and v values

Return type:

list

Example

To obtain the projection of point (1, 2, 3) on to surface s:

projection = s.ProjectPoint(1, 2, 3)
GeometrySurface.SetFlag(flag)

Sets a flag on the surface

Parameters:

flag (Flag) – Flag to set on the surface

Returns:

No return value

Return type:

None

Example

To set flag f for surface s:

s.SetFlag(f)
GeometrySurface.Sketch(redraw=Oasys.gRPC.defaultArg)

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

Parameters:

redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To sketch surface s:

s.Sketch()
GeometrySurface.Unblank()

Unblanks the surface

Returns:

No return value

Return type:

None

Example

To unblank surface s:

s.Unblank()
GeometrySurface.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the surface

Parameters:

redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To unsketch surface s:

s.Unsketch()
GeometrySurface.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:

GeometrySurface object

Return type:

dict

Example

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

if s.ViewParameters().GetParameter(s.example):
    do_something..
GeometrySurface.Xrefs()

Returns the cross references for this surface

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for surface s:

xrefs = s.Xrefs()