<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    That is very interesting...<br>
    <br>
    It seems to me to indicate that either the attributes are being
    copied in a way that is unseen in GMT and that they are not
    accessible by CATag in itaps or that there is an error handling this
    flag.<br>
    <br>
    At any rate, expected behavior in CGM and iGeom are not aligning
    right now it seems. I'm going to hold off on transferring tag data
    in functions such as copyEnt for now. I will however, include the
    functions for copying tag data and creating iGeom entsets for any
    Body containing more than one RefEntity upon loading a file. <br>
    <br>
    As we continue this discussion, I will add or omit the tag data
    copying in as is appropriate based on our decisions. <br>
    <br>
    As for the topic at hand, my naive opinion is that attributes on the
    original should never be removed and transferring these attributes
    should be optional in both cases. I can't think of a scenario in
    which you would expect data do be deleted from the original upon
    copying it. It sounds like this may be the case, but its buried
    pretty deep? Is that right, Paul? <br>
    <br>
    Patrick<br>
    <br>
    <div class="moz-cite-prefix">On 08/06/2014 02:17 AM, Paul Wilson
      wrote:<br>
    </div>
    <blockquote cite="mid:53E1D691.2090902@engr.wisc.edu" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      Hi all,<br>
      <br>
      So....<br>
      <br>
      It seems that finish_copy() is called from 3 places.<br>
      <ul>
        <li>make_RefEdge() - effectively a copy operation of a refEdge</li>
        <li>make_RefFace() - effectively a copy operation of a RefFace</li>
        <li>copy_body() - effectively a copy operation for a Body</li>
      </ul>
      <p>The first 2 of these already have Boolean arguments with
        default values that determine whether or not finish_copy() is
        called.<br>
      </p>
      <p>The last of these does not have such a Boolean argument and
        always calls finish_copy().<br>
      </p>
      I'll note that there is also a method called prepare_for_copy()
      that is always called under the same conditions as, but before
      finish_copy().  <br>
      <br>
      I'm a little stumped about what exactly finish_copy() does since
      it <u><i>appears to</i></u> delete all the attributes, but it is
      called when the "copy_attribs" flag is true for make_RefEdge().<br>
      <br>
      I hesitated from digging deeper into the prepare_for_copy() and
      finish_copy() methods but I wonder if there is something happening
      that we don't see in their calls to: <br>
      <ul>
        <li>GeometryQueryTool::instance()->ige_export_geom() [from
          prepare_for_copy], and<br>
        </li>
        <li>GeometryQueryTool::instance()->ige_import_geom() [from
          finish_copy]</li>
      </ul>
      <p>Some of the concepts get pretty involved at this point...<br>
      </p>
      <p>Paul<br>
      </p>
      <br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 08/05/2014 04:57 PM, Timothy
        Tautges wrote:<br>
      </div>
      <blockquote
cite="mid:CALxxSwdjO7PU28rWZhZ3pXqoOsFNArBr_vT7PumUdeNa0cCbeA@mail.gmail.com"
        type="cite">
        <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 moz-do-not-send="true" 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 moz-do-not-send="true"
                          href="mailto:shriwise@wisc.edu"
                          target="_blank">shriwise@wisc.edu</a>><br>
                        <b><span style="font-weight:bold">To:</span></b>
                        "<a moz-do-not-send="true"
                          href="mailto:cgma-dev@mcs.anl.gov"
                          target="_blank">cgma-dev@mcs.anl.gov</a>" <<a
                          moz-do-not-send="true"
                          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, &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>-- 
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>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
-- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --
Paul Wilson ~ UW-Madison ~ 608-263-0807 ~ cal: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://bit.ly/pphw-cal">http://bit.ly/pphw-cal</a>
Professor, Engineering Physics. ~ <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://cnerg.engr.wisc.edu">http://cnerg.engr.wisc.edu</a>
Faculty Director, Advanced Computing Infrastructure</pre>
    </blockquote>
    <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>