Message 1 of 3
Hide Form to pick point

Not applicable
03-07-2006
07:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can't seem to get this... I am loading a list box with notes from a data base. When a user pick a note, I would like to insert said note with a leader... It requires 2 picks. One for the insertion point for the Mtext and 1 for the leader starting point. But when the form is obviously in the way. So I have tried frmSheetNotes.hide... me.hide and even me.show before the drawing with.objUtil statment. I get various errors... the most common being msgbox "AutoCAD is unable to service automation request" command line "** That command may not be invoked transparently **" Here's the code.
Private Sub lstSheetNotes_Click()
Dim objUtil As AcadUtility
Dim objNote As AcadMText
Dim objLeader As AcadLeader
Dim objLayer As AcadLayer
Dim strSheetNote As String
Dim varPnt As Variant
Dim dblPnts(5) As Double
Dim dblMin(2) As Double
Dim strPrompt As String
On Error GoTo ErrControl
Set objUtil = ThisDrawing.Utility
strPrompt = vbCrLf & "Pick Insertion Point for Annotation: "
Me.hide
With objUtil
.InitializeUserInput 32
varPnt = .GetPoint(Prompt:=strPrompt)
strSheetNote = lstSheetNotes.Value
Set objNote = ThisDrawing.ModelSpace.AddMText(varPnt, 0, strSheetNote)
objNote.Width = 90
objNote.StyleName = "Romans"
objNote.Height = 4.5
objNote.AttachmentPoint = acAttachmentPointTopCenter
dblPnts(3) = dblMin(0)
dblPnts(4) = dblMin(1)
dblPnts(5) = dblMin(2)
strPrompt = vbCrLf & "Pick Point for Leader Arrow:"
.InitializeUserInput 32
varPnt = .GetPoint(dblMin, strPrompt)
dblPnts(0) = varPnt(0)
dblPnts(1) = varPnt(1)
End With
Set objLeader = ThisDrawing.ModelSpace.AddLeader(dblPnts, objNote, acLineWithArrow)
objLeader.StyleName = "1_4TH"
Exit Sub
ErrControl:
If Err.Description = "User input is a Keyword" Then
Err.Clear
Exit Sub
Else
MsgBox Err.Description
End If
End Sub
Private Sub lstSheetNotes_Click()
Dim objUtil As AcadUtility
Dim objNote As AcadMText
Dim objLeader As AcadLeader
Dim objLayer As AcadLayer
Dim strSheetNote As String
Dim varPnt As Variant
Dim dblPnts(5) As Double
Dim dblMin(2) As Double
Dim strPrompt As String
On Error GoTo ErrControl
Set objUtil = ThisDrawing.Utility
strPrompt = vbCrLf & "Pick Insertion Point for Annotation: "
Me.hide
With objUtil
.InitializeUserInput 32
varPnt = .GetPoint(Prompt:=strPrompt)
strSheetNote = lstSheetNotes.Value
Set objNote = ThisDrawing.ModelSpace.AddMText(varPnt, 0, strSheetNote)
objNote.Width = 90
objNote.StyleName = "Romans"
objNote.Height = 4.5
objNote.AttachmentPoint = acAttachmentPointTopCenter
dblPnts(3) = dblMin(0)
dblPnts(4) = dblMin(1)
dblPnts(5) = dblMin(2)
strPrompt = vbCrLf & "Pick Point for Leader Arrow:"
.InitializeUserInput 32
varPnt = .GetPoint(dblMin, strPrompt)
dblPnts(0) = varPnt(0)
dblPnts(1) = varPnt(1)
End With
Set objLeader = ThisDrawing.ModelSpace.AddLeader(dblPnts, objNote, acLineWithArrow)
objLeader.StyleName = "1_4TH"
Exit Sub
ErrControl:
If Err.Description = "User input is a Keyword" Then
Err.Clear
Exit Sub
Else
MsgBox Err.Description
End If
End Sub