<p dir="ltr">Remember, changing the interface will break compatibility with cubit. Also, this approach looks like flailing without understanding why the behavior is coded the way it is. Finally, iGeom should provide an interface to exactly the same code behavior as CGM functions do, and modifications meant only to change behavior between cgm vs iGeom interfaces should not be done.</p>
<div class="gmail_quote">On Aug 5, 2014 10:13 PM, "Rajeev Jain" <<a href="mailto:jain@mcs.anl.gov">jain@mcs.anl.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="color:#000;background-color:#fff;font-family:lucida console,sans-serif;font-size:10pt"><div><span>Hi Patrick,</span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent">
<span><br></span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent"><span>Good work. </span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent">
<span>How about we make another argument to the copy function?</span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent"><span>With this argument the blue code will be controlled. The argument's default will be true -> so
nothing changes.</span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent"><span>For your application the argument will be false (don't clear the attributes of the copied entities).</span></div>
<div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent"><span><br></span></div><div style="color:rgb(0,0,0);font-size:13px;font-family:'lucida console',sans-serif;font-style:normal;background-color:transparent">
<span>Rajeev</span></div><div><br></div> <div style="font-family:'lucida console',sans-serif;font-size:10pt"> <div style="font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:12pt">
<div dir="ltr"> <hr size="1"> <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> shriwise
<<a href="mailto:shriwise@wisc.edu" target="_blank">shriwise@wisc.edu</a>><br> <b><span style="font-weight:bold">To:</span></b> "<a href="mailto:cgma-dev@mcs.anl.gov" target="_blank">cgma-dev@mcs.anl.gov</a>" <<a href="mailto:cgma-dev@mcs.anl.gov" target="_blank">cgma-dev@mcs.anl.gov</a>> <br>
<b><span style="font-weight:bold">Sent:</span></b> Tuesday, August 5, 2014 3:49 PM<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [cgma-dev] copying iGeom entities in occ...<br> </font> </div> <div><br><div>
<div>
A little more info. Looks like this problem comes from the finish_copy call in GMT. If I comment the lines in blue, my new functions for copying tag data from one entity to another work as expected.<br>
<br>
My thought is to add a flags for these functions with regards to copying entity tag data/ attribute info. In the GMT functions the default will maintain the status quo (do not copy the attribute data) whereas in the iGeom interface the default will be to copy
the tag/attribute data. Does this sound acceptable for now? As of yet this is the only change I will need to make outside of the itaps dir in CGM.<br>
<br>
Cheers, <br>
<br>
Patrick <br>
<br>
CubitStatus GeometryModifyTool::finish_copy( TopologyBridge *&new_bridge,<br>
TopologyBridge *old_bridge )<br>
{<br>
//Remove attributes on underlying entities of virtual geometry<br>
//entities which do not have corresponding RefEntities.<br>
DLIList<TopologyBridge*> bridge_list;<br>
bridge_list.append( old_bridge );<br>
GeometryQueryTool::instance()->ige_remove_attributes( bridge_list );<br>
<br>
<font color="#cc0000"> //Remove attributes on original entity and children</font><br>
DLIList<RefEntity*> child_list;<br>
<font color="#000099"> RefEntity *ref_ent = CAST_TO( old_bridge->topology_entity(), RefEntity );<br>
ref_ent->get_all_child_ref_entities( child_list );<br>
//child_list.append( ref_ent );<br>
CubitAttribUser::clear_all_simple_attrib( child_list );<br>
child_list.clean_out();<br>
child_list.append( ref_ent );<br>
CubitAttribUser::clear_all_simple_attrib( child_list );<br>
</font><br>
<br>
//Restore virtual<br>
//Could create virtual geometry here so the Topology Bridge can change<br>
bridge_list.clean_out();<br>
bridge_list.append( new_bridge );<br>
TopologyBridge *tmp_bridge_before = new_bridge;<br>
GeometryQueryTool::instance()->ige_import_geom( bridge_list );<br>
assert( bridge_list.size() == 1 );<br>
if( tmp_bridge_before != bridge_list.get() )<br>
new_bridge = bridge_list.get();<br>
<br>
//make the RefEntities<br>
Curve *curve = NULL;<br>
Surface *surface = NULL;<br>
Lump *lump = NULL;<br>
BodySM *body = NULL;<br>
<br>
RefEntity *new_ref_ent = NULL;<br>
if( (curve = CAST_TO( new_bridge, Curve ) ) != NULL )<br>
new_ref_ent = GeometryQueryTool::instance()->make_RefEdge( curve );<br>
else if( (surface = CAST_TO( new_bridge, Surface) ) != NULL )<br>
new_ref_ent = GeometryQueryTool::instance()->make_RefFace( surface );<br>
else if( (lump = CAST_TO( new_bridge, Lump) ) != NULL )<br>
new_ref_ent = GeometryQueryTool::instance()->make_Body( lump->bodysm() );<br>
else if( (body = CAST_TO( new_bridge, BodySM) ) != NULL )<br>
new_ref_ent = GeometryQueryTool::instance()->make_Body( body );<br>
<br>
//actuate the attributes on everything<br>
child_list.clean_out();<br>
new_ref_ent->get_all_child_ref_entities( child_list );<br>
child_list.append( new_ref_ent );<br>
GeometryQueryTool::import_actuate( child_list );<br>
<br>
//Remove attributes on new entity and children<br>
child_list.clean_out();<br>
new_ref_ent->get_all_child_ref_entities( child_list );<br>
CubitAttribUser::clear_all_simple_attrib( child_list );<br>
child_list.clean_out();<br>
child_list.append( new_ref_ent );<br>
CubitAttribUser::clear_all_simple_attrib( child_list );<br>
<br>
CGMApp::instance()->restore_previous_attribute_states();<br>
return CUBIT_SUCCESS;<br>
}<br>
<br>
<div>On 08/05/2014 03:18 PM, shriwise wrote:<br>
</div>
<blockquote type="cite">Just checked and this fails when built w/ CUBIT as well.
<br>
<br>
Patrick <br>
<div>On 08/05/2014 03:13 PM, shriwise wrote:<br>
</div>
<blockquote type="cite"><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, ©, &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>--
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173
</pre>
</blockquote>
<br>
<pre>--
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173
</pre>
</blockquote>
<br>
<pre>--
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173
</pre>
</div>
</div><br><br></div> </div> </div> </div></div></blockquote></div>