Insert Block into Another Open Drawing

Insert Block into Another Open Drawing

ChrisPicklesimer
Advocate Advocate
1,013 Views
4 Replies
Message 1 of 5

Insert Block into Another Open Drawing

ChrisPicklesimer
Advocate
Advocate

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

 

0 Likes
1,014 Views
4 Replies
Replies (4)
Message 2 of 5

Hallex
Advisor
Advisor

Hi Chris,

try attached project

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 3 of 5

ChrisPicklesimer
Advocate
Advocate

Hallex,

 

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

0 Likes
Message 4 of 5

Hallex
Advisor
Advisor
Very strange, I sq it this morning,
well then see PM
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 5 of 5

Hallex
Advisor
Advisor
See PM,
Cheers
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes