this part of my code is supposed to look for a layout I just added, search through it's blocks that have attributes, and if the block with the specific attributes is found, it should open a dialog box and populate the two text boxes with the attribute text. When the user changes the text in the dialog box and picks ok, I want it to go back and change the attribute values in the block.
I'm just not sure how to change the text value for the attributes. Do I create an identical code that will search all over again only to write the values instad of read? There has to be an easier way since I have the block located already.
Public Sub replaceTitleText(ByVal pageNumber As Integer) Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim ed As Editor = doc.Editor Dim layoutCount As Integer = LayoutManager.Current.LayoutCount - 1 Dim getTexttrans As Transaction = db.TransactionManager.StartTransaction()
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?
I'm working on setting up a process where I can bring AutoCAD drawings into GIS. I need to assign an attribute to a Polyline or Line so that the attributes can be viewed in GIS. I've noticed there is a way to convert AutoCAD to a SHP or SDP however I'm not familiar with this process.
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.
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 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 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.
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 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'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].......
I am currently in the process of re-writing my VBA in .net.In VBA I successfully used AcadDocument_BeginClose which called lisp functions.It would be nice to have all code in the same environment I need to transition my changes.
Therefore I need to call lisp from .net.My function works well when run withing the cad files session but does not appear to call the lisp when called after the BeginDocumentClose.
Is it possible to call a lisp function after the BeginDocumentClose event?
I am using VB.net created a palette。 I need to call refresh drawing(my own function) when user close this palette. But I don't know which event I need to put my code in.
I have a SelectionAdded event handler that reacts three times when selecing a single block and once when deselecting it.
If there are two blocks in the drawing but only selected one it reacts 5 or 6 times.
And it reacts every time I pass the mouse over the selected block.
Is there any way to sidestep the events in the handler so that AutoCAD doesn't grind to a halt if I have multiple blocks in the drawing. And decide to move my mouse over all of them?
Is there event for change current (active) layer of document?
(it's not Database.ObjectModified - it's not raised).
I tried to do it with binding as:
public void Initialize() { var layerList = Application.UIBindings.Collections.Layers; layerList.PropertyChanged += new PropertyChangedEventHandler(LayerList_PropertyChanged);
And -= in Terminate, but... Autocad 2012 chashed _sometimes_!!!
Impossible to understand when it happened. So I reject this way. Is there other way to handle this event?
I am developing a .NET application that integrates with AutoCAD Architecture. In my .NET application, I provide my user with a list of drawing files (.dwg) that they can choose to open. Once my user has selected a file, my application will open the selected drawing in AutoCAD Architecture. In this drawing, the user can click on an object in the drawing.
Can this mouse click event be captured and the object ID for the selected object be returned to my application?