<br><br><div class="gmail_quote">On Wed, Jan 18, 2012 at 9:25 PM, Iulian Grindeanu <span dir="ltr">&lt;<a href="mailto:iulian@mcs.anl.gov">iulian@mcs.anl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div style="font-size:12pt;font-family:Times New Roman">Thanks Jane,<br>It is not urgent from my point of view. <br>It is better to have a well thought solution. <br>Are there other geometry formats that have the unit embedded? <br>
</div></div></blockquote><div><br>I didn&#39;t pay a lot attention on this before, but as you said, software usually doesn&#39;t support finding the units and do the conversions. Every software has it&#39;s own default length unit. When reading the the file, usually only the numbers matter.  <br>
<br>&#39;Unit&#39; in commercial softwares is working in this way:<br>Different global unit can be given by users through GUI, and was saved as a static in the code.<br><br>Here for iges, xstep.cascade.unit is the global static. In cgm, code should just check this static, which is just one call. And use it to read the files.<br>
<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-size:12pt;font-family:Times New Roman">Should we maybe establish an option, for iGeom load file, that will allow for a conversion (as a last resort?)<br>
</div></div></blockquote><div><br>I&#39;d think for now, without any GUI connected, the best way is to add in the iGeom_load function, an unit option in the &#39;options&#39; which indicate the unit (Acis will ignore this). This way users of cgm on OCC will have the control. I&#39;ll implement this way then.<br>
<br>Jane<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-size:12pt;font-family:Times New Roman">In general, I don&#39;t think we &quot;support&quot; unit conversion anywhere.<br>
<br></div></div></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-size:12pt;font-family:Times New Roman">
It is a complicated process, in general, although for geometry / mesh generation point of view, only length units are needed.<br><br>Thanks,<br>Iulian<br><hr><div><div class="h5"><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit" valign="top"><br><br>--- On <b>Wed, 1/18/12, Iulian Grindeanu <i>&lt;<a href="mailto:iulian@mcs.anl.gov" target="_blank">iulian@mcs.anl.gov</a>&gt;</i></b> wrote:<br>

<blockquote style="border-left:2px solid rgb(16,16,255);padding-left:5px;margin-left:5px"><br>From: Iulian Grindeanu &lt;<a href="mailto:iulian@mcs.anl.gov" target="_blank">iulian@mcs.anl.gov</a>&gt;<br>Subject: Re: [cgma-dev] question about iges format (to Jane)<br>
To: &quot;Jane Hu&quot; &lt;<a href="mailto:janejhu@gmail.com" target="_blank">janejhu@gmail.com</a>&gt;<br>Cc: &quot;jiangtao ma&quot; &lt;<a href="mailto:jiangtao_ma@yahoo.com" target="_blank">jiangtao_ma@yahoo.com</a>&gt;, &quot;CGMA Development&quot; &lt;<a href="mailto:cgma-dev@mcs.anl.gov" target="_blank">cgma-dev@mcs.anl.gov</a>&gt;<br>
Date: Wednesday, January 18, 2012, 2:06 PM<br><br>
<div>


<div>
<div style="font-size:12pt;font-family:Times New Roman">Hi Jane,<br>Thank you for looking into this.<br>So I verified that with this fix, the output coordinates in testgeom_occ are the same with the one from testgeom. <br>
This is &quot;hardcoded&quot;, so all iges files read by occ will be &quot;converted&quot; to M.<br></div>
<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f">That&#39;s  why I haven&#39;t checked in the code yet.</font></div><font color="#00007f"></font>
<div style="font-size:12pt;font-family:Times New Roman"><br>What field in igs file shows that the unit is M? Or is MM? I am still confused who does the conversion to MM, OCC igs reader ?<br></div>
<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f">In the iges file first several lines, with a &#39;G&#39; in the 73th column, you can find a 1HM, which shows the unit is one charactor &#39;M&#39;, if it&#39;s MM, it&#39;ll be 2HMM. The conversion to MM is done in Opencascade reader, we need to set up the global unit outside it to prevent the conversion in this case. </font></div>

<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f"></font> </div>
<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f">What I need to do is to add code in cgm to read iges/step file about the unit, and assign it to the reader, so it won&#39;t be hard coded to M.</font></div>

<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f"></font> </div>
<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f">I may take tomorrow off since I agreed to give a talk to my son&#39;s preschool about Chinese New Year, I&#39;ll try to fix it as soon as possible.</font></div>

<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f"></font> </div>
<div style="font-size:12pt;font-family:Times New Roman"><font color="#00007f">Jane</font></div><font color="#00007f"></font></div>
<div><br>Anyway, this has implications for MOAB too. With the current code, moab will convert the igs file to a faceted model, and in case of OCC it takes forever to facet (I think we have a unit issue there, as we use an absolute value for facet size, not a relative size of model)<br>
<br>I mean, if you do &quot;mbsize cducts.igs&quot; for mbsize built with OCC, it will not finish in more than 3 minutes I waited (I had to kill the process). I need to try after this fix.<br>While mbsize cducts.igs for moab built with cubit, finishes almost instantly.<br>
<br>Again, mbsize &lt;&gt;.igs will do a faceting of geometry first, then will output the size of the (faceted) mesh.<br><br>Thanks,<br>Iulian<br><br></div>
<div>
<div style="font-size:12pt;font-family:Times New Roman">
<hr>
</div>
<blockquote style="padding-left:5px;font-size:12pt;margin-left:5px;font-family:Times New Roman;border-left:2px solid rgb(16,16,255)">I need to code for reading the unit of iges, and set up the unit in the cgm.<br><br>For now, if you already knows the unit of the iges files, here is meter, then just add the following lines to OCCQueryEngine.cpp should work. Please let me know if it temporarily solves your problem.<br>
<br>--- OCCQueryEngine.cpp    (revision 5293)<br>+++ OCCQueryEngine.cpp    (working copy)<br>@@ -32,6 +32,7 @@<br> #include &quot;gp_Ax2.hxx&quot;<br> #include &quot;Geom_Surface.hxx&quot;<br> #include &quot;Geom_Curve.hxx&quot;<br>
+#include &quot;Interface_Static.hxx&quot;<br> #include &quot;BRepBuilderAPI.hxx&quot;<br> #include &quot;BRepBuilderAPI_Transform.hxx&quot;<br> #include &quot;BRepBuilderAPI_GTransform.hxx&quot;<br>@@ -1491,6 +1492,9 @@<br>
   else if(strcmp(file_type, &quot;IGES&quot;) == 0)<br>  
 {<br>     IGESControl_Reader reader;<br>+    char* name = &quot;xstep.cascade.unit&quot;;<br>+    char* val = &quot;M&quot;;<br>+    Interface_Static::SetCVal (name, val);<br>     const Standard_CString string1 = file_name;<br>
     IFSelect_ReturnStatus stat = reader.ReadFile( string1);<br>     if (stat  != IFSelect_RetDone)<br><br>Thanks.<br><br>Jane<br><br><br>
<div>On Wed, Jan 18, 2012 at 10:21 AM, Jane Hu <span dir="ltr">&lt;<a href="http://us.mc1616.mail.yahoo.com/mc/compose?to=janejhu@gmail.com" rel="nofollow" target="_blank">janejhu@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Hi, Iulian,<br><br>Opencascade internally assumes that OCC models are measured in millimeters, so if the model is given in unit M (meter), it&#39;ll be changed to 1000times larger and uses MM(millimeter) in OCC. I am now checking on the code, and see if we can do something on it.<span><font color="#888888"><br>
<br>Jane</font></span>
<div>
<div><br><br>
<div>On Wed, Jan 18, 2012 at 9:14 AM, Iulian Grindeanu <span dir="ltr">&lt;<a href="http://us.mc1616.mail.yahoo.com/mc/compose?to=iulian@mcs.anl.gov" rel="nofollow" target="_blank">iulian@mcs.anl.gov</a>&gt;</span> wrote:<br>

<blockquote style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div>
<div style="font-family:Times New Roman;font-size:12pt">Hi Jane,<br>Dan Le found this problem with respect to igs reader:<br>Please see the attached files.<br>testgeom.cc is a version of CGM/itaps/testgeom.cc file, which also prints the coordinates of all the vertices from the model.<br>
iges format is supported by OCC and Acis/cubit engines.<br>Still, the coordinates of the vertices are 1000 larger when occ is used.<br>So if you run this test<br>testgeom cduct.igs<br>in Cubit based cgm or<br>testgeom_occ cduct.igs <br>
in OCC based cgm,<br>you get different results (1000 times bigger in occ case). It seems that in cubit case, we do a conversion to sat format, first.<br><br>ITAPS GEOMETRY INTERFACE TEST PROGRAM:<br><br>   gLoad: Reading STEP/IGES file &#39;/home/iulian/tmp/test_lorenzo/cduct.igs&#39;...<br>
Model conversion succeeded: /tmp/CBT.Hoo5yc.sat<br>Read 6 ACIS Entities from the input file<br><br><br>Constructed 6 Volumes: 1 to 6<br>Model
 contents: <br>vertices: 24<br>edges: 24<br>faces: 6<br>regions: 6<br>vertex index 0 : 0 0 0<br>vertex index 1 : 0 1 0<br>vertex index 2 : 10.5 15 0<br>vertex index 3 : 11.5 15 0<br>...<br><br> testgeom_occ cduct.igs <br>
Geometry engine set to: OpenCascade 6.3<br><br><br>ITAPS GEOMETRY INTERFACE TEST PROGRAM:<br><br>   gLoad: Total number of loaded entities : 78.<br><br>Constructed 6 Volumes: 1 to 6<br>Model contents: <br>vertices: 24<br>
edges: 24<br>faces: 6<br>regions: 6<br>vertex index 0 : 0 0 0<br>vertex index 1 : 0 1000 0<br>vertex index 2 : 10500 15000 0<br>vertex index 3 : 11500 15000 0<br>...<br><br><br><br>Can you please tell me what we should do to get similar results  ?<br>
<br>Thanks,<br>Iulian<br><br></div></div></blockquote></div><br></div></div></blockquote></div><br></blockquote>
<div style="font-size:12pt;font-family:Times New Roman"><br></div></div></div></blockquote></td></tr></tbody></table></blockquote><br></div></div></div></div></blockquote></div><br>