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

Insert Block into Another Open Drawing

4 REPLIES 4
Reply
Message 1 of 5
ChrisPicklesimer
470 Views, 4 Replies

Insert Block into Another Open Drawing

I would like to be able to collect information from a drawing via a sub-form and then insert a block with attributes (populated with collected info) into another open drawing.  The insert operation would be launched from a button on my sub form.

 

Is this possible?

 

From the code below I attempted a test to simply select a point from another open drawing but was not successful.  However, once I closed both forms the target drawing file is activated.

 

Thanks for any insight.

 

Chris

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Hide()
        Dim docMgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
        Dim i As Integer = 0
        For Each doc As Document In docMgr
            Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(doc.Name)
            If i = 1 Then
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentActivationEnabled = True
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = doc

                Dim ed As Editor = AcApp.Application.DocumentManager.MdiActiveDocument.Editor
                Dim dwg As Database = ed.Document.Database

                Dim prPointOptions As PromptPointOptions = New PromptPointOptions(ControlChars.NewLine & "pick")
                Dim prPointRes As PromptPointResult

                prPointOptions.AllowNone = True
                prPointRes = ed.GetPoint(prPointOptions)

                If prPointRes.Status = Autodesk.AutoCAD.EditorInput.PromptStatus.OK Then
                    MsgBox(prPointRes.Value.X.ToString & " - " & prPointRes.Value.Y.ToString)
                End If
            End If
            i = i + 1
        Next
        Me.Show()
    End Sub

 

4 REPLIES 4
Message 2 of 5
Hallex
in reply to: ChrisPicklesimer

Hi Chris,

try attached project

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 5

Hallex,

 

Maybe I am missing something but I don't see an attached project.  Thanks.

Message 4 of 5
Hallex
in reply to: ChrisPicklesimer

Very strange, I sq it this morning,
well then see PM
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 5 of 5
Hallex
in reply to: ChrisPicklesimer

See PM,
Cheers
_____________________________________
C6309D9E0751D165D0934D0621DFF27919

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