Navigation: Scripting Reference Manual > Functions & Subroutines > KeywordsGetAllFromItem

 

KeywordsGetAllFromItem

 

Contact Us: fredsupport@photonengr.com

 

Description

Retrieves a list of keyword nodes that are assigned to a specific item.  The item is specified by an argument indicating the item type (ex. source, geometry, material, etc.) and the item node number.  Specifying the item type is critical because of how FRED stores node numbers internally.  For example, it is possible to have two items with node #5, one being a geometry element and one being a material definition.  Specifying the item type is required to remove any ambiguity about which node #5 is being referenced.

 

 

Syntax

kwRet = KeywordsGetAllFromItem( itemType, kws( ), itemNode )

 

 

Parameters

kwRet (Long)

Returned value indicating the number of keywords retrieved from the item (plus one).

 

itemType As String

String indicating the type of item being queried.  Options are:

itemType

Meaning

"ent"

Source, Geometry or Analysis Surface

"geo"

Source, Geometry or Analysis Surface

"coat"

Coating

"mat"

Material

"ray"

Raytrace Property

"cont"

Raytrace Property

"ctrl"

Raytrace Property

"prop"

Raytrace Property

"rough"

Surface Roughness

"scat"

Scatterer

"spect"

Spectrum

 

kws() As Long

This array argument is passed into the function but after execution will contain the node numbers of the keywords assigned to the item.  The ordering of the keyword node numbers in the array is the same as the ordering in which the keywords were applied to the item.

 

item As Long

Node number of the item from which the list of assigned keywords is being retrieved.

 

 

Example

The example below designates an item from which to retrieve the list of assigned keywords, then loops over the retrieved keywords and prints the name of each to the output window.

 

Sub Main

 

    ClearOutputWindow()

 

    'Designate an item and retrieve the assigned keywords

    Dim itemType As String

    Dim item As Long, keys() As Long, kwRet As Long

    itemType = "ent"

    item     = FindFullName( "Geometry.Secondary baffle.Surf 5" )

    kwRet    = KeywordsGetAllFromItem( itemType, keys(), item )

    Print "Return value = " & kwRet

    Print "Keys array bound = " & UBound(keys)

 

    'Loop over the keywords and print the array index, keyword node number and name

    Dim curind As Long

    Print "Index" & Chr(9) & "KW Node" & Chr(9) & "KW Name"

    For curind = 0 To UBound(keys)

        Print curind;

        Print keys(curind);

        Print KeywordGetName( keys(curind) )

    Next

 

End Sub

 

See Also

Keyword Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC