OK. By the way...this is about as close as I can get to the solution you were asking for, but it is missing that final step of storing your selection of a Base Face to the document somehow. I know that when you use the manual user interface tool to convert a regular part into a sheet metal part, it immediately asks you to manually select a base face. But I honestly have not been able to figure out how or where they are storing that data. I looked in Attributes. I looked for a hidden property of the SheetMetalComponentDefinition called BaseFace, thinking it may just be hidden, but it was not found. This might be a good question for someone who does the programming at Autodesk.
Here is the code...just for your reference, and for future possible further development.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oRefDocs As DocumentsEnumerator = oADoc.AllReferencedDocuments
For Each oRefDoc As Document In oRefDocs
'if it is a regular Part Then
If oRefDoc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Then
ThisApplication.Documents.Open(oRefDoc.FullDocumentName, True)
Try
'try to convert it to Sheet Metal Part
oRefDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
Catch
Logger.Error("Error trying to convert following Part to Sheet Metal Part:" _
& vbCrLf & oRefDoc.FullDocumentName)
Continue For
End Try
Dim oBaseFace As Face = Nothing
oBaseFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select Base Face.")
If IsNothing(oBaseFace) Then Continue For
'not sure how to store this selection to a property in the part or component definition
'the FlatPatter object has a BaseFace property, but that object will not exist yet
'I don't think it is stored in an Attribute either...maybe a hidden property
'I already tried to store it to SheetMetalComponentDefinition.BaseFace, but that property does not exist
If oRefDoc.RequiresUpdate Then oRefDoc.Update
If oRefDoc.Dirty Then oRefDoc.Save
oRefDoc.Close(True)
End If
Next
Also, I do know the command that is behind the manual button. It is called "PartConvertToSheetMetalCmd". You can execute this command by code, but that just simulates you clicking the button. In a loop of many parts in a code, I seriously doubt it would wait each time for you to select a base face, then continue to the next part immediately afterwards. Sometimes using the user interface tools is simply better or does more than the available API code can in certain situations. This may be one of those situations.
Wesley Crihfield

(Not an Autodesk Employee)