Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Create Markups
It is assumed that before creating a markup, the following have been created: file structure (OdPrcFileStructure &newStructure), product occurrence (OdPrcProductOccurrencePtr &newProductOccurrence), tessellation data related to the markup (OdPrcMarkupTessPtr mTess), and markup leaders array (OdPrcMarkupLeaderPtrArray arr_leader). In addition, it is assumed that the name of the markup was provided (OdPrcName name).
  1. Add markup leader IDs to the product occurrence markup leader IDs array. Leaders are added to the file structure:
    
              OdPrcObjectIdArray &leaders = newProductOccurrence->markups().leaders();
              leaders.resize(arr_leader.size());
              for(OdUInt32 f=0;f<arr_leader.size();++f)
              {
                newStructure.addObject(arr_leader[f]);
                leaders[f] = arr_leader[f]->objectId();
              }
            
  2. Add markup leader tessellation data to the file structure tessellation:
    
              if (leaders.size() > 0)
              {   
                newStructure.fileStructureTessellation().tessellations().push_back(arr_leader[0]->tessellation());
                if (leaders.size() == 2)
                {
                  newStructure.fileStructureTessellation().tessellations().push_back(arr_leader[1]->tessellation());
                }
              }
            
  3. Create a new instance of the OdPrcMarkup class and add it to the file structure:
    
              OdPrcObjectIdArray &arr = newProductOccurrence->markups().markups();
              OdPrcMarkupPtr markup = OdPrcMarkup::createObject();
              newStructure.addObject(markup);
            
  4. Set markup attributes (name, type, tessellation data):
    
              OdPrcGraphics graph;
              markup->name() = name;
              markup->graphics() = graph;
              markup->setType(type);
              markup->setSubType(subtype);
              markup->tessellation() = mTess;
            
  5. Add leaders to the markup:
    
              OdPrcObjectId un_id;
              if (leaders.size() > 0)
              {
                un_id = leaders[0];
                markup->leader().push_back(un_id);
                if (leaders.size() == 2)
                {
                  un_id = leaders[1];
                  markup->leader().push_back(un_id);
                }
              }
            
  6. The ID of the newly created markup is added to the product occurrence markup IDs array (storing all markup data for a product occurrence is implemented in the OdPrcMarkups class):
    
                arr.push_back(markup->objectId());        
            
  7. Create annotation items for the markup and set its attributes:
    
              OdPrcObjectIdArray &arr_entity = newProductOccurrence->markups().annotationEntities();
              OdPrcAnnotationItemPtr ann_item = OdPrcAnnotationItem::createObject();
    
              ann_item->name() = name;
              ann_item->graphics() = graph;
            
  8. Link the created annotation item with the markup by specifying the markup ID:
    
              un_id = markup->objectId();
              ann_item->markup() = un_id;          
            
  9. Add the annotation item to the file structure and product occurrence annotation item IDs:
    
              newStructure.addObject(ann_item);
              arr_entity.push_back(ann_item->objectId());    
            
  10. Add markup tessellation data to the file structure tessellation:
    
              newStructure.fileStructureTessellation().tessellations().push_back(mTess);        
            

Creating different types of markups is illustrated in the OdPrcCreate sample application.

See Also

Create Markup Leaders
Markups Overview
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.