Since Bentley Map has no !! way to transfer the XFM data in an ordinary database, I had to write me a VBA application.
The VBA Macro creates a database attachement with the XFM Feature data. The the XFM block should be deleted.
In the MAP Help I havn't found any command to resolve this.
...........
Set oDatabaseLink = Application.CreateDatabaseLink(glMslinkOld, gnEntityNum, msdDatabaseLinkageOdbc, False, 0)
If oElement.IsGraphical ThenoElement.AddDatabaseLink oDatabaseLink??? remove XFM ????oElement.RewritegnCount = gnCount + 1
......
Hi GRJ,
I have no simple answer for your (sorry), but I'd like to ask what exactly do you want to achieve if talking about "no !! way to transfer the XFM data in an ordinary database"? Do you want to:
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Josef,
so the complete workflow is:
Is it correct?
Hi Jan,
I use Bentley Map only for import SHP Files, no XFM project.
Command:
>File >Import >Gis Data Types >Imports >New Import >Add File >Import
Josef
Attached my MVBA script.
dbXFM2DB.mvba
I have had not enough time to check your code (but for the first sight it looks not bad, even if talking about its structure). I did some quick testing and in my opinion this code should work:
Dim ftEnum As FeatureEnumerator Set ftEnum = locateOp.GetLocatedFeatures Do While ftEnum.MoveNext Dim currentFeature As feature Set currentFeature = ftEnum.Current Dim pureElement As element Set pureElement = xft.FeatureMgr.RemoveFeatureLinkages(currentFeature.Geometry) 'Do whatever you need with the new element pureElement.Level = ActiveDesignFile.Levels.Find("Default") pureElement.Rewrite Loop
I guess you should add it to your process feature class to OnFinished method.
Unknown said:f I understand you correctly, then I have to work through all selected features and not like my approach through the selected elements.
My experience with Bentley Map XFT API is not good enough to say if you have to and if it's the only way, but it's the approach that seems to work ;-)
If I understand BM API approach right, the feature is the core, not element (which representing the feature geometry and is not mandatory for some feature types like collections or data). This is in parallel with GIS approach as used in e.g. OGC and presented in many APIs (GeoTools, PostGIS etc.). So if you want to "defeaturize" a particular object, you have to enumerate features, not plain elements. Maybe your approach to work with elements directly can work also, but XFT API is quite high level, so there is a limited freedom to define what exactly will happen automatically and what not.
In my opinion you can use my code to receive a plain MicroStation element (this is not a new element, but the original element representing the feature geometry and now it's "defeaturized") and to add mslink to this element using already existing your code.
Unknown said:I must substitute this approach with your code.
I assume it should not be a huge effort. Fortunately it's still about the same Locate class and OnFinished method. The only important thing is that you have to drop XFM feature data from an element after you migrate XFM attributes to a database, because after the element is "defeaturized", it's not possible to receive any XFM data anymore. Something like (enumerating features step by step):