@Kersh , we can't know the check out status ( as far as I know) but here are a few ways that might work to only change the status for things that can be changed.
You could skip all content center parts:
Dim oOccs As ComponentOccurrencesEnumerator
oOccs = ThisDoc.Document.ComponentDefinition.Occurrences.AllLeafOccurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Dim oDoc As Document = oOcc.Definition.Document
If oDoc.ComponentDefinition.IsContentMember = True Then Continue For
Call oDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
Next
iLogicVb.UpdateWhenDone = True
Or you could use this to check the read only status of the part, and skip all read only parts
Dim oOccs As ComponentOccurrencesEnumerator
oOccs = ThisDoc.Document.ComponentDefinition.Occurrences.AllLeafOccurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Dim oDoc As Document = oOcc.Definition.Document
Dim oFile As System.IO.FileInfo = New System.IO.FileInfo(oDoc.FullFileName)
If oFile.IsReadOnly = True Then Continue For
Call oDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
Next
iLogicVb.UpdateWhenDone = True
Or maybe this to see if it can be modified
Dim oOccs As ComponentOccurrencesEnumerator
oOccs = ThisDoc.Document.ComponentDefinition.Occurrences.AllLeafOccurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Dim oDoc As Document = oOcc.Definition.Document
If oDoc.IsModifiable = False Then Continue For
Call oDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
Next
iLogicVb.UpdateWhenDone = True
Or go full "belt and suspenders" mode and check all of those things and use the try/catch too
Dim oOccs As ComponentOccurrencesEnumerator
oOccs = ThisDoc.Document.ComponentDefinition.Occurrences.AllLeafOccurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Dim oDoc As Document = oOcc.Definition.Document
Dim oFile As System.IO.FileInfo = New System.IO.FileInfo(oDoc.FullFileName)
If oFile.IsReadOnly = True Then Continue For
If oDoc.ComponentDefinition.IsContentMember = True Then Continue For
If oDoc.IsModifiable = False Then Continue For
Try
Call oDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
Catch ex As Exception
'Logger.Info("Could not set BOM QTY to Each in " & oOcc.Name)
End Try
Next
iLogicVb.UpdateWhenDone = True