Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: WCrihfield

Here's the code I was using to try to get the available formats, in case you or others want to try to get it to work.

I've used this same sub in other situations successfully, but for some reason this situation it just doesn't want to work for me.

Sub Main
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If oPDoc.PropertySets.Item("Design Tracking Properties").Item("Document SubType Name").Value = "Sheet Metal" Then
	Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
	If oSMDef.FlatPattern Is Nothing Then
		MsgBox("FlatPattern was Nothing.", , " ")
		oSMDef.Unfold
		oSMDef.FlatPattern.ExitEdit
	Else
'		MsgBox("FlatPattern was already not Nothing.", , " ")
	End If
	Dim oFormats() As String
	Dim oStorageTypes() As StorageTypeEnum
	Try
'		oSMDef.DataIO.GetOutputFormats(oFormats, oStorageTypes)
		oSMDef.FlatPattern.DataIO.GetOutputFormats(oFormats, oStorageTypes)
'		oSMDef.FlatPattern.SurfaceBodies.Item(1).DataIO.GetOutputFormats(oFormats, oStorageTypes)
		If oFormats.Length > 0 Then
'			a = InputListBox("Output Formats",oFormats)
			For Each oFormat As String In oFormats
				MsgBox(oFormat)
			Next
		End If
	Catch oEx As Exception
		MsgBox("GetOutputFormats failed." & vbCrLf & _
		"Error Message is as follows:" & vbCrLf & _
		oEx.Message & vbCrLf & vbCrLf  & _
		"Error Source is as follows:" & vbCrLf & _
		oEx.Source & vbCrLf & vbCrLf & _
		"Error StackTrace is as follows:" & vbCrLf & _
		oEx.StackTrace & vbCrLf & vbCrLf  & _
		"Error Type.ToString is as follows:" & vbCrLf & _
		oEx.GetType.ToString, vbOKOnly + vbInformation, " ")
	End Try
End If
End Sub

Wesley Crihfield

EESignature

(Not an Autodesk Employee)