Teun,
Thanks! That looks like just what I want to incorporate.
Bob S.
"Teun Ham (IV9 SP3)" wrote in message news:4855896@discussion.autodesk.com...
If that's the case, you can make all elements independant and delete all
invisible components.
Also, you might want to take a look at this:
http://www.mcadforums.com/forums/viewtopic.php?t=3073
Cheers,
Teun
"Bob S." wrote in message
news:4855838@discussion.autodesk.com...
This is part of a macro that does a save as of the assembly, opens the
new assembly invisibly, grounds all components and then deletes all
components that are not visible, then exports that to a step file for
our CNC and CMM people. They get bogged down if I include all the
extraneous stuff they have no use for, like Gage labels, Toolball XYZ
Labels, Go/No-Go feelers with handles and cable reels, etc, etc.
I thought I had it all working fine until I ran it on one of my designs
that happened to have a component pattern in it of parts I turned off in
order to be deleted. So given the intended result, it really does not
matter about patterns and such, since the result is a dumb step file.
"Teun Ham (IV9 SP3)" wrote in
message news:4855771@discussion.autodesk.com...
A simple question, but...
...a pattern can exist of multiple components (each pattern element can
contain multiple parts/subassemblies).
What if only one component of a pattern element is invisible?
Making that pattern element "independant" will make ALL components in that
element independant. Any change in the pattern afterwards will not affect
the component that was removed from the pattern.
One question: why do you want to remove/delete those parts? If it's for the
quantity, you could consider checking the "reference" of those parts.
If oOccurence.Visible = False Then
oOccurence.Reference = False
End If
Cheers,
Teun
"Bob S." wrote in message
news:4855712@discussion.autodesk.com...
The following snippet of code deletes all invisible components from an
assembly, but fails with a runtime error if the component is in a pattern.
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Visible = False Then
oOccurrence.Delete
End If
Next
I managed to change it for now to just skip over the patterned components
by adding a check as in the following:
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Visible = False Then
If oOccurrence.PatternElement Is Nothing Then
oOccurrence.Delete
End If
End If
Next
However, what I really want to do is delete those occurences. I imagine
I might have to make them independent or something first. Can someone
point me in the right direction here on what I have to do in order to
delete them?
Bob S.