Navigation: Scripting Reference Manual > Functions & Subroutines > KeywordGetCountFromItem

 

KeywordGetCountFromItem

 

Contact Us: fredsupport@photonengr.com

 

Description

This function returns the count of keywords that are assigned to a specified 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

kwCount = KeywordGetCountFromItem( itemType, itemId )

 

 

Parameters

kwCount (Long)

Returned number of keywords assigned to the item being queried.

 

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

 

itemId As Long

Node number of the item being queried. The type of item is given by itemType.

 

 

Example

The example below demonstrates how to loop over items and retrieve the number of keywords assigned to each item.

 

Sub Main

 

    ClearOutputWindow()

 

    Dim kwCount As Long, itemId As Long, curItem As Long

    Dim itemType As String

    itemType = "ent" 'items are sources, geometry nodes or analysis entities

 

    'Loop over the items and print how many keywords each item has (if not zero)

    For curItem = 4 To GetEntityCount()-1

        kwCount = KeywordGetCountFromItem( itemType, curItem )

        If kwCount > 0 Then

            Print "Item " & GetFullName( curItem ) & " has " & kwCount & " keywords assigned.

        End If

    Next

 

End Sub

 

See Also

Keyword Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC