Capture changes from "Edit via Spreadsheet"

Capture changes from "Edit via Spreadsheet"

J-Camper
Advisor Advisor
122 Views
2 Replies
Message 1 of 3

Capture changes from "Edit via Spreadsheet"

J-Camper
Advisor
Advisor

I'm working on a project where I want an attribute on an entity that needs to be unique across modelstates.  I've noticed that attribute values are divorced from Modelstates, so I've implemented an attribute per modelstate.  I want to be able to track when the user adds modelstates, but I have not come up with a solution for adding modelstates through the spreadsheet.

I've tried watching the "AppLaunchViaSpreadSheetCmd" controldefinition, but it gets terminated before the spreadsheet even loads.  After making saving and closing the spreadsheet the document updates, but there is no separate undo item.  I assume the "New Model State" transactions get merged with the "Edit via Spreadsheet" transaction, but they don't fire the ModelStateEvents.OnNewModelState Event.

Anyone have any ideas how to capture these changes from Spreadsheet edits?

0 Likes
123 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Based on what you have described so far, this sounds pretty similar to another somewhat similar scenario that I was trying to help someone on the forum figure out.  They wanted to 'capture' the dialog that shows when they place a title block with prompted entries on a drawing sheet, so that they could fill it in on the fly, without having to supply them in the usual Array of String type input variable of the Sheet.AddTitleBlock method, for some reason.  I tried monitoring several different related events, but it seemed like that dialog showing was somehow 'bundled' in with one of the events, and not its own event, or there was simply no event for catching it.  So, we could not catch it or interact with it.

There are also a couple other ModelState related events, but I doubt they would help any in this case.

ModelingEvents.OnGenerateModelStateMember 

And we can listen for the MemberEditScopeEnum to be toggled through the DocumentEvents.OnChange or similar ApplicationEvents.OnDocumentChange events.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

J-Camper
Advisor
Advisor

Yeah, I've been trying a few different things with no success.  I thought the same thing abut the "OnGenerateModelStateMember" but it wasn't triggering in my test when the spreadsheet added the modelstates.  I started looking through a bunch of different event types and I think the next thing i will try is watching come of the "BrowserPanesEvents".  There is a Reorder event, which I'm thinking might be triggered when new modelstates are added?  Not sure if that counts as reordering browsernodes but it's the next path I'm going to try unless someone here comes up with a better idea.

0 Likes