I have got a problem that at least did not exist in BentleyMap SS2. I have veryfied that it exist in Bentley Map SS3 built 95 and sadly enough also in the new service release with built no 107.
In short:
I have a small Mvba app that defines a new featureclass OisPunkt with a number of properties. Then I create a number of these features and I can check that they are created with the properties. BUT when I start the databrowser it will not accept the feature Class defintion and show only the feature instance without properties.
Documentation:
FeatureClasse definition
:
Mvba code creating and verifying the feature class definitions:
CreateFeatureClass and AddPropertyToFeatureClasse are both functions in a MDL DLL
Public Sub StartOisClient(ByVal feltliste As String)Set OISclient = CreateObject("OISlib.OISclient")If OISclient.SetLogon(OISUSER, OISPWD) = False Then'ved at spørge på paramtren sættes denEnd IfIf modX34featdef.TjekFeatDef("OisPunkt") = False Then CreateFeatureClass StrPtr("OisPunkt"), XFMFEATUREGISTYPE_PointLineEnd IfIf modX34featdef.TjekFeatAttribDef("OisPunkt", "MATR_NR") = False Then AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr("MATR_NR"), XFM_DATATYPE_STRING, 10 AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr("EJERLAV"), XFM_DATATYPE_STRING, 80End IfDim Felt As VariantDim strFelt As StringFor Each Felt In Split(felt_liste, ",") strFelt = Felt If modX34featdef.TjekFeatAttribDef("OisPunkt", strFelt) = False Then AddPropertyToFeatureClass StrPtr("OisPunkt"), StrPtr(strFelt), XFM_DATATYPE_STRING, 80 End IfNextmodX34featdef.DumpFeatureDefinitionProperties "OisPunkt"End Sub
Here comes the code for DumpFeatureDefinitionProperties:
Public Sub DumpFeatureDefinitionProperties(FeatureName As String) Debug.Print "--------" Dim message As String Dim oFeatureDef As FeatureDef On Error GoTo *** Set oFeatureDef = xft.FeatureMgr.GetFeatureDefinition(FeatureName) Dim strGeomType As String Select Case oFeatureDef.GeometryType Case 0: strGeomType = "UNKNOWN" Case 1: strGeomType = "LINE STRING or CURVE" Case 2: strGeomType = "POLYGON" Case 3: strGeomType = "POINT" Case 4: strGeomType = "TEXT" End Select message = "FeatureClass: " & oFeatureDef.Name & ", " & strGeomType dmsgPrint StrPtr(message) Dim numProperties As Long numProperties = oFeatureDef.PropertyCount Dim propertyIndex As Long For propertyIndex = 0 To (numProperties - 1) Dim oPropertyDef As PropertyDef Set oPropertyDef = oFeatureDef.GetPropertyDefinition(propertyIndex) message = " " & oPropertyDef.Name & ", " & oPropertyDef.TypeName dmsgPrint StrPtr(message) 'Debug.Print oPropertyDef.Name, oPropertyDef.TypeName Next***:End Sub
Here comes a Analyze Feature of one of the newly created features:
And last the Databrowser:
What has happen since version SS2 since the Databrowser (and the Edit feature function as well) no longer uses the feature Class definition cache
If I close Bentley map and open with the same designfile the Dynamic Feature Scoring findes the properties (offcause)
Erik Wirring
LE34
Futher investigation has shown that this problem do not occur in fesh design files where the feature "OisPunkt" has not existed before.
However if the feature "OisPunkt" had been registred by DFS, it seems like it was not posible to change the property definition for this feature. (adding more properties)
Unfortunally I am not able to dump the entire FeatureClasse definition cache, so I am not able to see if there some how was defined more than one instance of "OisPunkt" [ See: communities.bentley.com/.../82936.aspx]
Erik
Some more observations to this mystery:
Regarding observation 2, your dynamic feature class is removed from the session's feature class list when the last instance of the class is removed from the session. To keep the class in the session, you can call: xfmFeatureDef_setKeepInSession (featureDef, TRUE)
...when you are creating the class. This function is in xfmCore.lib and is not currently documented or in a FDF file so include the definition in your source:
StatusInt xfmFeatureDef_setKeepInSession(XfmFeatureDefP featureDef,BoolInt keepInSession);
StatusInt xfmFeatureDef_setKeepInSession
(
XfmFeatureDefP featureDef,
BoolInt keepInSession
);
We will need to document this function for the next release.
BTW, To show/dump the definition of a feature class to the MicroStation text window, you can use the keyin: mdl command dumpfeaturedefbyname OisPunkt
Can you provide a dgn with the OisPunkt where on file open DataBrowser shows no properties? I would have expected DFS to see at least your properties in the instance data.
When is your application first loaded to add your feature class?
Regards,
Chris
Hi Chris
Thanks. I will include XfmFeatureDef_setKeepInSession into my MDL dll. That will solve most of the problem complex.
But.
I will not be able to provide a dgn with OisPunkt where on file open Databrowser shows no properties, because as I earlier wrote the DFS will create a correct feature definition of oisPunkt correct. at opening. However! if all instance of OisPunkt is deleted and some new are created DFS do not create a correct feature definition, may be due to the fact that the layer "OisPunkt" exists? So here there are still a problem since the DFS created featureClass definition is removed with the last instance of OisPunkt, and re-creation of featureClasse definition are not 'accepted' by Databrowser
The application that create features OisPunkt starts with checking whether OisPunkt featureClasse is defined correct, if not it will create the featureClass definition and/or adding properties definitions. The application is loaded on user request for creating the feature OisPunkt that contains up-to-date information about the owner of the parcel retrieved over the Net. OisPunkt is placed in the centroid of the parcel
It seems that the XFm function you mention is not a part of what is distribuated :-(
Look here:
[== Building B:\mdl\objects\X34FeatDef\X34FeatDef.obj, (C:\Bu\Udvik_MDL\X34FeatDef\X34FeatDef.c) ==]
cl -IB:\mdl\include\ -IB:\mdl\include -IB:\mdl\include\geom -IB:\mdl\include\shareids -GS- -fp:fast -EHc -GR -GdF -D_X86_=1 -Di386=1 -c -
W3 -DWIN32 -DwinNT -MD -D_VISCXX -Gy -wd4996 -Od -D_SECURE_SCL_THROWS=1 -D_CONVERSION_DONT_USE_THREAD_LOCALE -D_SECURE_SCL=0 -DWIN32_LEAN_AN
D_MEAN -nologo -WX -Zi -FdB:\mdl\objects\X34FeatDef\objects.pdb -EHs -arch:SSE2 /RTC1 -FoB:\mdl\objects\X34FeatDef\X34FeatDef.obj C:\B
u\Udvik_MDL\X34FeatDef\X34FeatDef.c
X34FeatDef.c
[== Building "B:\mdlapps\X34FeatDef.dll", (B:\mdl\objects\X34FeatDef\X34FeatDef.obj) ==]
link -out:"B:\mdlapps\X34FeatDef.dll" -WX -OPT:NoWin98 -Ignore:4087 -Ignore:4089 -debug -incremental:yes -fixed:no @B:\mdl\objects\X34
FeatDef\X34FeatDeflink.rsp
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-dll
"-out:B:\mdlapps\X34FeatDef.dll"
"-implib:B:\mdl\objects\X34FeatDef\X34FeatDef.lib"
-map:B:\mdl\objects\X34FeatDef\X34FeatDef.map
"-pdb:B:\mdlapps\X34FeatDef.pdb"
-debug -incremental:yes -fixed:no
-MANIFESTFILE:B:\mdl\objects\X34FeatDef\X34FeatDef.dll.Manifest
B:\mdl\objects\X34FeatDef\X34FeatDef.obj B:\mdl\library\mdllib.lib B:\mdl\library\toolsubs.lib B:\mdl\library\xfmapi.lib B:\mdl\library\dmsg
.lib B:\mdl\library\BentleyDgn.lib
B:\mdl\library\mdlbltin.lib
C:\PROGRA~1\MI30EB~1\VC\platformsdk\lib\gdi32.lib C:\PROGRA~1\MI30EB~1\VC\platformsdk\lib\user32.lib C:\PROGRA~1\MI30EB~1\VC\platformsdk\lib
\kernel32.lib C:\PROGRA~1\MI30EB~1\VC\lib\msvcrt.lib
LINK : B:\mdlapps\X34FeatDef.dll not found or not built by the last incremental link; performing full link
Creating library B:\mdl\objects\X34FeatDef\X34FeatDef.lib and object B:\mdl\objects\X34FeatDef\X34FeatDef.exp
X34FeatDef.obj : error LNK2019: unresolved external symbol _xfmFeatureDef_setKeepInSession referenced in function _CreateFeatureClass@8
B:\mdlapps\X34FeatDef.dll : fatal error LNK1120: 1 unresolved externals
BMAKE: call trace
line: 442, B:\mdl\include\dlmlink.mki
line: 105, C:\Bu\Udvik_MDL\X34FeatDef\x34featdef.mke
Fri Jan 11 13:25:14 2013, elapsed time: 0:05
[C:\Bu\Udvik_MDL\X34FeatDef]
I do not see xfmcore.lib in that output. You will need to also link with this library.
Hi Erik,
Regarding the DFS created feature definition, you might consider setting up a design application to load after Map/XFM(Map MS_DGNAPPS loads XFM) so you can set the DFS generated feature definition to stay in the session. xfmFeatureDef_create will tell you if the definition currently exists in the session.