editor.GetEntity from Palette (session mode)

#1
if I call "GetEntity" from COMMAND-LINE it's work
but from pallette - button not so good.

//----------------------------------------------------
[CommandMethod("GetEntity")]
public static void GetEntity()
{
Document activeDoc = Application.DocumentManager.MdiActiveDocument;
Database database = activeDoc.Database;
Editor editor = activeDoc.Editor;
var result = editor.GetEntity("\nEntity");
editor.WriteMessage("\n" + result.ToString());
}
//----------------------------------------------------

Re: editor.GetEntity from Palette (session mode)

#2
May you should try something like this:

Code: Select all

            Dim objDocument As Document = Application.DocumentManager.MdiActiveDocument
  	    Dim objEditor As Editor = objDocument.Editor
            Dim objOptions As PromptSelectionOptions = New PromptSelectionOptions()

            objOptions.MessageForAdding = vbLf & "Select lines: "

            Dim objSelectionFilter As SelectionFilter = New SelectionFilter(New TypedValue(0) {New TypedValue(CInt(DxfCode.Start), "LINE")})
            Dim objSelectionResult As PromptSelectionResult = objEditor.GetSelection(objOptions, objSelectionFilter)

            If objSelectionResult.Status <> PromptStatus.OK Then
                Return
            End If
            
            [ ... ] 
            

Re: editor.GetEntity from Palette (session mode)

#3
RaHo wrote:
Mon Jun 07, 2021 8:49 am
if I call "GetEntity" from COMMAND-LINE it's work
but from pallette - button not so good.

//----------------------------------------------------
[CommandMethod("GetEntity")]
public static void GetEntity()
{
Document activeDoc = Application.DocumentManager.MdiActiveDocument;
Database database = activeDoc.Database;
Editor editor = activeDoc.Editor;
var result = editor.GetEntity("\nEntity");
editor.WriteMessage("\n" + result.ToString());
}
//----------------------------------------------------
Hi RaHo,
Can you show more detail about "not good"?