- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
'Valide si le document ouvert est un assemblage ou non, si non, demande d'ouvrir un assemblage pour rouler la macro (12290 = .ipt, 12291 = .iam , 12292 = .idw) Dim oDocType = ThisApplication.ActiveDocument.DocumentType If oDocType = 12291 Then Else MsgBox("Ouvrir un assemblage pour rouler la macro") End If 'Création vue SheetMetalOnly Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition Dim oViewRep As DesignViewRepresentation Try oAsmDef.RepresentationsManager.DesignViewRepresentations.Item("SheetMetalOnly").Activate Catch oViewRep = oAsmDef.RepresentationsManager.DesignViewRepresentations.Add("SheetMetalOnly") 'Activate new View Rep oviewrep.activate End Try ' Reading Child part(leaf occurrences) of the assembly. Dim oLeafOccs As ComponentOccurrencesEnumerator = oAsmDef.Occurrences.AllLeafOccurrences Dim oOcc As ComponentOccurrence ' Iterate through all part occurrences in assembly. For Each oOcc In oLeafOccs
Dim oOccCrntStyle = SheetMetal.GetActiveStyle() MsgBox(oOccCrntStyle) If oCompOccCrntStyle Is Nothing Then kPartsListObject.visible = False Else 'kPartsListObject.Visible = True End If
Next
I am trying to get an iLogic to scan through an assembly and hide all the parts that are not Sheetmetal.
Here is what I have so far.
It looks if the file is an assembly or part and Tells to open one before you close the window and then crashes if it's a part that is opened
Then it creates a "SheetMetalOnly" View rep
Next scans the assembly and get all of the part occurences in the assembly and subassemblies,
but I can't find how to look on each occurence if it is a sheet metal part or a standard part.
The message box shows that it does not get any information from the Sheetmetal.getactivestyle.
Am I on the right track or using the right function?
Is it possible to get the selected occurence to activate itself and get its information once activated?
Thanks!
Solved! Go to Solution.