Hi
I have tried both examples from the Bentley Map XFM prommers Reference Guide:
Private Sub ProcessFeatureDefinitions() Dim featureDefCount As Long featureDefCount = xft.FeatureMgr.FeatureDefCount Dim featureDefIndex As Long For featureDefIndex = 0 To (featureDefCount - 1) Dim oFeatureDef As FeatureDef Set oFeatureDef = xft.FeatureMgr.GetFeatureDefinitionByIndex (featureDefIndex) Dim numProperties As Long numProperties = oFeatureDef.PropertyCount Next End SubThis one ends with a runtime error allthough I can se that featureDefCount is set to the actual numbers of FeatureClasses present in the design fil!! Sub ProcessFeatureDefs Dim featureName As String Dim loadProperties As Boolean Dim loadSubfeatures As Boolean loadProperties = True loadSubfeatures = True Dim featureDefEnum As FeatureDefEnumerator Set featureDefEnum = FeatureMgr.GetFeatureDefs (loadProperties, loadSubfeatures) Dim oFeatureDef As FeatureDef Do While featureDefEnum.MoveNext Set oFeatureDef = featureDefEnum.Current featureName = oFeatureDef.Name Loop End Sub This one never goes into the Do-Loop.I use no XFMschema both have tried both with dynamic feature scoring and with run time definition through the MDL api ( I can check through tree view in the Analyze tool that my run-time definition actually is working !!).Best RegardsErik Wirring
Private Sub ProcessFeatureDefinitions() Dim featureDefCount As Long featureDefCount = xft.FeatureMgr.FeatureDefCount Dim featureDefIndex As Long For featureDefIndex = 0 To (featureDefCount - 1) Dim oFeatureDef As FeatureDef Set oFeatureDef = xft.FeatureMgr.GetFeatureDefinitionByIndex (featureDefIndex) Dim numProperties As Long numProperties = oFeatureDef.PropertyCount Next End SubThis one ends with a runtime error allthough I can se that featureDefCount is set to the actual numbers of FeatureClasses present in the design fil!!
Sub ProcessFeatureDefs Dim featureName As String Dim loadProperties As Boolean Dim loadSubfeatures As Boolean loadProperties = True loadSubfeatures = True Dim featureDefEnum As FeatureDefEnumerator Set featureDefEnum = FeatureMgr.GetFeatureDefs (loadProperties, loadSubfeatures) Dim oFeatureDef As FeatureDef Do While featureDefEnum.MoveNext Set oFeatureDef = featureDefEnum.Current featureName = oFeatureDef.Name Loop
Erik,
It seems that the first method used exposes a defect which is encountered when the FeatureMgr.GetFeatureDefinitionByIndex method is called with an index that references a feature class that is not included in the schema, which of course you are not using. For the second method, it appears that the FeatureDefEnumerator object is not being updated to include dynamically added feature class definitions. I've logged each problem for resolution in a future Bentley Map product release.
Regards,
Jeff Bielefeld [Bentley]