Hi,
I'm trying to use GDIEraseProcessor to erase instances, but I have no idea how I can get/create ECCriteria that is first parameter of Erase instances method.
As I understand it will provide the selection criteria of features to be erased.
So far I was trying get it from StorageImports criteria, as simply I found this property there satisfying expected interface of a parameter, but it is set to null (probably it has different purpose in this class).
What I want to achieve is to erase only Selected instances so I don't even need to provide any "where clauses", but if provided criteria is null it erases everything.
Does anyone have an idea how to do it? Thanks in advance.
My code:
GDI.GDIEraseProcessor ep = new GDI.GDIEraseProcessor();
//trying to get selection critieria from IImportCriteria, which is not working
IImportCriteria criteria = GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport; criteria.Geometry = null; criteria.SpatialArea = SpatialArea.Selection; IStorageImportCriteria storageImp = criteria.StorageImports[0] as IStorageImportCriteria; IECCriteria selectionCritieria = storageImp?.ECCriteria;
if (selectionCritieria != null)ep.EraseInstances(selectionCritieria, storageImp);
Hi Artur,
Artur Krynicki said:Does anyone have an idea how to do it?
do you expect quick answer when you do not provide any information like what product do you use and what version? Please read and follow best practices.
Artur Krynicki said:My code:
It's recommended to use Insert > Insert code tool for every posted code snippet (even one line code) with properly configured formatting. It helps with readability a lot.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
Thanks for the hint. My bad, I didn't read it before.
It's Bentley Map V8i SS4 (I've just stated it in Tags hoping it is enough).
The code:
GDI.GDIEraseProcessor ep = new GDI.GDIEraseProcessor(); //now I need to get/create IECCriteria instance, trying to do it in the following manner, but it seems it is not the way IImportCriteria criteria = GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport; criteria.Geometry = null; criteria.SpatialArea = SpatialArea.Selection; IStorageImportCriteria storageImp = criteria.StorageImports[0] as IStorageImportCriteria; IECCriteria selectionCritieria = storageImp?.ECCriteria; //calling erase if (selectionCritieria != null) { ep.EraseInstances(selectionCritieria, storageImp); }
one more advice: I did not realized it at first, but you are in the wrong forum. To discuss geospatial products programming, it's better to use Geospatial Programming forum.
To move existing post to another forum, use More > Move tool available under your original post. Please do not create a new post, the duplicated posts are quite confusing.
Artur Krynicki said:I've just stated it in Tags hoping it is enough
Everybody is used to reading standardized subject format [<product> <version> <language>], because it's just the recommended (and very useful) standard. Probably not too much people check tags ;-)
Thanks for your help.
Kind Regards,
Artur