Someone help me get started here.
I'd like to trigger a procedure to split a line upon a block being draged and dropped over it.
I drag a valve block onto a piping polyline and I'd eventually like it to autobreak by specificed amount.
What's the event for a block being inserted into a drawing?
Thanks,
How do I tell what was just inserted or how do I get the objectid of the most recently inserted block?
http://forums.autodesk.com/t5/NET/Get-Last-Entity/m-p/2752298/highlight/true#M20452
Private Sub callback_BlockInserted(ByVal Sender As Object, ByVal e As System.EventArgs) Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database Using trans As Transaction = db.TransactionManager.StartTransaction Dim objID As ObjectId = Autodesk.AutoCAD.Internal.Utils.EntLast() Dim btr As BlockTableRecord = trans.GetObject(objID, OpenMode.ForRead) MsgBox("Your Block Name Is " + btr.Name() + vbCrLf) 'Next End Using End Sub
Okay here... Hmm.. I missing something.. cause it's not working.
OK, false alarm, sorry.... Looks like the InsertEnded event only fires when adding a new Block to the Block table. Inserting a block already in the drawing doesn't trigger it. And, whe it does trigger, it fires before the Block is actually inserted, so the EntLast() method is returning the object added just prior to inserting the block.
May need to use the ObjectAppended event. Wish I had time to look into this further....
This might help
http://through-the-interface.typepad.com/through_the_interface/2008/08/preventing-an-a.html