Oy vey… got home and took a quick look at my fork and the current Seamly2D… it’s NOT a good idea to delete a draft block other than the current last one. You will run into all sorts of issues with the draft block and point naming. The app is remembering the current letter prefix, while the basepoint is incremented… and the letter prefix is not reused if you delete an earlier block. That is, while you may have sonething like a basepoint of D… the point names be named C1, C2…etc. You’ll also run into a “name already in use” if you delete a block and then create a new block… as the current block number and the next available block number are out of sync. Worse yet the geometry will get all out of sync, as you may be editing D1, but the geometry is for C1.
Plus ça change, plus c’est la même chose. That is - Nothing with this app ever gets easy. I’ll have to fix the code to keep things in sync when deleting a block.
UPDATE: The issues I’ve found are related to the fact that the draft blocks are tracked by the “count” of the list… so lets assume you’ve added blocks A, B, and C… and the current block is C. The list count is 3. Then if you delete B… the list count is 2. So if you add a new block - count now = 3 again, it correctly adds the D basepoint, but since the count is 3, the point names begin with C. The more blocks you delete, the more the count is decremented, and the further out of sync the current block base point becomes with the current (new) point name prefix.
Also the default name for a new block relies on the draft block list count + 1… like PatternPiece2, PatternPiece3, etc… but if you delete blocks, the count is less and you will get a name already in use. So… besides changing the default name to “DraftBlock” + some number, I have to refactor the code to correctly track what the next current block should be, regardless of the list count. The default name issue shouldn’t be a problem as I’ve already resolved that issue in the Workpiece dialog with the pattern piece name - where a number will get recycled, and in use numbers are skipped over. Which incidentally means there would be no correlation between a default draft block name and it’s number in the list. In other words DraftBlock2, may not be the second draft block… just the second block with a (unchanged) default name.
Syncing the current block with the proper (point) name prefix will be a little trickier.
UPDATE:
Hate the consecutive post limit.
Anyways, I’ve been working on this issue… I’ve fixed the new default name issue, and added a Delete Draft Block to the tool menu. Here’s the big issue, and I’d like some input. Like I mentioned before there’s an issue with the base name prefix if you delete draft blocks… the solution would seem to be to add an base prefix attribute in the < draw > element - which should be < draft > - but that aside… this may turn out to be a good thing. One thing that’s bugged me since day 1 is that one is locked into block 1 being A, block 2 - B, and so on. I don’t work that way. I draft a back first - which logically should be B… then the Front - for which I use F, sleeves - S, collar - C… you get the idea. If I add a new prefix attribute, we can do away with forced A-Z, and allow one to set the base prefix when a block is created… of course checking for uniqueness. So instead of checking the block’s index count against an A-Z string, we would simply get the block’s prefix that was set when created. This should solve the deleted blocks issue as well as allowing one to customize the base prefix - eliminating the problem of the prefix always reverting to the auto generated prefix.
Any thoughts?