UpdateDefFromBlockEx
Updates a material definition from block text (same definition format as would be contained in the material library file) by library type (using definition folder name). This scripting command directly supports the .AMAT (or .ASURF) definition formats.This resembles the UpdateDefFromBlock command, except UpdateDefFromBlockEx also allows for:
-
updating a definition using a block where the name has changed without triggering a rename of the definition being updated
-
updating multiple definitions from the same block
-
renaming a definition to something other than the name in the block
| UI Access | N/A | |||||||||||||||||||||||
| Parameters |
|
|||||||||||||||||||||||
| Return Value | A property scripting object (extended definition object) for the definition. (In the event of a failure, the command throws an exception and there will be no result.) |
| Python Syntax | UpdateDefFromBlockEx(<targetDefName>, <desiredDefName>,<defBlock>, <defFolderName>, <newTimeStamp>, <continueIfConflict>) |
| Python Example |
# Note that the material block name will be ignored in this case defBlock = "$begin 'unused_name' $begin 'AttachedData' $begin \ 'MatAppearanceData' property_data='appearance_data' \ Red=255 Green=0 Blue=0 Transparency=0.19 $end \ 'MatAppearanceData' $end 'AttachedData' \ simple('permittivity', 1.9) ModTime=1509090909 \ $end 'unused_name'" try: updated = oDefinitionManager.UpdateDefFromBlockEx("red_material", "red_material", defBlock, "Materials", "1609090909") updatedName = updated.GetName().replace("Materials:", "") AddInfoMessage("Result: " + updatedName) except: AddErrorMessage("Unexpected error in UpdateDefFromBlockEx") |