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 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 use Acad and Turbocad selectively. I can't find a way to enable Acad to have object handlers to move and rotate objects. Is there a setting that I can enable to turn this feature on in Acad? I like this feature in Turbocad, but like to have in Acad.
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 need to sort the BOM (structured) while avoiding three parts. So I attempted manually locking the three parts in the BOM through the user interface and then running the following code
' Set a reference to the assembly document. ' This assumes an assembly document is active. Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument
' Set a reference to the BOM Dim oBOM As BOM oBOM = oDoc.ComponentDefinition.BOM
' Make sure that the structured view is enabled. 'Set a reference to the "Structured" BOMView Dim oBOMView As BOMView oBOMView = oBOM.BOMViews.Item("Structured")
'The following line works correctly Call oBOMView.Sort("Part Number",True) 'Re-Number the BOM Call oBOMView.Renumber(3, 1) 'Re-Sort Items 'Call oBOMView.Sort("Item",True)
The above code is bits and pieces that I have combined from the internet. The only problem with it is that sort works fine on some files while on others it skips a few e.g. 1,2,5,6,7......
Is there any way we can sort the BOM while avoiding all the locked parts.
I'm noticing Jaggies in a rendering done with Image Based Light at the edges of bright reflections. Obviously I'd rather not have such jaggies.
I have the feeling that the problem is because the light is so bright that the rendering is ending up with a clipped result at edges between extreme bright and dark.
Click this and view at 100% original size to see them.
I can't quite get the effect I am looking for. I have a flat plane mapped with a standard reflective material that has a transparency map. I'd like the transparent areas of the map to disappear and not have reflections. I'd also like my lights to be excluded from the reflections. I tried to exclude my light group using the "local exclude" button in the reflection map, but nothing changed. I've also done tests unchecking each box withing the material editor to see where this can be controlled.
What are some of the things I can do to prevent rasterization of vector images when I create them in CorelDraw? Do transparency and gradients cause rasterization?
I used CS2 to edit my photos but I notice that when i flatten the image and save it, the images saved has some quality loss in it. It really has started to annoy me and I cnt edit my images. Please tell me a way to reduce this quality loss. I have to save the images in JPEG as I have to post them on the internet.
and i hv also noticed that sme colors change when i save the image..like the saved image is a bit darker than what i see in photoshop...
when I try to cut out a freeform selection, it blurs the edges around the remaining image. Since I want to be able to piece together the images later, I want to avoid this. How?
Just grabbed Scott's book from amazon and can't wait to get a better understanding about some of the tools I've been using. In the meantime I just noticed that I have some white trails or fine lines in an image I'm working on that appear after I have been moving things around and deleting sections etc.
It's no problem on a little image like this to run around with the brush to tidy it up and then fill white/transparent, but I'm wondering if there is there a setting or an order of working that avoids making the lines in the first place?I have filled the background in black to show the trails...
Problem: How to enlarge (100 times) image of multiple intersecting low resolution contour lines wile avoiding pixelation?
Simple answer: It can't be done.
Second thoughts: Well, under some circumstances it can be done... sort of. For example if lines are orthogonal to begin with then simple re-sample to nearest neighbor algorithm will do fine. If lines are simple enough, then tracing them with pen tool and recreating the original lines at higher resolution by stroking the paths with a brush will do also. Also if original lines are smooth and thick enough then some re-sampling, blurring and leveling can work (anisotropic diffusion filter may work) but will produce smoothing artifacts at corners.
From what I can see the problem boils down to creatively converting the original lines to vectors (paths / shapes) and avoiding the whole messiness of raster anti-aliasing. But here we face additional problems: Adobe trace engine is not smart enough to recognize geometric shapes, intersecting lines, straight edges, orthogonal lines and mathematical curves - just try to trace a font and you will end up with a baggy monster. Additionally, it appears that in Photoshop center-line trace is not possible and you are limited to outlines.
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 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.
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].......