Can I edit the "Protected" parameter of a named selection from a script?

tlewis3348
tlewis3348 Member Posts: 31
10 Comments Name Dropper Photogenic
**

Here is what is returned from Tree.FirstActiveObject.Properties when a named selection object is selected:

[GeometryDefineBy, GeometrySelection, SendToSolver, ProtectedTopology, SendAs, CosimulationInterface, Visible, IncludePCInflation, PreserveDuringSolve, ImportedFromCAD, NumInSelection, LengthOfEdges, AreaOfFaces, NumSuppressedItems, NumHiddenItems, WorksheetMeshing, CreatedForCrack, CrackFrontNumber, ToleranceType, ZeroTolerance, RelativeTolerance, AngularTolerance, LSDynaUserId, Source, ReadOnly]

The fourth item in the list is ProtectedTopology and corresponds to the "Protected" property in the screenshot below:

However, when I execute dir(Tree.FirstActiveObject), I get this list:

['Accept', 'Activate', 'AddComment', 'AddFigure', 'AddImage', 'AwaitObjectDuplicate', 'BaseObject', 'Children', 'Comments', 'CopyTo', 'CrackFrontNumber', 'CreateNodalNamedSelection', 'CreateObjRef', 'CreateParameter', 'CreatedForCrack', 'DataModelObjectCategory', 'Delete', 'Duplicate', 'ElementFaceIndices', 'Entities', 'Equals', 'ExportNamedSelectionToCDBFile', 'ExportToTextFile', 'Figures', 'Generate', 'GenerationCriteria', 'GetAPIName', 'GetAllProperties', 'GetChildren', 'GetEnumName', 'GetHashCode', 'GetIconFile', 'GetLifetimeService', 'GetObjectData', 'GetParameter', 'GetPath', 'GetPropertyName', 'GetPropertyValue', 'GetType', 'GetVisibleProperties', 'GetVisiblePropertyNames', 'GroupAllSimilarChildren', 'GroupSimilarObjects', 'GroupingFolder', 'IconName', 'Id', 'Ids', 'Images', 'ImportableObjectSourceId', 'IncludeProgramControlledInflation', 'InitializeLifetimeService', 'InternalObject', 'IsPropertyEditable', 'IsPropertyVisible', 'IsValid', 'LSDynaUserId', 'Location', 'MemberwiseClone', 'Name', 'ObjectId', 'ObjectState', 'ObjectTags', 'Parent', 'PreserveDuringSolve', 'Properties', 'PropertyByAPIName', 'PropertyById', 'PropertyByName', 'ReadOnly', 'ReferenceEquals', 'RelativeTolerance', 'RemoveParameter', 'ScopingMethod', 'SelectionType', 'SendAs', 'SendToSolver', 'SolverName', 'State', 'Suppressed', 'ToString', 'ToleranceType', 'TotalSelection', 'TransferableObjectId', 'Type', 'UsedByMeshWorksheet', 'Visible', 'VisibleProperties', 'Worksheet', 'ZeroTolerance', '__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_selMgr']

Unless I'm missing something, this does not appear to include an item that corresponds to the "Protected" property. Furthermore, Tree.FirstActiveObject.Properties[3].APIName (which normally returns the property corresponding to the given parameter) returns None.

Best Answer

Answers

  • Rajesh Meena
    Rajesh Meena Moderator, Employee Posts: 132
    100 Comments 25 Likes Second Anniversary 5 Answers
    ✭✭✭✭

    @tlewis3348

    This is not exposed. You will have to use InternalObject.

    obj.InternalObject.Protected

    Please note that internal objects may change in future.

  • tlewis3348
    tlewis3348 Member Posts: 31
    10 Comments Name Dropper Photogenic
    **

    @Rajesh Meena

    Thanks!

    Is there a means of getting the equivalent of the APIName from the item in the Properties list? In this case, it appears that the `Caption

  • tlewis3348
    tlewis3348 Member Posts: 31
    10 Comments Name Dropper Photogenic
    **

    ` property would work. But that obviously wouldn't always work (e.g., if there were spaces in the caption).

  • tlewis3348
    tlewis3348 Member Posts: 31
    10 Comments Name Dropper Photogenic
    **