Navigation: Scripting Reference Manual > Functions & Subroutines > KeywordRemoveFromItem

 

KeywordRemoveFromItem

 

Contact Us: fredsupport@photonengr.com

 

Description

This function removes a specific keyword from 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

kwRemoved = KeywordRemoveFromItem( itemType, kwNode, itemNode )

 

 

Parameters

kwRemoved (Long)

Returned long indicating whether the keyword removal was successful (1) or unsuccessful (0).

 

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

 

kwNode As Long

Node number of the keyword being removed from the item.

 

itemNode As Long

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

 

 

Example

The example below loops over the materials list and checks to see if a specific keyword has been assigned to any of the materials nodes.  If a keyword is found to be assigned to an item, the keyword is removed from that item.

 

Sub Main

 

    ClearOutputWindow()

 

    'Keyword of interest

    Dim kwNode As Long

    kwNode = KeywordFind( "Temperature Modified" )

 

    'Type of item we're searching

    Dim itemType As String

    itemType = "mat"

 

    'Number of items in document

    Dim itemCount As Long

    itemCount = GetMaterialCount()

 

    'Loop items and check for presence of keyword

    Dim curItem As Long

    For curItem = 0 To itemCount-1

        If KeywordIsAppliedToItem( itemType, kwNode, curItem ) Then

            KeywordRemoveFromItem( itemType, kwNode, curItem )

            Print "Keyword of interest removed from item " & GetMaterialName( curItem )

        End If

    Next

 

End Sub

 

See Also

Keyword Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC