Message 1 of 6
Perform a task, ignoring locked parts.

Not applicable
09-21-2017
03:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rule that looks through the parts in an assembly, and if it finds the rule its looking for, runs it in the part before moving on. Problem is it does it through locked parts too. How can I get it to skip the locked parts? Im guessing it has to do with adding the vault reference?
SyntaxEditor Code Snippet
Sub Main RunPropertiesRule() 'Set reference to Document Counter Dim oDocCount As Integer 'Set Document Counter to 0 oDocCount = 0 ' Get the active assembly document. Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Vault = AddReference "Autodesk.DataManagement.Addin.Vault.dll" Dim oVault As Object oVault = Vault Auto = iLogicVb.Automation Dim iLogicAuto As Object iLogicAuto = Auto Dim oDoc As Document oDoc = ThisApplication.ActiveDocument For Each oDoc In oAsmDoc.AllReferencedDocuments 'Increase oDocCount Counter by 1 within For loop oDocCount = oDocCount + 1 If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Dim rules As Object rules = iLogicAuto.rules(oDoc) 'Remove rules If Not (rules Is Nothing) Then For Each rule In rules ruleName = rule.Name If Left(ruleName, 3) = "ipr" Or Left(ruleName, 3) = "Ipr" Then auto.RunRule(oDoc, ruleName) End If Next End If End If Next End Sub
In the code you can see where I tried to add the reference but it gives me an error "End of Statement Expected", It works fine without
Vault = AddReference "Autodesk.DataManagement.Addin.Vault.dll" Dim oVault As Object oVault = Vault
Any suggestions?