Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
511 Views, 4 Replies

Simple FOR LOOP crashes with a Parameter error for this one Component for no known reason

Hello,

 

I am having an issue, and I do not know what is causing it. See image "Parameter is incorrect". When my For Loop is looping it always hangs up on the same part "Jumper WP:16". It gives me a "parameter is incorrect" see image "Parameter is incorrect". It handles every other part just fine but this one. I have no idea what is going on.

See my browser tree "Parameter is incorrect - 3" image so you can see how the assembly model is built. I also put an image of the Visual Studio Autos window, so you can see nothing strange is going on. See image "Parameter is incorrect - 2". At first, I thought it did not like the 2 digit place for the component count, but it did count some with 2 digits. Any help would be grateful. 

 

Thanks,

 

Mike Munson

Inventor 2018 Pro

Visual Studio 2017

Anonymous
in reply to: Anonymous

In you second picture it says X = 21, but I only count 20 occurrences in your third picture. I think it's trying to get an occurrence that doesn't exist. I'm not sure where your CenterLineToolModule.AssyCompOccCount is getting it's number, but you might want to run a test and see what it equals.

Anonymous
in reply to: Anonymous

I will take a look. It is actually counting AllLeafOccurences. Maybe, I need to change my approach. Thanks for your help.

Anonymous
in reply to: Anonymous

I think leaf occurrences will include occurrences in your sub assemblies as well. I think you want something like AssemblyDocument.ComponentDefinition.Occurrences.Count for just the occurrences in your top assembly. If you are trying to check for sketches in the occurrences in sub assemblies as well, you will probably need a different approach.

Anonymous
in reply to: Anonymous

I got it. I needed to go to the AllLeafOccurences, so I was not going deep enough. Thanks again.