
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I need help with iLogic.
I have an assembly with other subassemblys, parts and virtual parts in it.
In the subassemblys are sketches without extrusion. The sketches are called "Positioning".
In the sketch are gemoetries from the Subassembly for a machine. I need them for a drawing.
With the code below, I create a new view (called "Positions") in the mainasssembly and set all parts in it invisible, if the assembly is named "Machinepart".
Now I need to set only the sketches in subassembly with the name "Positioning" as visible in the view "Positions".
For information, I am not a programmer! I found some of the code below and edited it. My programming skill is on basic. If then else... thats it.
Dim Doc As Document
Doc = ThisApplication.ActiveDocument
If Doc.DisplayName = "Machinepart" Then
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oViewRep As DesignViewRepresentation
For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations
If oViewRep.Name = "Hauptansicht" Then
oViewRep.Activate
'wenn Hauptansicht aktiv, skip Error
On Error Resume Next
Else If oViewRep.Name = "Positions" Then
'Ansicht löschen
oViewRep.Delete
Else
End If
Next
oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Positions")
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
oOccurrence.Visible = False
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
InventorVb.DocumentUpdate()
Else
End If
Next
For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations
If oViewRep.Name = "Standard" Then
oViewRep.Activate
On Error Resume Next
Else
End If
Next
Else
End If
Solved! Go to Solution.