AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check if AutoCAD selection set contains FDO features?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1431 Views, 3 Replies

Check if AutoCAD selection set contains FDO features?

Anonymous
Not applicable

Hi,

 

is there a reliable way to check if selected objects are Map FDO features?

 

It seems no checking is done here:

 

http://adndevblog.typepad.com/infrastructure/2012/07/using-acmapfeatureentityservicegetselection-to-...

 

but checking is done here:

 

http://forums.autodesk.com/t5/AutoCAD-Map-3D-Developer/FDO-object-properties-through-GetEntity/td-p/...

 

which I haven't tried myself yet but it doesn't look right to me to rely on this construct:

 

if (ent.Layer!="*ACMAPDMGISENTITIES") ....

 

What I have is:

 

 MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);

 

but I need to filter out all non-FDO objects in "selSet". Any ideas?

 

many thanks,

Rob

 

0 Likes

Check if AutoCAD selection set contains FDO features?

Hi,

 

is there a reliable way to check if selected objects are Map FDO features?

 

It seems no checking is done here:

 

http://adndevblog.typepad.com/infrastructure/2012/07/using-acmapfeatureentityservicegetselection-to-...

 

but checking is done here:

 

http://forums.autodesk.com/t5/AutoCAD-Map-3D-Developer/FDO-object-properties-through-GetEntity/td-p/...

 

which I haven't tried myself yet but it doesn't look right to me to rely on this construct:

 

if (ent.Layer!="*ACMAPDMGISENTITIES") ....

 

What I have is:

 

 MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);

 

but I need to filter out all non-FDO objects in "selSet". Any ideas?

 

many thanks,

Rob

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

 

Hi,

 

my issue is actually slighty different then described above.

 

For me it doesn't matter if there are FDO and CAD objects mixed in the selection set. The problem arises if only CAD objects have been selected. I need to find out if that is the case. But I do not know how.

 

If only an ACAD object has been selected I get a System.NullReferenceException. So I added a check whether the object in question is null or not. But it doesn't seem to be null or my check is wrong?

 

MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);

if (selectionBase != null)

...//ok

else

 return; //stop

 

 

It never follows the Else branch - but then I get the aformentioned exception later on at

 

selectionBase.GetLayers().Count

 

 

Any ideas?

 

Rob

 

0 Likes

 

Hi,

 

my issue is actually slighty different then described above.

 

For me it doesn't matter if there are FDO and CAD objects mixed in the selection set. The problem arises if only CAD objects have been selected. I need to find out if that is the case. But I do not know how.

 

If only an ACAD object has been selected I get a System.NullReferenceException. So I added a check whether the object in question is null or not. But it doesn't seem to be null or my check is wrong?

 

MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);

if (selectionBase != null)

...//ok

else

 return; //stop

 

 

It never follows the Else branch - but then I get the aformentioned exception later on at

 

selectionBase.GetLayers().Count

 

 

Any ideas?

 

Rob

 

Message 3 of 4
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Accepted solution

Unless AutoCAD Map has a radically different implementation of MgSelectionBase from MapGuide, the GetLayers() method of MgSelectionBase returns null for empty selections

 

So selectionBase.GetLayers() == null means no features selected

 

- Jackie

Unless AutoCAD Map has a radically different implementation of MgSelectionBase from MapGuide, the GetLayers() method of MgSelectionBase returns null for empty selections

 

So selectionBase.GetLayers() == null means no features selected

 

- Jackie

Message 4 of 4
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Accepted solution

Hi Jackie,

 

many thanks - that's the solution,

 

Rob

0 Likes

Hi Jackie,

 

many thanks - that's the solution,

 

Rob

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report