Cancel
Showing results for 
Search instead for 
Did you mean: 

Object Collection Item Index - start at "0" or "1"???

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Does anyone know how to tell without just testing a specific Object Collection whether the collection Item index starts with "1" or actually starts with "0" or has the latest ST10/2019 API been fixed to make all Object Collection Item indexes start at "1" now?



Ken
Production: SE 2019 MP5, Testing: SE 2020
http://Grundey.blogspot.com
6 REPLIES 6

Re: Object Collection Item Index - start at "0" or "1"???

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi @KennyG,

I don't know of any change in the API (this would break every existing program).

Most collection start with index 1 but there are some exceptions. From memory I think collection properties of DisplayData or Geometry start at 0.

regards

JB
SE 2019, VS2017

Re: Object Collection Item Index - start at "0" or "1"???

Legend
Legend

Just reading the thread subject gave me the heebie jeebies.  Yet I couldn't resist to click and see...


If you cannot find a Solid Edge setting, confirm you have a file open of the type that will be affected.

Re: Object Collection Item Index - start at "0" or "1"???

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

Hi Ken,

 

Generally, object collections start with index 1 while arrays start at 0

Do you have an example of a collection in SE that start at 0, I will look into it.

 

Tushar

Re: Object Collection Item Index - start at "0" or "1"???

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

@Tushar  I'm cycling through a TextBoxes collection and the index starts at "0" for it.  My issue seems to be related to ST10 as it does not error on SE 2019.  Adjusting the index to start at "1" fails in both if there is only 1 textbox in the collection.



Ken
Production: SE 2019 MP5, Testing: SE 2020
http://Grundey.blogspot.com

Re: Object Collection Item Index - start at "0" or "1"???

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

@@Kenny wrote:

I'm cycling through a TextBoxes collection and the index starts at "0" for it.


With SE2019, I find the index for a TextBoxes collection doesn't start at 0, it starts at 1, so the loop as seen below is failing:

 

SE2019_Index0.png

 

With SE2019 further, setting the index to 1 is working fine:

 

SE2019_Index1.png

In both cases, there is only a single text box on the sheet, though having multiple text boxes didn't make a difference in either case.

   

I will check this with ST10 later today.

   

~Tushar

Re: Object Collection Item Index - start at "0" or "1"???

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor

@KennyG wrote:

Adjusting the index to start at "1" fails in both if there is only 1 textbox in the collection.


Meanwhile, I looked up in the ST10 API help, the example uses 1 as the index which is same as what I found with actual coding in SE2019:

 

https://docs.plm.automation.siemens.com/docs/se/110/api/SolidEdgeFrameworkSupport~TextBoxes_members....

 

ST10_Index1.png

 

Can you attach the draft file with the textbox in it and the code snippet for looping through the textboxes collection?

Are you using the vanilla API of Solid Edge or the community interop, since a recent discussion mentioned that a API call was not working as expected.

  

~Tushar