Oasys.PRIMER.Xrefs class

Properties

property Xrefs.numtypes(read only): integer

The number of different types that this item is referenced by

property Xrefs.total(read only): integer

The total number of cross references of all types to this item

Instance methods

Xrefs.GetItemID(type, pos)

Returns the ID of the item in the reference list

Parameters:
  • type (string) – The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual)

  • pos (integer) – The position in the list for this item. Note that positions start at 0, not 1

Returns:

ID of item

Return type:

int

Example

To list all of the xrefs for node n:

xrefs = n.Xrefs()
for t in range(xrefs.numtypes):
    type = xrefs.GetType(t)
    num = xrefs.GetTotal(type)
    for ref in range(num):
        id = xrefs.GetItemID(type, ref)
        print(type, " ", id, "\n")
Xrefs.GetItemType(type, pos)

Returns the type of the item in the reference list. This function is only required when trying to look at cross references to *DEFINE_CURVE items. These items are used in a slightly different way in PRIMER (each time a curve is used a ‘LOADCURVE REFERENCE’ structure is created to store things like the units and descriptions of each axis for the curve). If you try to get the cross references for a curve all the references will be of type ‘LOADCURVE REFERENCE’ and numtypes will be 1. GetItemID() will correctly return the ID of the item from the ‘LOADCURVE REFERENCE’ structure but to get the type of the item this function is required

Parameters:
  • type (string) – The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual)

  • pos (integer) – The position in the list for this item. Note that positions start at 0, not 1

Returns:

type of item (String). For every item apart from *DEFINE_CURVE items this will be the same as the type argument

Return type:

str

Example

To list all of the xrefs for Curve c:

xrefs = c.Xrefs()
for t in range(xrefs.numtypes):
    type = xrefs.GetType(t)
    num = xrefs.GetTotal(type)
    for ref in range(num):
        id = xrefs.GetItemID(type, ref)
        itype = xrefs.GetItemType(type, ref)
        print(itype, " ", id, "\n")
Xrefs.GetTotal(type)

Returns the total number of references of a type

Parameters:

type (string) – The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual)

Returns:

Number of refs (integer)

Return type:

int

Example

To find the total number of shell references that node n has:

xrefs = n.Xrefs()
num = xrefs.GetTotal("SHELL")
Xrefs.GetType(n)

Returns the type for

Parameters:

n (integer) – The entry in the reference types that you want the type for. Note that entries start at 0, not 1

Returns:

The type of the item (string)

Return type:

str

Example

To list the types of items that have cross references for node n:

xrefs = n.Xrefs()
for t in range(xrefs.numtypes):
    type = xrefs.GetType(t)
    num  = xrefs.GetTotal(type)
    print(num, " references of type ", type, "\n")