selection set error

selection set error

a.kouchakzadeh
Advocate Advocate
327 Views
1 Reply
Message 1 of 2

selection set error

a.kouchakzadeh
Advocate
Advocate

Im facing another problem too

 

line 289 shoots an error

in the exception user-Unhandled box it says this:

  Name Value Type

$exception{"Unable to cast object of type 'Autodesk.AutoCAD.EditorInput.SelectedObject' to type 'Autodesk.AutoCAD.DatabaseServices.Entity'."}System.InvalidCastException

 

whats strange is I used the same method a few lines above which is not included in the screen shot.

this is what i wrote and passed it without error:

PromptSelectionResult psr2 = ed.SelectAll();
if (psr2.Status==PromptStatus.OK)
{
SelectionSet selall = psr2.Value;

...

}

code.JPG

Edit:

I also noticed my code wont hide entities:

foreach (ObjectId obj in objallID)
{
Entity ent = trs.GetObject(obj, OpenMode.ForWrite) as Entity;
ent.Visible=false;
}
Autodesk.AutoCAD.Internal.Utils.FlushGraphics();

 

 

@norman.yuan 

0 Likes
Accepted solutions (1)
328 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant
Accepted solution

Hi,

totalset is a SelectionSet.

A SelectionSet contains SelectedObject items not Entity items.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes