AutoCAD Inventor :: OnDocumentChange Event Not Firing
Oct 1, 2013
I'm trying to create a handler for the OnDocumentChange Application event.
private Inventor.Application m_inventorApplication;
Inventor.ApplicationEvents appEvents = null;
public StandardAddInServer()
[Code]...
My OnSaveDocument handler works just fine but the OnDocumentChange will not fire. I've been using the even watcher and have been using other handlers but cannot seem to get this one to work.
I'am trying to get a parallax type scroll to work.
I have my browser small enough so scroll bars are displayed. I have set the stage's overflow to "scroll". In the Stage "scroll" action I have the following: console.log("scrolled");
But it never fires when I scroll.
I've added a similar "click" action to a rectangle on the stage and that works.
I have a button which has a mousover/mousout animation. When i click the button, it will shrink down to 0%. when it does, my mousout event is triggert, which i dont want.
how can i disable the mousout event after the click event?
Is there any chance to define an event trigger which runs an iLogic rule when we check out an already open file? Problem is, that we need to synchronize iProperties on check out to clear "Approved by" when Vault State of Part is "under revision"
Vault Parameter "State" is mapped with iProperty "State".
I have addin running inside Inventor. The requirement is that addin should be able to capture the "save as" operation done by the user. Internally, addin stores unique information in the active Inventor file and when user does "Save as", it needs to generate and store the new unique information in the newly created file after Save As. That is the reason it is required to capture the Save As event.
It was possible to capture the "Save" event and there I get Event Timing Enum (kBefore and kAfter). But the file name is same for kBefore and kAfter. So its not possible to identify that its Save As operation.
Is there a way to set the event trigger of an ilogic file that's already inside of a document? I have code that can automatically create and populate new rules across my assembly parts, but it would be nice to set certain rules to fire every time that part gets saved.
If it can't be accomplished outright from the API, would it be possible to throw an OnEvent (save event in this case) inside of the iLogic code, to get the same results? URL...
I am setting up template .ipts and .idw for my company, and i run Adept to save and store my files. Now i have a code to automatically make a .idw after i save an .ipt. but then after every save (adept saves the .ipt a lot of times) it will ask to make a drawing for the .ipt. well i was wondering if there is a code to put in a rule to disable the event triggers, and place that rule on the trigger after close document. so that the next time i open the document no event triggers will work.
So the other day I set up an external rule and created an event trigger to run the rule on save. It worked great ... for a couple days, and then it just stopped working yesterday. I can still run the rule manually and it works fine, but it doesn't seem to run automatically anymore on file save. Yes, iLogic is set to Loaded / Automati in the add-ins panel.
(on the iLogic rule attachment, remove .TXT from the end. I had to add that due to the board's rules about file types.)
Product Design Suite Ultimate 2013, 2014 Autodesk Inventor 2013
How to use an embedded cursor (mycursor.cur) via the SetCursor command under user interaction events. I can use built in cursors just not able to get it working with my resource.
But it seems that the onselect event only catches selection of drawing views or balloon, annotation etc, but not the component inside the drawing view is this intentional or a bug?
The reason i need to catch this is to make a new context menu action, so i need the selected item. I know i can use SelectionSet, but i want to be able to debug my application as an external application connecting to the running instance before i build it into an addin (saves me a lot of inventor restarts..) And Selection Set does not seem to work when i use it inside an event handler in an external application...
In my plug-in I have some datagridview to show alignment data of all alignments in drawing.
I have a button called (regen) to update data in these datagridviews. I read again database drawing and re-source again datagridview. (method "upload_all")
I have read some posts and blogs about this: [URL] ....
and about overrule: [URL] ....
But I don´t understand almost.
I only want to execute method "upload_all" if some alignment is modified in the drawing.
Also, I would like to do it if some alignment is just created or deleted.
Autocad Civil 3D 2014 +SP1 Quad Core Intel i7 3770-cpu 3.40Ghz. ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd 32gb RAM 1600 Mhz. nVidia Quadro 2000. Win 7 Pro 64bit
I have a group of classes that essentially implement the Model View Controller pattern. The view is a custom control contained in a PaletteSet. The Model is a class that wraps the ObjectID of a given block. I've used these classes to create a replacement for the Properties tool in AutoCAD (2011). Basically the UI can be used to edit the properties of a Dynamic Block. But I apply my own rules and behaviors to the UI.
I had no problems until I added support for the View to be updated when the block is modified (say by dragging to increase a length property). To do this I handle the Modified event of the block. After the block is modified, some rules are evaluated. If the rules result in changes to the block's properties, these changes are applied. This last part is where I'm having trouble.
When the "Rule Evaluation" code is invoked because of changes to the view (WinForms Controls), I am able to update the block's Properties using the following code without issue:
Public Shared Function SetParameter(ByVal BlockID As ObjectId, ByVal ParameterName As String, ByVal Value As Double) As Boolean Using dl As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument(DocumentLockMode.ProtectedAutoWrite, Nothing, Nothing, True) Using myTrans As Transaction = BlockID.Database.TransactionManager.StartTransaction Dim myBRef As BlockReference = BlockID.GetObject(OpenMode.ForWrite) For Each myDynamProp As DynamicBlockReferenceProperty In myBRef.DynamicBlockReferencePropertyCollection If myDynamProp.PropertyName.Equals(ParameterName, StringComparison.OrdinalIgnoreCase) Then myDynamProp.Value = Value myTrans.Commit() Return True End If Next Return False End Using End Using End Function
However, when this same code is invoked as a result of the BlockReference Modified event, AutoCAD completely crashes the momment the transaction.Commit() method is called. I've attempted to catch the exception causing the crash and role back the transaction, but AutoCAD simply exits and displays the error (Error handler re-entered. Exiting now.) and no exception is caught. Note that I do not use the BlockReference instance passed to the Modified event handler. Instead I store an ObjectID instance elsewhere which is consistently used to read/write the block.
Is there something I must do before commiting a transaction when using the Modified event of BlockReference? I checked, and the same "Main Thread" is executing whether the code is invoked from a UI event or the Modified event. I tried calling the Close method, which is attributed as Obsolete, on the BlockReference object before executing the transaction without any success.
I would like to automatically wire up the event handlers for my .net assembly when it is loaded. For instance, does AutoCAD look for and call a "Loaded" or "Initialized" event when it loads my DLL?
I am trying to get a list of selected entities and their layers, but I want to capture it from the editor, not a command.
I currently have
Private Sub ed_SelectionAdded(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.EditorInput.SelectionAddedEventArgs) Handles ed.SelectionAdded Try For Each objid As ObjectId In e.AddedObjects.GetObjectIds Using tr As Transaction = ed.Document.TransactionManager.StartTransaction Dim ent As Entity = tr.GetObject(objid, OpenMode.ForRead) ed.WriteMessage(vbLf & objid.ObjectClass.DxfName & " is on " & ent.Layer) End Using Next Catch ex As Autodesk.AutoCAD.Runtime.Exception End Try End Sub
but when select a circle on Layer 1, I get the result below in the command line
CIRCLE is on Layer1 CIRCLE is on Layer1 CIRCLE is on Layer1 CIRCLE is on Layer1 CIRCLE is on Layer1 CIRCLE is on Layer1 Command: CIRCLE is on Layer1
If I hover over the circle while it is selected, it also treats it as a selection.
In order to avoid duplicate event handlers, I did like the following...
Document doc = Application.DocumentManager.MdiActiveDocument;try { doc.BeginDocumentClose -= new DocumentBeginCloseEventHandler(MyEventHandler); }catch { // Do nothing }doc.BeginDocumentClose += new DocumentBeginCloseEventHandler(MyEventHandler);
The above worked greatly with AutoCAD 2007. But yesterday I migrated my code into AutoCAD 2010 (with Object ARX 2010).
Unfortunately, it seems like AutoCAD 2010 catches before my code catches it. I guess I could just have a global boolean value that checks the status of event attachment.
i am trying to make a custom palette to display some custom information pulled out from selected objects.i can deal with the palette part.
i want some code for when you click an object in model space then the property palette updates. i am gonna keep it simple so this custom palette only refresh to the last selected object. but i don't know how to make an event when mouse click the autocad object and then do my things. any codes in c# or vb.net would be nice.
so use commandmethod load in a command and there will be a palette there stay open, when user click on an object then it will get populated. what event do i use for the clicking?
I'm trying to react to the AutoCAD application window being resized, that reaction is to move a form so that it stays in the bottom right hand corner of the AutoCAD application window. However, I cant seem to find a way to react to an AutoCAD application window resize event.
Displaying a vb.net form when an autocad block reference is double-clicked. Unfortunately, I still don`t know how to capture the double-click event for a block reference from code. I have gone down the IMessageFilter path, still no success.
I have tried the addHandler for application using code supplied to me in my previous post, still no luck. I really need to be able to capture the double click event for a block reference in autocad, without overwriting the default autocad double-click behavior.
I wish to be able to double-click a block reference, capture its name, and, if the name is same as blocks created by my form, then I`d simply have my dot net form pop up, displaying a few of the block`s properties.
Below is the code module I am using, which isn`t working ofr me:
' System Imports Microsoft.Win32 Imports System.Reflection
And the Commands class, from which my vb.net form is generated, as well as where the ModDoubleClick.eventDoubleClick() method is called:
Public Class Commands
' Component for displaying the Mass Straight Conveyor form <CommandMethod("mst")> _ Public Shared Sub massStraight() Try ' Call this to override default block dblclk event handler [code].......