Message 1 of 5
Insert Block into Another Open Drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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