Oasys.PRIMER.CrossSection class¶
Constants¶
Properties¶
- property CrossSection.colour: Colour¶
The colour of the cross section
- property CrossSection.csid: integer¶
Database cross section number (identical to label)
- property CrossSection.dsid: integer¶
Discrete set
number
- property CrossSection.exists(read only): boolean¶
true if database cross section exists, false if referred to but not defined
- property CrossSection.heading: string¶
Database cross section heading
- property CrossSection.id: integer¶
Rigid part
or accelerometer orcoordinate system
number
- property CrossSection.idset: boolean¶
true if _ID option is set, false if not
- property CrossSection.include: integer¶
The
Include
file number that the database cross section is in
- property CrossSection.itype: integer¶
Flag for local system type
- property CrossSection.label: integer¶
Database cross section number
- property CrossSection.lenl: float¶
Length of L edge
- property CrossSection.lenm: float¶
Length of M edge
- property CrossSection.option: constant¶
The Database CrossSection option. Can be:
CrossSection.PLANE
orCrossSection.SET
- property CrossSection.radius: float¶
Radius
- property CrossSection.tsid: integer¶
Thick shell set
number
- property CrossSection.xch: float/integer¶
Head X coord of N normal vector. If <radius> is negative <xch> is a node ID which, combined with <xct>, defines the normal vector of the cut plane
- property CrossSection.xct: float/integer¶
Tail X coord of N normal vector. If <radius> is negative <xct> is a node ID whose coordinates define the centre of the circular cut plane
- property CrossSection.xhev: float¶
Head X coord of L edge vector
- property CrossSection.ych: float¶
Head Y coord of N normal vector
- property CrossSection.yct: float¶
Tail Y coord of N normal vector
- property CrossSection.yhev: float¶
Head Y coord of L edge vector
- property CrossSection.zch: float¶
Head Z coord of N normal vector
- property CrossSection.zct: float¶
Tail Z coord of N normal vector
- property CrossSection.zhev: float¶
Head Z coord of L edge vector
Constructor¶
- classmethod CrossSection(model, option, settings)¶
Create a new
CrossSection
object
- Parameters:
model (Model) –
Model
that database cross section will be created inoption (constant) – Database cross section type. Must be CrossSection.SET or CrossSection.PLANE
settings (dict) –
Options specifying various properties used to create the keyword. If optional values are not specified then their default values will be used
- autosize (optional) (PLANE only):
(boolean) true if the Database cross_section is to be autosized
- autosize_pct (optional) (PLANE only):
(real) Additional post-autosize scaling percentage. (default: same as value specified by the preference primer*cross_section_auto_size_percent)
- bsid (SET only):
(integer) Beam set number
- csid (optional):
(integer) Database cross_section number
- dsid (SET only):
(integer) Discrete set number
- heading (optional):
(string) Database cross_section title
- hsid (SET only):
(integer) Solid set number
- id (optional):
(integer)
Rigid part
or accelerometer orcoordinate system
number- itype (optional):
(integer) Flag for local system type
- lenl (optional) (PLANE only):
(float) Length in l direction
- lenm (optional) (PLANE only):
(float) Length in m direction
- nsid (SET only):
(integer) Node set number
- psid (PLANE only):
(integer) Part set number
- ssid (SET only):
(integer) Shell set number
- tsid (SET only):
(integer) Thick shell set number
- vis_only (optional) (PLANE only):
(real) true if autosizing should ignore non-visible elements, false otherwise. (default: true)
- xch (PLANE only):
(float) X coordinate of head of normal vector
- xct (PLANE only):
(float) X coordinate of tail of normal vector
- xhev (PLANE only):
(float) X coordinate of head of edge vector
- ych (PLANE only):
(float) Y coordinate of head of normal vector
- yct (PLANE only):
(float) Y coordinate of tail of normal vector
- yhev (PLANE only):
(float) Y coordinate of head of edge vector
- zch (PLANE only):
(float) Z coordinate of head of normal vector
- zct (PLANE only):
(float) Z coordinate of tail of normal vector
- zhev (PLANE only):
(float) Z coordinate of head of edge vector
- Returns:
CrossSection object
- Return type:
dict
Example
To create a new Database cross section 500 called “test cross_section” of type _SET in model m with nsid, hsid, bsid, ssid, tsid, dsid, id, itype set to 11, 12, 13, 14, 15, 16, 17, 2 respectively:
settings = { "nsid": 11, "hsid": 12, "bsid": 13, "ssid": 14, "tsid": 15, "dsid": 16, "id": 17, "itype": 2, "heading": "test_cross_section" } c = Oasys.PRIMER.CrossSection(m, Oasys.PRIMER.CrossSection.SET, settings)To create a new Database cross section 500 called “test cross_section” of type _PLANE in model m with part set ID 100, normal tail (10, 20, 30), normal head (20, 20, 30), head of edge vector (10, 30, 30) and edge lengths 50 and 100:
settings = { "psid": 100, "id": 500, "heading": "test cross_section", "xct": 10, "yct": 20, "zct": 30, "xch": 20, "ych": 20, "zch": 30, "xhev": 10, "yhev": 30, "zhev": 30, "lenl": 50, "lenm": 100 } c = Oasys.PRIMER.CrossSection(m, Oasys.PRIMER.CrossSection.PLANE, settings)
Static methods¶
- classmethod CrossSection.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the cross sections in the model
- Parameters:
model (Model) –
Model
that all cross sections will be blanked inredraw (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 cross sections in model m:
Oasys.PRIMER.CrossSection.BlankAll(m)
- classmethod CrossSection.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged cross sections in the model
- Parameters:
model (Model) –
Model
that all the flagged cross sections will be blanked inflag (Flag) – Flag set on the cross sections 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 cross sections in model m flagged with f:
Oasys.PRIMER.CrossSection.BlankFlagged(m, f)
- classmethod CrossSection.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a cross_section
- Parameters:
model (Model) –
Model
that the cross_section will be created inmodal (boolean) – Optional. 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
- Returns:
CrossSection object (or None if not made)
- Return type:
dict
Example
To start creating a cross section in model m:
c = Oasys.PRIMER.CrossSection.Create(m)
- classmethod CrossSection.CreateAlongFeatureLine(model, nid1, options)¶
Creates a set of cross sections along a feature line and returns them as a list of CrossSection objects. Use
Options
.edge_angle to control the break angle for the feature line search within this function
- Parameters:
model (Model) –
Model
that the cross_section will be created innid1 (integer) – ID of feature line starting node. The first cross section will be created at this Node’s location
options (dict) –
Additional arguments for controlling how the cross sections are created
- autosize (optional):
(boolean) true if cross sections are to be autosized. lenl and lenm will be ignored if set
- autosize_pct (optional):
(real) If autosize is true, cross sections will be scaled by this additional percentage after being autosized. (default: same as value specified by the preference primer*cross_section_auto_size_percent)
- direction (optional):
(integer) Direction along feature line to create cross sections. +1 for positive direction (default), -1 for negative direction. Ignored for two node method (nid2 set)
- lenl:
(real) Side length of plane along L vector - non-circular cross sections only
- lenm:
(real) Side length of plane along M vector - non-circular cross sections only
- nid2 (optional):
(integer) ID of feature line ending node, can be the same as nid1. If provided, cross sections will be created between the nodes nid1 and nid2 along the shortest feature line path
- num:
(integer) Number of cross sections to be created. Required for single node method. For two node method either num or pitch must be specified. For two node method, the last cross section will be created at the location of node nid2 (provided nid1 != nid2)
- pitch:
(real) Separation between adjacent cross sections. Required for single node method. For two node method either num or pitch must be specified
- psid (optional):
(integer) ID of part set
- radius (optional):
(real) Radius of circular cross section
- vis_only (optional):
(boolean) If true, and autosize is true, autosizing will ignore non-visible cut elements, false otherwise (default: true)
- Returns:
List of CrossSection objects (or None if not made). Depending on the geometry of the model and the node provided for nid1, the list may contain less CrossSection objects than requested for the single node method
- Return type:
list
Example
To create 10 autosized cross sections, separated by 15.0, in the positive direction, starting at Node 1:
options = { "num": 10, "pitch": 15.0, "direction": 1, "autosize": True } xsec_list = Oasys.PRIMER.CrossSection.CreateAlongFeatureLine(m, 1, options)To create 5 circular cross sections, of radius 25.0, around an entire perimeter edge (starting at Node 2):
options = { "num": 5, "nid2": 2, "radius": 25.0 } xsec_list = Oasys.PRIMER.CrossSection.CreateAlongFeatureLine(m, 2, options)To create a set of cross sections separated by 10.0, of size 50.0 x 50.0, between nodes 3 and 4 (starting at Node 3):
options = { "pitch": 10.0, "lenm": 50.0, "lenl": 50.0, "nid2": 4 } xsec_list = Oasys.PRIMER.CrossSection.CreateAlongFeatureLine(m, 3, options)
- classmethod CrossSection.First(model)¶
Returns the first cross section in the model
- Parameters:
model (Model) –
Model
to get first cross section in- Returns:
CrossSection object (or None if there are no cross sections in the model)
- Return type:
CrossSection
Example
To get the first cross section in model m:
c = Oasys.PRIMER.CrossSection.First(m)
- classmethod CrossSection.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free cross section label in the model. Also see
CrossSection.LastFreeLabel()
,CrossSection.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
CrossSection label
- Return type:
int
Example
To get the first free cross section label in model m:
label = Oasys.PRIMER.CrossSection.FirstFreeLabel(m)
- classmethod CrossSection.FlagAll(model, flag)¶
Flags all of the cross sections in the model with a defined flag
- Parameters:
model (Model) –
Model
that all cross sections will be flagged inflag (Flag) – Flag to set on the cross sections
- Returns:
No return value
- Return type:
None
Example
To flag all of the cross sections with flag f in model m:
Oasys.PRIMER.CrossSection.FlagAll(m, f)
- classmethod CrossSection.GetAll(model)¶
Returns a list of CrossSection objects for all of the cross sections in a model in PRIMER
- Parameters:
model (Model) –
Model
to get cross sections from- Returns:
List of CrossSection objects
- Return type:
list
Example
To make a list of CrossSection objects for all of the cross sections in model m
c = Oasys.PRIMER.CrossSection.GetAll(m)
- classmethod CrossSection.GetFlagged(model, flag)¶
Returns a list of CrossSection objects for all of the flagged cross sections in a model in PRIMER
- Parameters:
model (Model) –
Model
to get cross sections fromflag (Flag) – Flag set on the cross sections that you want to retrieve
- Returns:
List of CrossSection objects
- Return type:
list
Example
To make a list of CrossSection objects for all of the cross sections in model m flagged with f
c = Oasys.PRIMER.CrossSection.GetFlagged(m, f)
- classmethod CrossSection.GetFromID(model, number)¶
Returns the CrossSection object for a cross section ID
- Parameters:
model (Model) –
Model
to find the cross section innumber (integer) – number of the cross section you want the CrossSection object for
- Returns:
CrossSection object (or None if cross section does not exist)
- Return type:
CrossSection
Example
To get the CrossSection object for cross section 100 in model m
c = Oasys.PRIMER.CrossSection.GetFromID(m, 100)
- classmethod CrossSection.Last(model)¶
Returns the last cross section in the model
- Parameters:
model (Model) –
Model
to get last cross section in- Returns:
CrossSection object (or None if there are no cross sections in the model)
- Return type:
CrossSection
Example
To get the last cross section in model m:
c = Oasys.PRIMER.CrossSection.Last(m)
- classmethod CrossSection.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free cross section label in the model. Also see
CrossSection.FirstFreeLabel()
,CrossSection.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
CrossSection label
- Return type:
int
Example
To get the last free cross section label in model m:
label = Oasys.PRIMER.CrossSection.LastFreeLabel(m)
- classmethod CrossSection.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) cross section label in the model. Also see
CrossSection.FirstFreeLabel()
,CrossSection.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
CrossSection label
- Return type:
int
Example
To get the next free cross section label in model m:
label = Oasys.PRIMER.CrossSection.NextFreeLabel(m)
- classmethod CrossSection.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a cross section
- 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 cross sections from that model can be picked. If the argument is aFlag
then only cross sections that are flagged with limit can be selected. If omitted, or None, any cross sections from any model can be selected. from any modelmodal (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:
CrossSection object (or None if not picked)
- Return type:
dict
Example
To pick a cross section from model m giving the prompt ‘Pick cross section from screen’:
c = Oasys.PRIMER.CrossSection.Pick('Pick cross section from screen', m)
- classmethod CrossSection.RenumberAll(model, start)¶
Renumbers all of the cross sections in the model
- Parameters:
model (Model) –
Model
that all cross sections will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the cross sections in model m, from 1000000:
Oasys.PRIMER.CrossSection.RenumberAll(m, 1000000)
- classmethod CrossSection.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged cross sections in the model
- Parameters:
model (Model) –
Model
that all the flagged cross sections will be renumbered inflag (Flag) – Flag set on the cross sections that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the cross sections in model m flagged with f, from 1000000:
Oasys.PRIMER.CrossSection.RenumberFlagged(m, f, 1000000)
- classmethod CrossSection.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select cross sections using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting cross sections
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only cross sections from that model can be selected. If the argument is aFlag
then only cross sections that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any cross sections can be selected. from any modelmodal (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 cross sections selected or None if menu cancelled
- Return type:
int
Example
To select cross sections from model m, flagging those selected with flag f, giving the prompt ‘Select cross sections’:
Oasys.PRIMER.CrossSection.Select(f, 'Select cross sections', m)To select cross sections, flagging those selected with flag f but limiting selection to cross sections flagged with flag l, giving the prompt ‘Select cross sections’:
Oasys.PRIMER.CrossSection.Select(f, 'Select cross sections', l)
- classmethod CrossSection.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged cross sections in the model. The cross sections will be sketched until you either call
CrossSection.Unsketch()
,CrossSection.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged cross sections will be sketched inflag (Flag) – Flag set on the cross sections that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the cross sections are sketched. If omitted redraw is true. If you want to sketch flagged cross sections 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 cross sections flagged with flag in model m:
Oasys.PRIMER.CrossSection.SketchFlagged(m, flag)
- classmethod CrossSection.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of cross sections in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing cross sections should be counted. If false or omitted referenced but undefined cross sections will also be included in the total
- Returns:
number of cross sections
- Return type:
int
Example
To get the total number of cross sections in model m:
total = Oasys.PRIMER.CrossSection.Total(m)
- classmethod CrossSection.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the cross sections in the model
- Parameters:
model (Model) –
Model
that all cross sections will be unblanked inredraw (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 cross sections in model m:
Oasys.PRIMER.CrossSection.UnblankAll(m)
- classmethod CrossSection.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged cross sections in the model
- Parameters:
model (Model) –
Model
that the flagged cross sections will be unblanked inflag (Flag) – Flag set on the cross sections 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 cross sections in model m flagged with f:
Oasys.PRIMER.CrossSection.UnblankFlagged(m, f)
- classmethod CrossSection.UnflagAll(model, flag)¶
Unsets a defined flag on all of the cross sections in the model
- Parameters:
model (Model) –
Model
that the defined flag for all cross sections will be unset inflag (Flag) – Flag to unset on the cross sections
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the cross sections in model m:
Oasys.PRIMER.CrossSection.UnflagAll(m, f)
- classmethod CrossSection.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all cross sections
- Parameters:
model (Model) –
Model
that all cross sections will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the cross sections 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 cross sections in model m:
Oasys.PRIMER.CrossSection.UnsketchAll(m)
- classmethod CrossSection.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged cross sections in the model
- Parameters:
model (Model) –
Model
that all cross sections will be unsketched inflag (Flag) – Flag set on the cross sections that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the cross sections 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 cross sections flagged with flag in model m:
Oasys.PRIMER.CrossSection.UnsketchAll(m, flag)
Instance methods¶
- CrossSection.AssociateComment(comment)¶
Associates a comment with a cross section
- Parameters:
comment (Comment) –
Comment
that will be attached to the cross section- Returns:
No return value
- Return type:
None
Example
To associate comment c to the cross section c:
c.AssociateComment(c)
- CrossSection.Autosize(options=Oasys.gRPC.defaultArg)¶
Autosizes a _PLANE cross section such that it cuts through all elements in model/psid along that plane
- Parameters:
options (dict) –
Optional. Object containing additional options
- percentage (optional):
(real) Additional percentage that the autosized cross section will be scaled by. (default: same as value specified by the preference primer*cross_section_auto_size_percent)
- vis_only (optional):
(boolean) If true, autosizing will ignore non-visible cut elements, false otherwise. (default: true)
- Returns:
No return value
- Return type:
None
Example
To autosize a cross section: To autosize a cross section, scaled by an additional 5 percent, and ignoring element visiblity:
xsec = Oasys.PRIMER.CrossSection.GetFromID(m, id) options = { "percentage": 5.0, "vis_only": False } if(xsec.option == Oasys.PRIMER.CrossSection.PLANE): xsec.Autosize(options)
- CrossSection.Blank()¶
Blanks the cross section
- Returns:
No return value
- Return type:
None
Example
To blank cross section c:
c.Blank()
- CrossSection.Blanked()¶
Checks if the cross section is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if cross section c is blanked:
if c.Blanked(): do_something..
- CrossSection.Browse(modal=Oasys.gRPC.defaultArg)¶
Starts an edit panel in Browse mode
- Parameters:
modal (boolean) – Optional. 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
- Returns:
no return value
- Return type:
None
Example
To Browse cross section c:
c.Browse()
- CrossSection.ClearFlag(flag)¶
Clears a flag on the cross section
- Parameters:
flag (Flag) – Flag to clear on the cross section
- Returns:
No return value
- Return type:
None
Example
To clear flag f for cross section c:
c.ClearFlag(f)
- CrossSection.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the cross section. The target include of the copied cross section 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:
CrossSection object
- Return type:
CrossSection
Example
To copy cross section c into cross section z:
z = c.Copy()
- CrossSection.DetachComment(comment)¶
Detaches a comment from a cross section
- Parameters:
comment (Comment) –
Comment
that will be detached from the cross section- Returns:
No return value
- Return type:
None
Example
To detach comment c from the cross section c:
c.DetachComment(c)
- CrossSection.Edit(modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel
- Parameters:
modal (boolean) – Optional. 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
- Returns:
no return value
- Return type:
None
Example
To Edit cross section c:
c.Edit()
- CrossSection.ElemCut(shell_label)¶
Returns coordinates of the intersections between a shell and a database cross section. Note, ElemCut on the Shell class may be quicker
- Parameters:
shell_label (integer) – The label of the shell
- Returns:
A list containing the x1,y1,z1,x2,y2,z2 coordinates of the cut line, or None if it does not cut. Note this function does not check that the shell is in the cross section definition (part set)
- Return type:
list
Example
To get the cut line coordinates between database cross section x and shell 300:
data = x.ElemCut(300)
- CrossSection.ExtractColour()¶
Extracts the actual colour used for cross section.
By default in PRIMER many entities such as elements get their colour automatically from the part that they are in. PRIMER cycles through 13 default colours based on the label of the entity. In this case the cross sectioncolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the cross section
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing cross section c:
colour = c.ExtractColour()
- CrossSection.FlagCut(flag)¶
Flags every element (solid,shell,tshell,beam) cut by the cross section. Note this function does not check that the element is in the cross section definition (part set)
- Parameters:
flag (Flag) – Flag bit
- Returns:
Boolean
- Return type:
bool
Example
To find elements cut by database cross section x:
x.FlagCut(flag)
- CrossSection.Flagged(flag)¶
Checks if the cross section is flagged or not
- Parameters:
flag (Flag) – Flag to test on the cross section
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if cross section c has flag f set on it:
if c.Flagged(f): do_something..
- CrossSection.GetComments()¶
Extracts the comments associated to a cross section
- 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 cross section c:
comm_list = c.GetComments()
- CrossSection.GetParameter(prop)¶
Checks if a CrossSection 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 theCrossSection.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – cross section property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if CrossSection property c.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if c.GetParameter(c.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if CrossSection property c.example is a parameter by using the GetParameter method:
if c.ViewParameters().GetParameter(c.example): do_something..
- CrossSection.Keyword()¶
Returns the keyword for this cross_section (*DATABASE_CROSS_SECTION). Note that a carriage return is not added. See also
CrossSection.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for cross_section c:
key = c.Keyword()
- CrossSection.KeywordCards()¶
Returns the keyword cards for the cross_section. Note that a carriage return is not added. See also
CrossSection.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for cross_section c:
cards = c.KeywordCards()
- CrossSection.Next()¶
Returns the next cross section in the model
- Returns:
CrossSection object (or None if there are no more cross sections in the model)
- Return type:
CrossSection
Example
To get the cross section in model m after cross section c:
c = c.Next()
- CrossSection.PartCut(part_label, flag=Oasys.gRPC.defaultArg)¶
Returns true if cross section is cutting the part, false otherwise. If option flag is active, will flag every element of the part cut by the cross section. Note this function does not check that the part is in the cross section definition (part set)
- Parameters:
part_label (integer) – The label of the part
flag (Flag) – Optional. Optional Flag to flag the element which are cut by the cross section
- Returns:
Boolean
- Return type:
bool
Example
To know if a database cross section x cuts part 300:
x.PartCut(300)
- CrossSection.Previous()¶
Returns the previous cross section in the model
- Returns:
CrossSection object (or None if there are no more cross sections in the model)
- Return type:
CrossSection
Example
To get the cross section in model m before cross section c:
c = c.Previous()
- CrossSection.Properties()¶
Returns an object which describe various cross section properties
- Returns:
Dict with properties
- area:
(real) Area of material sliced by the cut section
- first_yield_axial:
(real) First yield axial force
- first_yield_mxx:
(real) First yield bending moment (Mxx)
- first_yield_myy:
(real) First yield bending moment (Myy)
- fully_plastic_mxx:
(real) Fully plastic bending moment (Mxx)
- fully_plastic_myy:
(real) Fully plastic bending moment (Myy)
- fully_plastic_xf:
(real) X component of equal force axis
- fully_plastic_xf_g:
(real) X component of equal force axis calculated in global coordinates
- fully_plastic_yf:
(real) Fully plastic axial force
- fully_plastic_yf_g:
(real) Y component of equal force axis calculated in global coordinates
- fully_plastic_zf_g:
(real) Z component of equal force axis calculated in global coordinates
- iuu:
(real) Iuu principal second moments (UU - major)
- ivv:
(real) Ivv principal second moments (VV - minor)
- ixx:
(real) Ixx component of second moment of area
- ixy:
(real) Ixy component of second moment of area
- iyy:
(real) Iyy component of second moment of area
- origin_x:
(real) X component of section origin
- origin_y:
(real) Y component of section origin
- origin_z:
(real) Z component of section origin
- theta:
(real) Angle between Ixx and Iuu
- x_comp_axis_x:
(real) X component of X-axis vector
- x_comp_axis_y:
(real) X component of Y-axis vector
- x_comp_axis_z:
(real) X component of Z-axis vector
- xc:
(real) X component of centroid calculated from the first moment of area
- xc_global:
(real) X component of centre of gravity calculated in global coordinates
- xe:
(real) X component of equal area axis
- xe_global:
(real) X component of equal area axis calculated in global coordinates
- y_comp_axis_x:
(real) Y component of x-axis vector
- y_comp_axis_y:
(real) Y component of Y-axis vector
- y_comp_axis_z:
(real) Y component of Z-axis vector
- yc:
(real) Y component of centroid calculated from the first moment of area
- yc_global:
(real) Y component of centre of gravity calculated in global coordinates
- ye:
(real) Y component of equal area axis
- ye_global:
(real) Y component of equal area axis calculated in global coordinates
- z_comp_axis_x:
(real) Z component of X-axis vector
- z_comp_axis_y:
(real) Z component of Y-axis vector
- z_comp_axis_z:
(real) Z component of Z-axis vector
- zc_global:
(real) Z component of centre of gravity calculated in global coordinates
- ze_global:
(real) Z component of equal area axis calculated in global coordinates
- zxx:
(real) Plastic moduli Zxx
- zyy:
(real) Plastic moduli Zyy
- Return type:
dict
Example
To get the cross section properties for section c:
properties = c.Properties() originX = properties["origin_x"] originY = properties["origin_y"] Xc = properties["xc"] Ixx = properties["ixx"] Iuu = properties["iuu"] Theta = properties["theta"] plastic_Mxx = properties["fully_plastic_mxx"]
- CrossSection.SetFlag(flag)¶
Sets a flag on the cross section
- Parameters:
flag (Flag) – Flag to set on the cross section
- Returns:
No return value
- Return type:
None
Example
To set flag f for cross section c:
c.SetFlag(f)
- CrossSection.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the cross section. The cross section will be sketched until you either call
CrossSection.Unsketch()
,CrossSection.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the cross section is sketched. If omitted redraw is true. If you want to sketch several cross sections 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 cross section c:
c.Sketch()
- CrossSection.Unblank()¶
Unblanks the cross section
- Returns:
No return value
- Return type:
None
Example
To unblank cross section c:
c.Unblank()
- CrossSection.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the cross section
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the cross section is unsketched. If omitted redraw is true. If you want to unsketch several cross sections 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 cross section c:
c.Unsketch()
- CrossSection.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:
CrossSection object
- Return type:
dict
Example
To check if CrossSection property c.example is a parameter by using the
CrossSection.GetParameter()
method:if c.ViewParameters().GetParameter(c.example): do_something..
- CrossSection.Xrefs()¶
Returns the cross references for this cross section
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for cross section c:
xrefs = c.Xrefs()