In the AddIn I'm working on, I'm trying to iterate through all sheets of type workingSection and run a command on each sheet. Here is part of the code:
for (int sheetCounter = document.ActiveSheet.Index + 1; sheetCounter <= document.Sheets.Count; sheetCounter++)
var sheet = document.Sheets.Item(sheetCounter) as SolidEdgeDraft.Sheet;
if (sheet.SectionType == SolidEdgeDraft.SheetSectionTypeConstants.igWorkingSection)
//Enter scale modification mode
Solved! Go to Solution.
A couple of things.
Not sure what you're trying to accomplish but this approach will never work. If you're needing to alter the scale for each sheet then you will have to code it yourself. If it's kind of a batch operation, you will need to present the user with a modal dialog with options to alter the scale for each sheet.
I'm sorry, I didn't mean to send this post. I didn't even formulate a question.
Just FYI, the problem was not the break statement or the asynchronous StartCommand(), it was a method I called after my code snippet which always switched to the first sheet (had it there for test purposes and forgot about it) and that prevented what I tried to accomplish.
BTW, semi-automatically changing the scale for every sheet now works as intended. After our background sheet change tool, the user is now "forced" to set a scale for each sheet. In our old background sheets the scale was only a textfield and not connected to a drawing view.
Sorry again, I thought I discarded this post. Thanks anyway for your help!
Just goes to show how good Jason is - he can answer questions you didn't even realise you'd asked