Suppress ocurrence via VBA

Suppress ocurrence via VBA

Anonymous
Not applicable
406 Views
5 Replies
Message 1 of 6

Suppress ocurrence via VBA

Anonymous
Not applicable
Hi all:
anybody knows how suppress a list of ocurrences in an assy using a macro?. I have an excel file with a list of parts/assy and I wish to supress all them using VBA code.

Thanks in advance
0 Likes
407 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Use the ComponentOccurrence.Suppress method to suppress an occurrence. There
isn't a way to suppress a list of occurrences, so you'd have to obtain the
list and suppress them one at a time.

Sanjay-

wrote in message news:5523288@discussion.autodesk.com...
Hi all:
anybody knows how suppress a list of ocurrences in an assy using a macro?. I
have an excel file with a list of parts/assy and I wish to supress all them
using VBA code.

Thanks in advance
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for your answer, do you have a code example?
0 Likes
Message 4 of 6

AeTEurope
Explorer
Explorer
I've the same problem....Has anyone a code example?
0 Likes
Message 5 of 6

Anonymous
Not applicable
Hi, I have some code:

Dim oCompDef As Inventor.ComponentDefinition
Dim oCompOcc As Inventor.ComponentOccurrence
Dim oMassProps As Inventor.MassProperties

Set oCompDef = oAssDoc.ComponentDefinition
Set oParam = oAssDoc.ComponentDefinition.Parameters

If plage = "I" Then
oParam.Item("w_Zrw_Ysk").Expression = 0#
oParam.Item("v_rw_sk").Expression = 0#
ElseIf plage = "A" Then
oParam.Item("w_Zrw_Ysk").Expression = 180#
oParam.Item("v_rw_sk").Expression = -Worksheets("BAuswahl").Range("B6").Value
End If

If Mid(Worksheets("BAuswahl").Range("B2").Value, 1, 3) = "RVN" Then
Set oCompOcc = oCompDef.Occurrences.ItemByName("Stuetzkonus_NH:1")
ElseIf Mid(Worksheets("BAuswahl").Range("B2").Value, 1, 3) = "RVH" Then
Set oCompOcc = oCompDef.Occurrences.ItemByName("Stuetzkonus_NH:1")
ElseIf Mid(Worksheets("BAuswahl").Range("B2").Value, 1, 3) = "RVS" Then
Set oCompOcc = oCompDef.Occurrences.ItemByName("Stuetzkonus_S:1")
End If

oParam.Item("lr_nsf").Expression = Worksheets("BAuswahl").Range("B20").Value

oAssDoc.Update
oInventorApp.ActiveView.Fit

If sichtbar = True Then
oCompOcc.Enabled = True
oCompOcc.Visible = True
oCompOcc.Unsuppress
Else
oCompOcc.Enabled = False
oCompOcc.Visible = False
oCompOcc.Suppress
End If
0 Likes
Message 6 of 6

AeTEurope
Explorer
Explorer
Thank you very much!!
I'm trying now!!!
0 Likes