📄 _understanding_and_traversing_acis_topology_(part_iv).htm
字号:
err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; sys_error<span class="br0">(</span>err_no<span class="br0">)</span>; <span class="br0">}</span> <span class="kw6">API_END</span> <span class="kw1">if</span> <span class="br0">(</span>!result.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw7">err_mess_type</span> err_no = result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"ERROR in do_something() %d: %s<span class="es0">\n</span>"</span>, err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; <span class="br0">}</span> <span class="kw1">else</span> <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"do_something() completed successfully!<span class="es0">\n</span><span class="es0">\n</span>"</span><span class="br0">)</span>; <span class="br0">}</span> <span class="kw4">int</span> my_initialization<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">// Start ACIS.</span> <span class="kw5">outcome</span> result = api_start_modeller<span class="br0">(</span><span class="nu0">0</span><span class="br0">)</span>; <span class="kw1">if</span> <span class="br0">(</span>!result.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw7">err_mess_type</span> err_no = result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"ERROR in api_start_modeller() %d: %s<span class="es0">\n</span>"</span>, err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; <span class="kw1">return</span> err_no; <span class="br0">}</span> <span class="co1">// Call the licensing function to unlock ACIS.</span> unlock_spatial_products_963<span class="br0">(</span><span class="br0">)</span>; <span class="co1">// Initialize all necessary components. </span> result = api_initialize_kernel<span class="br0">(</span><span class="br0">)</span>; <span class="kw1">if</span> <span class="br0">(</span>!result.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw7">err_mess_type</span> err_no = result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"ERROR in api_initialize_kernel() %d: %s<span class="es0">\n</span>"</span>, err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; <span class="kw1">return</span> err_no; <span class="br0">}</span> <span class="kw1">return</span> <span class="nu0">0</span>;<span class="br0">}</span> <span class="kw4">int</span> my_termination<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">// Terminate all necessary components. </span> <span class="kw5">outcome</span> result = api_terminate_kernel<span class="br0">(</span><span class="br0">)</span>; <span class="kw1">if</span> <span class="br0">(</span>!result.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw7">err_mess_type</span> err_no = result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"ERROR in api_terminate_kernel() %d: %s<span class="es0">\n</span>"</span>, err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; <span class="kw1">return</span> err_no; <span class="br0">}</span> <span class="co1">// Stop ACIS and release any allocated memory.</span> result = api_stop_modeller<span class="br0">(</span><span class="br0">)</span>; <span class="kw1">if</span> <span class="br0">(</span>!result.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw7">err_mess_type</span> err_no = result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"ERROR in api_stop_modeller() %d: %s<span class="es0">\n</span>"</span>, err_no, find_err_mess<span class="br0">(</span>err_no<span class="br0">)</span><span class="br0">)</span>; <span class="kw1">return</span> err_no; <span class="br0">}</span> <span class="kw1">return</span> <span class="nu0">0</span>;<span class="br0">}</span></pre><a name="Discussion_2"></a><h3> <span class="mw-headline"> Discussion </span></h3><p>Comparing the header files of this example with the first example you should notice that cstrapi.hxx has been removed (because we are no longer using the constructor component to construct the block) and we have added to new header files: api.err and debug.hxx. api.err was added so we could generate an error message in the event we couldn't open the file containing the wire body. When generating the error we use the symbol API_FAILED, which produces a very generic error message about the function failing. In this example we no longer needed to initilize the constructor component, so we again initialized and terminated the kernel component.</p><p>The function begins by attempting to open the file "wire.sat." We could have queried for the file name or passed it in as an argument to the main program, but to keep the logic of the function as simple as possible, we simply hard coded the file name. (This implies that you need to name your SAT file "wire.sat".) The location of this file depends on your operating system and how you execute the example program. If you get an error message about not being able to open the file it probably means it is improperly named or in the wrong location.</p><p><br />After successfully opening the SAT file containing the wire body the program reads the contents of the SAT file using the API function: api_restore_entity_list(...). This function returns an ENTITY_LIST containing all of the top level ENTITIES. (For instance, if the file contained three bodies and all their lower topology, the ENTITY_LIST would contain the three bodies.) After opening and reading a SAT file you should always close the file. (In production software you would probably want to close the file before processing any errors returning from the API function, but since we are simplying exiting in the event of an error and we wanted to keep the logic of this example as simple as possible, we processed the error immediately after returning from the API function.) After reading the file, which hopefully contains a single wire body, we check to see if the first entity in the file was indeed a wire body, and if it wasn't we issue an error. </p><p>Our example program counts the number of edges, coedges and vertices in the wire body. There are many way to do this. One way would be to simply use the global functions to traverse the topology. We have instead used a seeded search algorithm. We create an ENTITY_LIST and seed it with a known coedge, obtained from the wire. For every coedge in the list we add its next, previous, and partner coedges. In this way we traverse all the coedges in the wire, because all coedges an be found by following next, previous, and partner pointers from any given coedge.</p><p>Would this algorithm work for finding all the coedges on a solid or sheet body? Give this some thought before reading the answer... Answer: It wouldn't not. Can you give <i>four</i> reasons why this would not work? (Multiple lumps. Multiple shells. Multiple loops. Non-manifold vertices. Why would each of these answers prevent the algorithm from working?) Can you modify this algorithm to generate a list of all the coedges on a solid or sheet body?</p><p>Given the list of coedges it is relatively straight forward to generate lists of edges and vertices, because the edge and vertices associated with each coedge can be obtained directly.</p><p>The last thing the function does is it creates a debug file containing a dump of the ACIS data structure. Can you create a diagram showing the vertices, edges, and coedges, including the directions of the edges and coedges, and the coedges' next and previous pointers? (Hint: It is usually easiest to start such a diagram by first locating the vertices. Each vertex has an underlying position. Then each edge can be drawn from its start to its end vertex. Then the coedge of each edge can be drawn, depending on whether it is FORWARD or REVERSED with respect to the edge. Finally add the next and previous pointers of the coedges. You only need to look at the geometry of edges (i.e., the curves underlying the edges) if there are multiple edges between two vertices or if there are closed edges.</p><a name="How_can_one_learn_more_about_ACIS_topology.3F"></a><h2> <span class="mw-headline"> How can one learn more about ACIS topology? </span></h2><p>The best way to understand ACIS topology is to generate ACIS models and examine their topological structures. Nothing can take the place of experience. Use the Scheme AIDE to generate simple models possessing the topological structures you are interested in, debug the data structure into text file, and create diagrams similar to those presented in this tutorial. Scheme scripts to generate the models described in this tutorial are provided in <a href="/r18/index.php?title=Scheme_scripts_for_Tutorial_3&action=edit" class="new" title="Scheme scripts for Tutorial 3">Scheme scripts for Tutorial 3</a>.</p><!-- Tidy found serious XHTML errors --><!-- Saved in parser cache with key r18_docdb-r18doc_:pcache:idhash:410-0!1!0!!en!2!edit=0 and timestamp 20080624045147 --><div class="printfooter">Retrieved from "<a href="http://doc.spatial.com/r18/index.php/Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29">http://doc.spatial.com/r18/index.php/Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29</a>"</div> <div id="catlinks"><p class='catlinks'><a href="/r18/index.php/Special:Categories" title="Special:Categories">Categories</a>: <span dir='ltr'><a href="/r18/index.php/Category:ACIS_Docs" title="Category:ACIS Docs">ACIS Docs</a></span> | <span dir='ltr'><a href="/r18/index.php/Category:ACIS_Tutorials" title="Category:ACIS Tutorials">ACIS Tutorials</a></span></p></div> <!-- end content -->
<div class="visualClear"></div>
</div>
</div>
</div>
<div id="column-one">
<div id="p-cactions" class="portlet">
<h5>Views</h5>
<div class="pBody">
<ul>
<li id="ca-nstab-main" class="selected"><a href="/r18/index.php/Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29" title="View the content page [c]" accesskey="c">Article</a></li>
<li id="ca-talk" class="new"><a href="/r18/index.php?title=Talk:Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29&action=edit" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li>
<li id="ca-viewsource"><a href="/r18/index.php?title=Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29&action=edit" title="This page is protected. You can view its source. [e]" accesskey="e">View source</a></li>
<li id="ca-history"><a href="/r18/index.php?title=Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_%28Part_IV%29&action=history" title="Past versions of this page. [h]" accesskey="h">History</a></li>
</ul>
</div>
</div>
<div class="portlet" id="p-personal">
<h5>Personal tools</h5>
<div class="pBody">
<ul>
<li id="pt-login"><a href="/r18/index.php?title=Special:Userlogin&returnto=Tutorial:ACIS_Tutorial_3:_Understanding_and_traversing_ACIS_topology_(Part_IV)" title="You are encouraged to log in, it is not mandatory however. [o]" accesskey="o">Log in / create account</a></li>
</ul>
</div>
</div>
<div class="portlet" id="p-logo">
<a style="background-image: url(/r18/images/SpatialCorpLogo.gif);" href="/r18/index.php/Main_Page" title="Visit the Main Page [z]" accesskey="z"></a>
</div>
<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
<div class='portlet' id='p-navigation'>
<h5>Navigation</h5>
<div class='pBody'>
<ul>
<li id="n--Home"><a href="http://doc.spatial.com/ "> Home</a></li>
<li id="n-mainpage"><a href="/r18/index.php/Main_Page" title="Visit the Main Page [z]" accesskey="z">Main Page</a></li>
<li id="n-recentchanges"><a href="/r18/index.php/Special:Recentchanges" title="The list of recent changes in the wiki. [r]" accesskey="r">Recent changes</a></li>
<li id="n-randompage"><a href="/r18/index.php/Special:Random" title="Load a random page [x]" accesskey="x">Random page</a></li>
<li id="n-help"><a href="/r18/index.php/Help:Contents" title="The place to find out.">Help</a></li>
</ul>
</div>
</div>
<div class='portlet' id='p-spatial_sites'>
<h5>spatial sites</h5>
<div class='pBody'>
<ul>
<li id="n--Spatial.com"><a href="http://www.spatial.com "> Spatial.com</a></li>
<li id="n---Online-Support-Center"><a href="http://spatial.custhelp.com/cgi-bin/spatial.cfg/php/enduser/acct_login.php?p_sid=tblNMDHh&p_lva=&p_sp=&p_li=&p_next_page=std_alp.php"> Online Support Center</a></li>
<li id="n--Community-Forum"><a href="http://forums.spatial.com/ "> Community Forum</a></li>
<li id="n--Downloads"><a href="http://www.spatial.com/products/download.html "> Downloads</a></li>
<li id="n--Feedback"><a href="mailto:docfeedback_spatial@3ds.com "> Feedback</a></l
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -