I'm having a problem with the Copy() method of SolidEdgeDraft.SelectSet. What I'm doing is replacing out-of-date drawing frames with the current version, so I'm deleting everything from all the background sheets of the working draft (which works just fine), and then opening up the template file and copying everything from the background sheets there across to the corresponding background sheet of the working draft, one sheet at a time.
This works just fine for the first sheet, but on the second loop through, the call to Copy() causes exceptions and crashes. The SelectSet object contains the correct number of items, and at the moment I cannot see what is causing the problem.
Here is the section of code that is giving me grief:
OK, as is typical with these things, you ask the question and then almost immediately answer it yourself! Just on the off chance that anyone else encounters this, there is nothing wrong with the code per se... the cause of the exceptions was a BlockOccurrence object with no Block reference.
After adding a couple of lines to check that the current block occurrence has a block reference before adding it to the SelectSet, all the background sheets copy across perfectly. (Solid Edge Spy is damned useful!)
Posted by: Paul Dobson Post date: 7/5/2013 4:09:46 AM