I'm running a standalone SolidWorks 2016 instance in C# and for some components, the GetSuppression() method returns -1 that is not listed as a possible value.
What is the reason?
This likely indicates that the method failed to get the suppression state.
Did you check if the component actually exists? swComp == null and swComp.isHidden(false) should both return 'false' before 'GetSuppression()' can get a relevant value
I finally found out what is causing this.
I am writing a standalone exporter in C# and my first process is to traverse the entire assembly graph.
During an export, I noticed that some components are resolved, some other lightweight and a few of them with state -1, their number depending on the execution.
That is because the Large Assembly Mode was enabled with the threshold of 500 components (the assembly I export has more than 1000 components). Since I disabled it, every component is now resolved.
Sorry for my poor knowledge of SW (however I think that this is a bad behaviour of SW that should never provide components with state -1).
Hello,I once had a problem with IsSuppressed in VBA as well.I solved that then:
If Not CBool(CInt(Component.IsSuppressed)) Then
Andreas Beck wrote: Hello,I once had a problem with IsSuppressed in VBA as well.I solved that then: If Not CBool(CInt(Component.IsSuppressed)) Then
Andreas Beck wrote:
1. This is a completely different issue from the original question.
2. If you want to understand what happened, and the proper way to handle this situation, you can read 2018 SOLIDWORKS API Help - BOOL and VARIANT_BOOL Are Different Types
Retrieving data ...