Determine in-place editing?

Determine in-place editing?

Anonymous
Not applicable
624 Views
5 Replies
Message 1 of 6

Determine in-place editing?

Anonymous
Not applicable

Hi,

 

I have some code that captures the "OnActivateDocument" event and I want to determine whether the document that was activated is an "in-place" document.  In other words, did the user open the document from the hard drive or from an already-opened assembly?  Is there a way to determine that?  Thanks!

 

Tom

 

0 Likes
625 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Does this help get you started?

 

Public Sub ActiveEdit()

Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument

MsgBox oDoc.DisplayName
MsgBox oDoc.ActivatedObject.DisplayName


End Sub

 

 

0 Likes
Message 3 of 6

YuhanZhang
Autodesk
Autodesk

The remarks from Help document may help:

 

The OnActivateDocument event notifies a client when a document is activated. The definition of an active document is the top-level document that is being displayed in the active window. The title of a window also indicates the active document for that window. It's also important to understand that the document currently being edited is not necessarily the active document. This happens in the case of in-place editing in the context of an assembly. When you open an assembly document, the assembly is the active document. If you in-place edit a part within the assembly, the assembly is still the active document. The part being edited is the active edit object. The ApplicationEvents.OnNewEditObject event provides notification when the active edit object changes and the Application.ActiveEditObject property returns the current active edit object.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 4 of 6

Anonymous
Not applicable

Yes, I thought that was the answer, but when I tried it, it didn't work like I expected; the DocumentObject passed into OnActivateDocument and the ActiveEditDocument are the same object.

 

Here's my scenario: I frist open an assembly, then I right-click one of the piece parts and say "Open".  The OnActivateDocument event fires twice, but I can't tell that the second one was an in-place edit.

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

Kent,

I tried implementing this idea in my code, but no success.  In the OnActivateDocument event, I added four lines:

    DocumentObject.DisplayName

    DocumentObject.ActivatedObject

    inventorApp.ActiveEditDocument.DisplayName

    inventorApp.ActiveEditDocument.ActivatedObject

 

But the two "ActivatedObject" lines return Nothing and the two DisplayNames are the same.

 

0 Likes
Message 6 of 6

Anonymous
Not applicable

If you are doing a right click Open, then you aren't doing an in place edit.  If you right clicked and chose edit you would be doing a in place edit. 

0 Likes