Hi @joanromero2F9DN. Here is a simple iLogic rule that only contains some starter code right now. It first makes sure that we are working with a Part type document (not an assembly or drawing). Then it makes sure we are working with the 'factory' document, if one exists. There will only be a factory document when there are at least 2 ModelStates (the original one, plus at least one more). When a there is a factory document, that is the only one that is Read/Write, while the ModelState 'member' documents will be ReadOnly. The factory document is simply the document referenced by the 'active' ModelState. Then it gets the ModelStates object within the part. Then it sets the MemberEditScope to the 'All Members' variation. The all members variation is the same as the factory scope. After that point, you should be able to fill in the rest of your code past that point, but before the End Sub key phrase.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("A Part Document must be active for this rule to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oPDoc As PartDocument = ThisDoc.FactoryDocument
Dim oMSs As ModelStates = oPDoc.ComponentDefinition.ModelStates
oMSs.MemberEditScope = MemberEditScopeEnum.kEditAllMembers
'the rest of your code below this point, but before End Sub
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)