[code]
'Build a filter for just "TEXT" on "YourLayer"
Dim filList(1) As TypedValue
filList(0) = New TypedValue(DxfCode.Start, "TEXT")
filList(1) = New TypedValue(DxfCode.LayerName, "YourLayer")
Dim filter As SelectionFilter = New SelectionFilter(filList)
Dim res As PromptSelectionResult = ed.GetSelection(Opts, filter)
[/code]
wrote in message news:5427977@discussion.autodesk.com...
HI, all.
The code below is the example of selecting text, if selected appropriately,
Msgbox show the information of height of the text. Additionally to this, I
wish to add one more condition,
entity is text and the layername is " LEVEL".
Plz, help me. Good day.
_
Public Sub GetEntity()
Dim currentEditor As AcEd.Editor =
AcAs.Application.DocumentManager.MdiActiveDocument.Editor
Dim entitySelectionOpts As AcEd.PromptEntityOptions = New
AcEd.PromptEntityOptions("" & Microsoft.VisualBasic.Chr(10) & "Select Text:
")
entitySelectionOpts.SetRejectMessage("" &
Microsoft.VisualBasic.Chr(10) & "Only Textes may be selected.")
entitySelectionOpts.AddAllowedClass(GetType(AcDb.DBText), True)
Dim entitySelectionResult As AcEd.PromptEntityResult =
currentEditor.GetEntity(entitySelectionOpts)
If entitySelectionResult.Status = AcEd.PromptStatus.OK Then
DisplayTextHeight(entitySelectionResult.ObjectId)
End If
End Sub
Private Sub DisplayTextHeight(ByVal textId As AcDb.ObjectId)
Dim currentEditor As AcEd.Editor =
AcAs.Application.DocumentManager.MdiActiveDocument.Editor
' Using
Dim trans As AcDb.Transaction =
currentEditor.Document.TransactionManager.StartTransaction
Try
Dim selectedText As AcDb.DBText = CType(trans.GetObject(textId,
AcDb.OpenMode.ForRead), AcDb.DBText)
AcAs.Application.ShowAlertDialog("Text: " +
selectedText.Height.ToString)
Finally
CType(trans, IDisposable).Dispose()
End Try
End Sub