[cgma-dev] copying iGeom entities in occ...

shriwise shriwise at wisc.edu
Tue Aug 5 15:18:41 CDT 2014


Just checked and this fails when built w/ CUBIT as well.

Patrick
On 08/05/2014 03:13 PM, shriwise wrote:
>
> Hi all,
>
> 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.
>
>
> 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.
>
> 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.
>
>
> bool tag_copied_ent_test(iGeom_Instance geom)
> {
>
>   int err;
>
>   //create a tag
>   iBase_TagHandle test_tag;
>   std::string name("test_tag");
>   iGeom_createTag(geom, &name[0], 1, iBase_INTEGER, &test_tag, &err, 
> name.length());
>   CHECK( "ERROR: could not create tag" );
>
>   //create a test entity
>   iBase_EntityHandle cyl;
>   iGeom_createCylinder(geom, 5.0, 5.0, 0.0, &cyl, &err);
>   CHECK( "ERROR: could not create the cylinder" );
>
>   //set a value for this tag on the original
>   int value = 6;
>   iGeom_setIntData(geom, cyl, test_tag, value, &err);
>   CHECK( "ERROR: could not set the tag data" );
>
>   //create a copy
>   iBase_EntityHandle copy;
>   iGeom_copyEnt(geom, cyl, &copy, &err);
>   CHECK( "ERROR: could not copy the entity" );
>
>   //check to see if the tag is accessible
>   int bytes;
>   iGeom_getTagSizeBytes(geom, test_tag, &bytes, &err);
>   CHECK( "ERROR: could not get the tag size" );
>
>   if (bytes != sizeof(int)) return false;
>
>   iGeom_getIntData(geom, cyl, test_tag, &check_value, &err);
>   CHECK( "ERROR: could not get the tag data" );
>
>   if (check_value != value) return false;
>
>   //cleanup
>   iGeom_destroyTag(geom, test_tag, 1, &err);
>   CHECK( "ERROR: could not destroy tag" );
>
>   iGeom_deleteEnt(geom, cyl, &err);
>   CHECK( "ERROR: could not delete entity" );
>
>   iGeom_deleteEnt(geom, copy, &err);
>   CHECK( "ERROR: could not delete entity" );
>
>   return true;
> }
>
> -- 
> Patrick C. Shriwise
> Research Assistant
> University of Wisconsin - Madison
> Engineering Research Building - Rm. 428
> 1500 Engineering Drive
> Madison, WI 53706
> (608) 446-8173

-- 
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/cgma-dev/attachments/20140805/b4abdf42/attachment.html>


More information about the cgma-dev mailing list