Description Given a list of keyword nodes and a list of items, this function removes from each item any keywords matching those in the input keyword node list. An 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 = KeywordsRemoveFromItems( itemType, kws( ), itemNodes() )
Parameters kwRet (Long) Returned value indicating the number of keyword removals resulting from the function call. For example, if two items each had two keywords removed the return value would be four.
itemType As String String indicating the type of item being modified. Options are:
kws() As Long Array containing the list of keyword nodes. Any of these keywords may be removed from the items in itemNodes().
itemNodes() As Long Array containing the list of item nodes. These items will have the keyword nodes in kws() removed if assigned to the item.
Example The example below demonstrates how to use KeywordsGetAppliedItems in pair with KeywordsRemoveFromItems in order to remove all keyword assignments from all entities. The example starts by populating the keys() array with all keyword node numbers, then calls KeywordsGetAppliedItems to retrieve the array of item node numbers having keywords assigned, and then finally calls KeywordsRemoveFromItems in order to remove the keywords from the items.
Sub Main
ClearOutputWindow()
'Populate an array with all keyword node numbers Dim keys() As Long, items() As Long, curKey As Long, keyCount As Long Dim itemType As String itemType = "ent" keyCount = KeywordCount() ReDim keys(keyCount-1) For curKey = 0 To keyCount-1 keys(curKey) = curKey Next
'Retrieve the item node numbers that have keywords assigned Dim getRet As Long getRet = KeywordsGetAppliedItems( itemType, keys(), items() ) Print "Get applied items return = " & getRet
'Remove all keywords from the items Dim remRet As Long If getRet > 0 Then remRet = KeywordsRemoveFromItems( itemType, keys(), items() ) Print "Remove applied items return = " & remRet End If
End Sub
See Also
|