[CONNECT C#] Grid created by Grid Manager

Hi,

I am trying to access the grid properties (grid lines, coordinates, orientation, etc.) of a OpenBuildings Designer model from a c# addin. I can see from the XML export that the used EC schema should be StructuralModelingComponents.06.00.

When I ask the DgnECManager for discover-able schemas, it doesn´t include that schema though.

List<string> schemas = Enumerable.ToList(manager.DiscoverSchemas(Session.Instance.GetActiveDgnFile(), ReferencedModelScopeOption.All, true));

I also tried

FindInstancesScope scope = FindInstancesScope.CreateScope(Session.Instance.GetActiveDgnFile(), new FindInstancesScopeOption(DgnECHostType.All, true));
IECSchema schema = manager.LocateSchemaInScope(scope, "StructuralModelingComponents", 6, 0, SchemaMatchType.Latest);


but with no success. 

The IntegratedStructuralModel schema wouldn´t work either.

Are grid lines somehow not part of the model or should I look in a different schema? 

Might there be a different way to access grids? 

See also https://www.itwinjs.org/bis/domains/processphysical.ecschema/#ismcartesiangrid for reference.

Parents
  • Hi Tilman,

    please respect and follow this forum best practices: Specify exactly what product and version (build number) do you use. The only information you shared so far is that you are on CONNECT Edition platform and you have design file, created in OpenBuilding (I guess OpenBuilding Designer?). But does it mean you use MicroStation to read the file? Or you have OBD (or some other OpenBuilding product)?

    of a OpenBuildings model

    Can you share a small example of the file?

    Might there be a different way to access grids? 

    You did not share the whole code and also you did not share any DGN example. I do not know a structure of OBD models in detail, but I assume grid lines etc. are standard MicroStation elements with EC data attached? In your code I do not see anything, that access these elements.

    Are grid lines somehow not part of the model or should I look in a different schema? 

    What exactly do you want to achieve?

    • To search for all grid lines etc. or
    • To access properties of some element (where you know, it is grid line)?

    Not at all! What you referenced is BIS (Base Infrastructure Schema), not EC schema used in PowerPlatform CE. BIS is the successor of EC, but it is not the same.

    With regards,

      Jan

  • Hi Jan,

    sorry, I also accidentally sent the post without a proper subject. (edit: found the edit button)

    So I created a very simple file with AECOsim Building Designer Connect Edition Update 4 - Version 10.04.00.69

    see /cfs-file/__key/communityserver-discussions-components-files/343173/grid.dgn

    To read the file I use Building Designer as well.

    As far as I understand, this is a feature specific to this product. Microstation (and OpenRail or OpenRoads) only allow a simple, regular grid (see screenshot). I am not looking for that (it´s stored in the ModelInfo btw).


    This is why I would assume that those grids are not part of the standard EC schema (but that´s just me guessing). When I try to export the grid to .xml I get the following output, which made me assume that the model would come with a StructuralModelingComponents.06.00 schema, which I can´t access/find.

    <?xml version="1.0" encoding="utf-16"?><ECInstanceXML>
    <IsmCartesianGrid instanceID=":56FF00000001:15A1A70000" xmlns="StructuralModelingComponents.06.00">
    <Id>0f779f2e-6908-49d0-88d2-e1d5c3e50cc8</Id>
    <Name>BuildingGrid</Name>
    <RAxis>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>1,0,0</xyz>
    </Coordinate>
    </RAxis>
    <SAxis>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>0,1,0</xyz>
    </Coordinate>
    </SAxis>
    <Origin>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>0,0,0</xyz>
    </Coordinate>
    </Origin>
    </IsmCartesianGrid>

    ...

    </ECInstanceXML>

    My thought was to use the ECManager to access the IsmCartesianGrid:

    FindInstancesScope scope = FindInstancesScope.CreateScope(Session.Instance.GetActiveDgnFile(), new FindInstancesScopeOption(DgnECHostType.All, true));
    IECSchema schema = manager.LocateSchemaInScope(scope, "StructuralModelingComponents_IsmCartesianGrid", 6, 0, SchemaMatchType.Latest);
    
    IECClass[] classes = ItemInstanceCollector.ItemInstanceCollector.GetSearchClasses(schema);
    ECQuery query = new ECQuery(classes);
    DgnECInstanceCollection instances = manager.FindInstances(scope, query);

    I am looking for the grid line geometry (start and end points of the lines in respect to the global coordinate system).

    Thanks for pointing out the difference to the BIS.

    Best,
    Tilman

Reply
  • Hi Jan,

    sorry, I also accidentally sent the post without a proper subject. (edit: found the edit button)

    So I created a very simple file with AECOsim Building Designer Connect Edition Update 4 - Version 10.04.00.69

    see /cfs-file/__key/communityserver-discussions-components-files/343173/grid.dgn

    To read the file I use Building Designer as well.

    As far as I understand, this is a feature specific to this product. Microstation (and OpenRail or OpenRoads) only allow a simple, regular grid (see screenshot). I am not looking for that (it´s stored in the ModelInfo btw).


    This is why I would assume that those grids are not part of the standard EC schema (but that´s just me guessing). When I try to export the grid to .xml I get the following output, which made me assume that the model would come with a StructuralModelingComponents.06.00 schema, which I can´t access/find.

    <?xml version="1.0" encoding="utf-16"?><ECInstanceXML>
    <IsmCartesianGrid instanceID=":56FF00000001:15A1A70000" xmlns="StructuralModelingComponents.06.00">
    <Id>0f779f2e-6908-49d0-88d2-e1d5c3e50cc8</Id>
    <Name>BuildingGrid</Name>
    <RAxis>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>1,0,0</xyz>
    </Coordinate>
    </RAxis>
    <SAxis>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>0,1,0</xyz>
    </Coordinate>
    </SAxis>
    <Origin>
    <Coordinate xmlns="">www.bentley.com/.../Bentley.Geometry.Common.1.0">
    <xyz>0,0,0</xyz>
    </Coordinate>
    </Origin>
    </IsmCartesianGrid>

    ...

    </ECInstanceXML>

    My thought was to use the ECManager to access the IsmCartesianGrid:

    FindInstancesScope scope = FindInstancesScope.CreateScope(Session.Instance.GetActiveDgnFile(), new FindInstancesScopeOption(DgnECHostType.All, true));
    IECSchema schema = manager.LocateSchemaInScope(scope, "StructuralModelingComponents_IsmCartesianGrid", 6, 0, SchemaMatchType.Latest);
    
    IECClass[] classes = ItemInstanceCollector.ItemInstanceCollector.GetSearchClasses(schema);
    ECQuery query = new ECQuery(classes);
    DgnECInstanceCollection instances = manager.FindInstances(scope, query);

    I am looking for the grid line geometry (start and end points of the lines in respect to the global coordinate system).

    Thanks for pointing out the difference to the BIS.

    Best,
    Tilman

Children