In the AutoCAD Data Standard window, sometimes properties must be updated from the drawing content. For example: 1. I have code written (typically in InitializeWindow function) to automatically get the sheet size information and save it into a property, however, if the sheet size is changed from A3 to A2, for example, we cannot change the title block attributes directly because this is not working with Data Standard, saving the drawing will not run the code in InitializeWindow. Situation like this will force users to click Datasheet command to bring up Data Standard window (run the code), and click OK again to close the window. 2. I have code written to automatically calculate the total weight of the assembly drawing (from BOM in AutoCAD Mechanical), and save it to property, however, the code will only run when the Data Standard window is open, if we modified the drawing and the weight need to be re-calculated, then again we need to click Datasheet command to bring up the Data Standard window just to click OK to close the window. This is awkward, and the user will always forget to do it, then the drawing is left with incorrect property values. In inventor we have iLogic to solve such problems, in AutoCAD we have nothing, maybe VBA, but VBA is old, not Vault-aware, and not very safe. Then I think a function like OnDocumentSave in Default.ps1 will solve this problem, we can put the code need to run on saving into this function. We already know Data Standard is actually subscribed to the saving event (to write properties into title block), then all it needs to change for Data Standard is to call this additional new function on saving.
Show More