2D/3D

 

Organizing the Data

Many design-intent and MCAD applications need to display several views of a 3D model, with each view having a unique orientation and set of view-specific 2D annotations. These views may exist as part of an overall drawing that contains it's own annotation information, background color, etc.. Since there are both 2D and 3D aspects to the scene graph, you should review the AEC/GIS/ECAD and 3D/MCAD scene-graph documents.

Such a hybrid scene graph typically includes the following concepts:

3D Model Library

Drawing

Views

The diagram below depicts how the scene graph might look:

 

drawing.gif

 

The HOOPS/3dGS pseudo-code corresponding with the blue portions of the diagram is listed down below. This code actually corresponds with the scene-graph contained in the 'mcad_drawing.hsf' file located in your <hoops>/datasets/hsf/cad directory (A screenshot of this HSF file is included at the beginning of this document). Visually explore it's scene graph in a dynamic fashion by loading it into the Hoops3DPartViewer, and then opening the 'Segment Browser' dialog. Additionally, review the ASCII readable version of 'mcad_drawing.hsf' (and thus the scene-graph), by saving the HSF file out to an HMF file and then loading it into a text editor.

// define the model

HC_Open_Segment("?Include Library");

  HC_Open_Segment("Model_0");

    HC_Open_Segment("drawing");

      HC_Open_Segment("view1");
   
        HC_Set_Modelling_Matrix(...);   // translate the view

        HC_Open_Segment("model");
          // define the model using shells
          // turn off the visibility of 'edges' (to hide the implicit 'shell' edges)
          HC_Set_Modelling_Matrix(...);   // rotate the view
        HC_Close_Segment();

        HC_Open_Segment("markup");
          // insert geometry to represent the 2D annotations
        HC_Close_Segment();

      HC_Close_Segment();  // close "view1"


      HC_Open_Segment("border");

        // insert geometry representing the border annotations (text, polylines, polygons, etc...)

        HC_Open_Segment("paper");
          HC_Set_Rendering_Options("depth range = (1,1)");
        HC_Close_Segment();

      HC_Close_Segment();  // close "border"

    HC_Close_Segment();    // close "drawing"


    HC_Open_Segment("library");
      HC_Set_Visibililty("off");

      HC_Open_Segment("master_objects");
        HC_Open_Segment("object1");
          // insert geometry defining this reusable object
          // set any attributes that are a fixed property of the object
        HC_Close_Segment();
      HC_Close_Segment();

      HC_Open_Segment("part");
        HC_Open_Segment("body1");
          // define the body using shells, lines, arc, etc...
          HC_Include_Segment(../../master_objects/object1");
        HC_Close_Segment(); 
      HC_Close_Segment();  

    HC_Close_Segment();  // close "library"
  
  HC_Close_Segment();    // close "Model_0"

HC_Close_Segment();      // close "?Include Library"


// include the model into the scene

HC_Open_Segment("?driver/opengl/window0");
  HC_Open_Segment("Scene");
    HC_Include_Segment("Model_0");
  HC_Close_Segment();
HC_Close_Segment();