AnsweredAssumed Answered

Gtol seems inconsistent in getting and setting text

Question asked by Matt Camacho-Cook on Jun 4, 2018

I seem to be struggling with getting and setting text in a GTol frame (VBA).  I'm wanting to check for a certain text string (prefix) on a geometric tolerance in a drawing and remove that prefix if found while leaving the remainder of any existing text unchanged.  I understand and can successfully loop through the text items in a GTol frame with GetTextAtIndex, but am at a loss when setting the text.  I'm using SetText, but this takes a position from the swGTolTextParts_e Enumeration.  Why can the position in SetText not be set based on the same index that was retrieved from GetTextAtIndex?  I ran a simple example and the index from GetTextAtIndex does not match up with the numbers in the swGTolTextParts_e Enumeration.


In short, is there a way to relate the index from GetTextAtIndex to the enumeration used in SetText?


I'm on 2016 and am referencing the following API examples.

2016 SOLIDWORKS API Help - Get Text Items in GTol Frame Example (VBA)

2016 SOLIDWORKS API Help - SetText Method (IGtol)