Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I found this code here:
Solved: Define A-Side from Assembly - Autodesk Community - Inventor
But when I try the code it wont work it doesn't define the A-side.
I am trying to do the following:
In an assembly, it needs to define the A-Side from all the underlaying sheet metal parts F.E. the bottem view.
If ThisApplication.ActiveDocumentType = "12290" Then
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim face As Inventor.Face
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition
If oCompDef.ASideFaceStatus.ToString <> "kASideUpToDate" Then
MessageBox.Show("MUST DEFINE A-SIDE " & iProperties.Value("Project", "Part Number"), "DEFINE A-SIDE", MessageBoxButtons.OK, MessageBoxIcon.Stop)
iLogicVb.RunExternalRule("DELETE FLAT PATTERNS")
face = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartFaceFilter, "Define A-Side")
oDoc.SelectSet.Select(face)
ThisApplication.CommandManager.ControlDefinitions.Item("SheetMetalCreateASideCmd").Execute2(True)
oDoc.SelectSet.Clear
oDoc.ComponentDefinition.Unfold
oDoc.ComponentDefinition.FlatPattern.ExitEdit
End If
End If
' Check the document type
If ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
' Define the active assembly
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
' Check all referenced docs
For Each oDoc As Document In oAssyDoc.AllReferencedDocuments
' Check if the part is sheet metal
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
' Get sheet metal component definition
Dim oSMCD As Inventor.SheetMetalComponentDefinition
oSMCD = oDoc.ComponentDefinition
' Check If it has flatpattern
If oSMCD.HasFlatPattern = True Then
' Atempt to delete it
Try
oSMCD.FlatPattern.Delete
Catch
End Try
End If
End If
Next
ElseIf ThisApplication.ActiveDocument.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
' Get the sheetmetal component definition
Dim oSMCD As Inventor.SheetMetalComponentDefinition
oSMCD = ThisApplication.ActiveDocument.ComponentDefinition
' Check If it has flatpattern
If oSMCD.HasFlatPattern = True Then
' Atempt to delete it
Try
oSMCD.FlatPattern.Delete
Catch
End Try
End If
End If
' Update the files
InventorVb.DocumentUpdate()
Ciao
Solved! Go to Solution.