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 Jan,
the only trouble is that the command ...RemoveFeatureLinkages... in line no. 9 in my version of Bentley Map 08.11.07.113 does not exist.
Regards,
Josef
Unknown said:in my version of Bentley Map 08.11.07.113 does not exist.
Hmmm ... that's bad. But not surprising, V8i (SELECTseries 1) is quite old version and API is enhanced in every release.
But a workaround still can be implemented in my opinion and should be not extremely difficult: I assume, because the source data are SHP files, the imported geometry is a simple one, so it's point, line string and polygon (I am aware e.g. polygons can be imported as collection sometimes, but don't make it too complex for now ;-). Every feature has Geometry and GeometryType property. You can implement "element factory" that will take the source data and will create a new element based on the data. Because there should be 3 geometry types only, we are talking about 3 quite simple functions (create point, line string and shape).
I recall (long time ago) I tried to use Geometry.Clone() method to receive new clean element, but I guess it does not work as expected. But it's something I recommend to try in the first step as it's very simple approach.
Hy Jan,
I have checked how Bentle Map stores the Elements, attached a schema that illustrates the file positions.
To eliminate all unnecessary data, I want to attach the MSLINK link at the element following the "Associative Region" - element.
How can I do it?
Josef R.
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) Set pureElement = currentFeature.GetRelatedRegionElement Debug.Print pureElement.FilePosition ' ???? How select the element subsequent to pureElement (first member of RegionElement)
SET pureElement = ??????
processFeatureEelement currentFeature, pureElement
Loop
Hi Josef,
Unknown said:I have checked how Bentle Map stores the Elements, attached a schema that illustrates the file positions.
Forget file position information. It's true it can help in similar discussions, but the file position is evil even in my opinion. Not only in a plain MicroStation (the last time it made sense to work with FP was MicroStation/J), but especially in Bentley Map, where features are implemented is some way, that is not very important ... and changed in V8i (SELECTseries 2) in the case of associative elements and can change anytime again.
Unknown said:To eliminate all unnecessary data, I want to attach the MSLINK link
If I understand your requirement right, this sentece has no sense. There is no relation between mslink attachment and "defeaturizing" (removing XFM data) and these two tasks have to be discussed separately.
Unknown said:to attach the MSLINK link at the element following the "Associative Region" - element.
There is no MicroStation element called "Associative Region", it's more a mental concept. In this old XFM version to implement this concept, a cell is used. So if there is a polygon with hole, all polygons are encapsulated into a cell (in fact into two cells).
Because "polygon with hole(s)" is implemented differently in Bentley Map and MicroStation, I guess you will have to recreate the geometry in your code. In newer Bentley Map I assume it's also ensure by RemoveFeatureLinkages method ... but I am not sure.
Unknown said:How select the element subsequent to pureElement (first member of RegionElement)
As you can see, there is "a gap" between Bentley Map feature model (there feature and subfeatures) and MicroStation implementation (cell > cell > 2 shapes).
Without any testing, I think you should take geometry from 1st and 2nd subfeature and to create plain MicroStation "grouped hole" element (see "References an Element from its Cache" example in MicroStation VBA help) and when this new cell will be created, to attach mslink to it.
Dear Jan,
now the macro works, MSLINK is attached to the right graphical element, not like before where just all elements was linked to ODBC Database., the program takes a little longer, but that's no problem.
The strip of XFM Data for now is not working, in the dgn file remains a lot of unnecessary data, at the moment I can at least be productive.
Thank you for your help.
With regards
Attached the macro, maybe someone has the same problem and can improve it.
5305.dbXFM2DB.mvba