Hi,
I thought it should be simple, but it seems it's not:
How to select only inferred (or only native) specific feature? E.g. when I have DGN where there are both native (newly created) and inferred (created in the past) features and DGN consists from more levels with different features, how to select only one type of feature and only inferred?
I found it's possible to search by element type, where the split between native and inferred is available, but element type is not equal to a feature.
Regards,
Jan
Jan,
Following VBA code that uses XFT should give you some ideas. Uses "Building" feature class from the geo_example workset.
Option Explicit Private Sub SelectAndBrowseFeatures() Dim sFeatureName As String sFeatureName = "Building" ' native features only BrowseFeatures sFeatureName, True, False ' inferred features only BrowseFeatures sFeatureName, False, True ' both native and inferred features BrowseFeatures sFeatureName, True, True End Sub Private Sub BrowseFeatures(sFeatureName As String, bSelectNativeFeatures As Boolean, bSelectInferredFeatures As Boolean) Dim oLocateOp As New locateOp Dim oCriteria As String oLocateOp.ClearHilited = True oLocateOp.IncludeOnlyFeatures = True oLocateOp.IncludeFeatureName sFeatureName If ActiveDesignFile.Fence.IsDefined = True Then oLocateOp.Mode = LocateOpMode.locateOpModeFence oLocateOp.AutoAcceptFence = True ElseIf ActiveModelReference.AnyElementsSelected Then Dim selectionSetValue As New InputValue selectionSetValue.SetTypeAndValue ValueType_VALUE, "1" oLocateOp.UseSelectionSet = selectionSetValue oLocateOp.AutoAcceptSelectionSet = True oLocateOp.Mode = LocateOpMode.locateOpModeIdentify Else oLocateOp.Mode = LocateOpMode.locateOpModeScan oLocateOp.AutoAcceptScanFile = True End If oLocateOp.Execute If oLocateOp.LocatedFeaturesCount > 0 Then MsgBox "found " + Str(oLocateOp.LocatedFeaturesCount) + " matching feature instances" ActiveModelReference.UnselectAllElements Dim fe As FeatureEnumerator Set fe = oLocateOp.GetLocatedFeatures Do While fe.MoveNext Dim bIsNativeFeature As Boolean Dim bSelectFeature As Boolean bIsNativeFeature = isNativeFeature(fe.Current) With fe.Current If bSelectNativeFeatures And bIsNativeFeature Then bSelectFeature = True End If If bSelectInferredFeatures And Not bIsNativeFeature Then bSelectFeature = True End If If bSelectFeature Then .AddToSelectionSet True .Display msdDrawingModeHilite End If End With Loop CadInputQueue.SendCommand "map query browse selection" Else MsgBox "no matching feature instances found" End If End Sub Function isNativeFeature(oFeature As feature) As Boolean On Error GoTo NotFeature If Len(oFeature.Uuid) > 0 Then isNativeFeature = True Else isNativeFeature = False End If Exit Function NotFeature: isNativeFeature = False End Function
Jeff Bielefeld [Bentley]
Jeff Bielefeld said:you could also craft a few lines of VBA code with XFT using a LocateOp to easily locate feature instances by class
It seems, based on quick analysis (no real code written), it would be possible to create ECQuery to identify particular feature instances classified as inferred. To use MicroStation API, especially new NET, is quick and convenient.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jeff,
Jeff Bielefeld said:If desired, you could also craft a few lines of VBA code with XFT using a LocateOp to easily locate feature instances by class
Yes, I assume it would be possible. I have not used BM API for quite long time (the most of my customers migrated to another solutions already, plus API is so fragmented and badly documented, that I prefer to find another ways usuaully, sorry), but I guess I still remember how to locate elements.
Jeff Bielefeld said:then determine if they are native or inferred
I have no idea how to do it and there is no such information in XFT documentation.
Jeff Bielefeld said:please keep in mind that OCM is designed to preserve the power and flexibility of CAD (e.g. MicroStation)
This is "technical/marketing feature" and even when often useful (I really like some CAD features still available in geo projects), does not represent enough benefits when compared with missing features and problems with usability (when compared with the mentioned products, supported by local "how to" knowledge).
We discussed OCM features yesterday with my customer, as we started again our "last try to migrate" (begun in OCM CE U2), and even when we were able to do more steps, still blocking bugs were found again in U6. He is aware of some strong technology benefits, but they do not solve every day requirements and task, and are not equal to limitations like one graphical source (WFS) only, moreover still dysfunctional with some INSPIRE sources (needed every day, working fine in other products) and complete ecosystem from desktop to web with functional support in Czech language.
So, openly, I am afraid he will decide to stop to pay Bentley soon, because as he told me, he has not received new, properly implemented and stable feature, supported enough locally, in last several years (from V8i SS4). Releases is buggy (reported issues and other minor, not reported yet), not fully functional (WFS used with INSPIRE) or not available yet at all (WMTS, XFM feature based topology analysis tool, spatial quality tools...).
With regards,
(disappointed) Jan
Greetings Jan,
If desired, you could also craft a few lines of VBA code with XFT using a LocateOp to easily locate feature instances by class, then determine if they are native or inferred, adding whatever is needed to a selection set.
When comparing OpenCities Map to QGIS or ESRI, please keep in mind that OCM is designed to preserve the power and flexibility of CAD (e.g. MicroStation) and add the concept of features for GIS interoperability.
Ok, now I understand what do you mean.
I will adapt the procedure to project conditions, it has to start with switching all levels off, so when Line: Inferred features in Element selection tool is used, only one feature is selected.
Frankly, why it's so complicated? My customer, when saw it right now, simply do not understand why it's required to work with levels, element types and at the end, features, when XFM features are searched? Especially when there is knowledge how QGIS and ESRI work.