<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hi all, <br>
    <br>
    I just ran into an interesting problem in CGM built with OCC. When
    an entity is copied, the original loses all user-applied tag
    information (or so it seems). I understand why a copy might not keep
    data from the original, but for the data to disappear from the
    original altogether seems like incorrect behaviour to me. <br>
    <br>
    <br>
    I wrote a test as an example of this below. The test fails on the
    red line. Any ideas as to why? I've tracked the number of tags on
    the entity and they seem to disappear in line 5804 of iGeom_CGMA.cc.<br>
    <br>
    Any help or insight for this would be very appreciated! I'm close to
    finishing my updates to the iGeom interface and this seems to be the
    last piece of the puzzle.<br>
    <br>
    <br>
    bool tag_copied_ent_test(iGeom_Instance geom)<br>
    {<br>
    <br>
      int err;<br>
    <br>
      //create a tag<br>
      iBase_TagHandle test_tag; <br>
      std::string name("test_tag");<br>
      iGeom_createTag(geom, &name[0], 1, iBase_INTEGER,
    &test_tag, &err, name.length());<br>
      CHECK( "ERROR: could not create tag" );<br>
    <br>
      //create a test entity<br>
      iBase_EntityHandle cyl;<br>
      iGeom_createCylinder(geom, 5.0, 5.0, 0.0, &cyl, &err);<br>
      CHECK( "ERROR: could not create the cylinder" );<br>
    <br>
      //set a value for this tag on the original<br>
      int value = 6;<br>
      iGeom_setIntData(geom, cyl, test_tag, value, &err);<br>
      CHECK( "ERROR: could not set the tag data" );<br>
      <br>
      //create a copy<br>
      iBase_EntityHandle copy; <br>
      iGeom_copyEnt(geom, cyl, &copy, &err);<br>
      CHECK( "ERROR: could not copy the entity" );<br>
    <br>
      //check to see if the tag is accessible<br>
      int bytes;<br>
      iGeom_getTagSizeBytes(geom, test_tag, &bytes, &err);<br>
      CHECK( "ERROR: could not get the tag size" );<br>
    <br>
      if (bytes != sizeof(int)) return false; <br>
    <br>
      iGeom_getIntData(geom, cyl, test_tag, &check_value, &err);<br>
    <font color="#cc0000">  CHECK( "ERROR: could not get the tag data"
      );</font><br>
    <br>
      if (check_value != value) return false;<br>
      <br>
      //cleanup<br>
      iGeom_destroyTag(geom, test_tag, 1, &err);<br>
      CHECK( "ERROR: could not destroy tag" );<br>
      <br>
      iGeom_deleteEnt(geom, cyl, &err);<br>
      CHECK( "ERROR: could not delete entity" );<br>
    <br>
      iGeom_deleteEnt(geom, copy, &err);<br>
      CHECK( "ERROR: could not delete entity" );<br>
    <br>
      return true;<br>
    }<br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173
</pre>
  </body>
</html>