.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert Block Event

7 REPLIES 7
Reply
Message 1 of 8
VB_Autocad_guy
562 Views, 7 Replies

Insert Block Event

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, 

7 REPLIES 7
Message 2 of 8
Jeff_M
in reply to: VB_Autocad_guy

Database.InsertEnded Event should work.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 8
VB_Autocad_guy
in reply to: Jeff_M

How do I tell what was just inserted or how do I get the objectid of the most recently inserted block? 

Message 4 of 8
arcticad
in reply to: VB_Autocad_guy

http://forums.autodesk.com/t5/NET/Get-Last-Entity/m-p/2752298/highlight/true#M20452

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 5 of 8
VB_Autocad_guy
in reply to: arcticad

Thanks. 

Message 6 of 8
VB_Autocad_guy
in reply to: arcticad

    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. 

Message 7 of 8
Jeff_M
in reply to: VB_Autocad_guy

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....

Jeff_M, also a frequent Swamper
EESignature
Message 8 of 8
jeff
in reply to: VB_Autocad_guy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost