I'm developing some API code where I prompt the user to select nodes, and then get a set of elements that contain those nodes. What I would then like to do is filter the element set by element type, but can't figure out how to do it.
My existing code is as follows:
femap.Set nodeSet = femapSession.feSet; zrc = nodeSet.Select(femap.zDataType.FT_NODE, true, "Select Nodes");
femap.Set elementSet = femapSession.feSet; zrc = elementSet.AddSetRule(nodeSet.ID, femap.zGroupDefinitionType.FGD_ELEM_BYNODE);
How can I create a filtered set from 'elementSet' that only contains, for instance, plate elements?
You can use a third set (sorry the code below is VB) and the "RemoveNotCommon" method:
Dim plateSet As femap.Set Set plateSet = App.feSet plateSet.AddRule(FET_L_PLATE,FGD_ELEM_BYTYPE) 'filter elementSet.RemoveNotCommon(plateSet.ID)
The trick, or what you need to keep in mind, is how you're selecting "plate elements". In the example above I used "by type", but have not selected parabolic plates, nor laminates...etc... I could use "by shape" and select all triangles and quadrangles, linear and parabolic...etc...
The important thing is to know exactly what you want to deal with and how robust you want your code to be.