📄 creating_a_specific_attribute_class.htm
字号:
<span class="kw7">FileInfo</span> fileinfo; fileinfo.<span class="me1">set_units</span> <span class="br0">(</span><span class="nu0">1.0</span><span class="br0">)</span>; fileinfo.<span class="me1">set_product_id</span> <span class="br0">(</span><span class="st0">"ACIS (c) SPATIAL"</span><span class="br0">)</span>; result = api_set_file_info<span class="br0">(</span><span class="nu0">3</span>, fileinfo<span class="br0">)</span>; check_outcome<span class="br0">(</span>result, <span class="st0">"FileInfo Error"</span><span class="br0">)</span>; <span class="co1">// Added </span> <span class="kw4">FILE</span>* save_file = <span class="kw3">fopen</span><span class="br0">(</span><span class="st0">"ExampleA-C.sat"</span>, <span class="st0">"w"</span><span class="br0">)</span>; <span class="kw7">ENTITY_LIST</span> slist; slist.<span class="me1">add</span><span class="br0">(</span>my_block<span class="br0">)</span>; api_save_entity_list<span class="br0">(</span>save_file, <span class="kw2">TRUE</span>, slist<span class="br0">)</span>; <span class="kw3">fclose</span><span class="br0">(</span>save_file<span class="br0">)</span>; <span class="co1">// Clean up</span> slist.<span class="me1">clear</span><span class="br0">(</span><span class="br0">)</span>; result = api_del_entity<span class="br0">(</span>my_block<span class="br0">)</span>; check_outcome<span class="br0">(</span>result, <span class="st0">"Clean Up Error"</span><span class="br0">)</span>; terminate_acis_components<span class="br0">(</span><span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Program ended without error.<span class="es0">\n</span>"</span><span class="br0">)</span>;<span class="br0">}</span> <span class="kw4">void</span> check_outcome<span class="br0">(</span><span class="kw5">outcome</span> result, <span class="kw4">char</span>* string<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="kw1">return</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Error %s<span class="es0">\n</span>"</span>, string<span class="br0">)</span>; <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Error %d - %s<span class="es0">\n</span>"</span>,result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span>, find_err_mess<span class="br0">(</span> result.<span class="me1">error_number</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">)</span><span class="br0">)</span>; <span class="kw3">exit</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>;<span class="br0">}</span> <span class="kw5">logical</span> initialize_acis_components<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="kw5">logical</span> result = <span class="kw2">TRUE</span>; result &= api_initialize_kernel<span class="br0">(</span><span class="br0">)</span>.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span>; result &= api_initialize_constructors<span class="br0">(</span><span class="br0">)</span>.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw1">return</span> result;<span class="br0">}</span> <span class="kw5">logical</span> terminate_acis_components<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="kw5">logical</span> result = <span class="kw2">TRUE</span>; result &= api_terminate_kernel<span class="br0">(</span><span class="br0">)</span>.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span>; result &= api_terminate_constructors<span class="br0">(</span><span class="br0">)</span>.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span>; result &= api_stop_modeller<span class="br0">(</span><span class="br0">)</span>.<span class="me1">ok</span><span class="br0">(</span><span class="br0">)</span>; <span class="kw1">return</span> result;<span class="br0">}</span></pre><p>Example. Sample Application Program (C)</p><a name="Complex_Attribute_Boolean_Conditions"></a><h3> <span class="mw-headline"> Complex Attribute Boolean Conditions </span></h3><p>The various notification functions on ATTRIB serve many needs; however, some modeling situations are troubling for complex <a href="/r18/index.php?title=Attributes&action=edit" class="new" title="Attributes">attributes</a>.</p><p>The following figure assumes that both faces <i>A</i> and <i>B</i> have instances of the same complex attribute. During a unite of the tool body containing face <i>A</i> with the blank body containing face <i>B</i>, the attribute on <i>B</i> is notified of a split. However, face <i>A</i> does not participate in the Boolean because it is neither split nor merged. Therefore, after the Boolean, the face <i>A</i> body pointer is still pointing at the now deleted tool body. This must be repaired after the Boolean.</p><div class="center"><div class="thumb tnone"><div class="thumbinner" style="width:182px;"><a href="/r18/index.php/Image:SPAkern_att_image012.gif" title="Image:SPAkern att image012.gif">Image:SPAkern att image012.gif</a> <div class="thumbcaption">Complex Attribute</div></div></div></div><p>Because the virtual functions do not solve all of these problems, the programmer must be aware that the application may have to do extra work. The application may have to scan the resulting body to determine whether attributes have been updated, and update them where necessary. For example, assume you have two blocks, and each block uses a simple attribute to identify each FACE. Now subtract one block (the tool), as shown in the figure below. This subtraction creates three new FACEs in the blank.</p><p><a href="/r18/index.php/Image:SPAkern_att_image014.gif" title="Image:SPAkern att image014.gif">Image:SPAkern att image014.gif</a></p><div class="center"><div class="thumb tnone"><div class="thumbinner" style="width:182px;"><a href="/r18/index.php/Image:SPAkern_att_image018.gif" title="Image:SPAkern att image018.gif">Image:SPAkern att image018.gif</a> <div class="thumbcaption">bool:subtract</div></div></div></div><p>During a Boolean operation, the blank and tool faces are split where they intersect. Each split creates a new face and one or more edges. By default, the new faces have no attributes. Later in the Boolean, containment is determined and the faces which are not part of the result are lost. There is no guarantee which faces will be lost. In some cases it will be the original and in others the faces created by the split. So in this example, if you need to have the attributes which are tagged to the tool FACEs automatically be transferred to the corresponding new FACEs created in the blank, you could either:</p><ul><li> set the split_action for your attribute to SplitCopy (which has caveats when dealing with complex attributes), or</li><li> override the split_owner method to write a custom style of "copy" for your attribute.</li></ul><!-- Tidy found serious XHTML errors --><!-- Saved in parser cache with key r18_docdb-r18doc_:pcache:idhash:443-0!1!0!!en!2!edit=0 and timestamp 20080624033107 --><div class="printfooter">Retrieved from "<a href="http://doc.spatial.com/r18/index.php/Creating_a_Specific_Attribute_Class">http://doc.spatial.com/r18/index.php/Creating_a_Specific_Attribute_Class</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_Getting_Started" title="Category:ACIS Getting Started">ACIS Getting Started</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/Creating_a_Specific_Attribute_Class" title="View the content page [c]" accesskey="c">Article</a></li>
<li id="ca-talk" class="new"><a href="/r18/index.php?title=Talk:Creating_a_Specific_Attribute_Class&action=edit" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li>
<li id="ca-viewsource"><a href="/r18/index.php?title=Creating_a_Specific_Attribute_Class&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=Creating_a_Specific_Attribute_Class&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=Creating_a_Specific_Attribute_Class" 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></li>
</ul>
</div>
</div>
<div class='portlet' id='p-products'>
<h5>products</h5>
<div class='pBody'>
<ul>
<li id="n-ACIS-Tutorials---Beta"><a href="/r18/index.php/Tutorial:ACIS_Tutorials">ACIS Tutorials - Beta</a></li>
<li id="n-InterOp"><a href="/r18/index.php/Portal:InterOp">InterOp</a></li>
</ul>
</div>
</div>
<div id="p-search" class="portlet">
<h5><label for="searchInput">Search</label></h5>
<div id="searchBody" class="pBody">
<form action="/r18/index.php/Special:Search" id="searchform"><div>
<input id="searchInput" name="search" type="text" title="Search DocR18 [f]" accesskey="f" value="" />
<input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go" />
<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" />
</div></form>
</div>
</div>
<div class="portlet" id="p-tb">
<h5>Toolbox</h5>
<div class="pBody">
<ul>
<li id="t-whatlinkshere"><a href="/r18/index.php/Special:Whatlinkshere/Creating_a_Specific_Attribute_Class" title="List of all wiki pages that link here [j]" accesskey="j">What links here</a></li>
<li id="t-recentchangeslinked"><a href="/r18/index.php/Special:Recentchangeslinked/Creating_a_Specific_Attribute_Class" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li>
<li id="t-specialpages"><a href="/r18/index.php/Special:Specialpages" title="List of all special pages [q]" accesskey="q">Special pages</a></li>
<li id="t-print"><a href="/r18/index.php?title=Creating_a_Specific_Attribute_Class&printable=yes" title="Printable version of this page [p]" accesskey="p">Printable version</a></li> <li id="t-permalink"><a href="/r18/index.php?title=Creating_a_Specific_Attribute_Class&oldid=1109" title="Permanent link to this version of the page">Permanent link</a></li> </ul>
</div>
</div>
</div><!-- end of the left (by default at least) column -->
<div class="visualClear"></div>
<div id="footer">
<div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="/r18/skins/common/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a></div>
<ul>
<li>© 1999-2008 Spatial Corp.</li>
<li> Please send feedback to <a href="mailto:docfeedback_spatial@3ds.com">docfeedback_spatial@3ds.com</a> or just <a href="../index.php?title=Special:Userlogin&returnto=Special:Userlogout">login</a> and start editing the comments page.</li>
</ul>
<ul id="f-list">
<li id="lastmod"> This page was last modified 15:53, 23 May 2008.</li>
<li id="viewcount">This page has been accessed 36 times.</li>
<li> <a href="../index.php/Project:Terms_of_Use">Terms of Use</a> </li>
<li> <a href="../index.php/Project:Privacy_policy">Privacy Policy</a> </li>
</ul>
</div>
<script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script> <script type='text/javascript' src='/r18/javascript_form/getXterlinks.js'></script> <script type='text/javascript'>getXterlinks()</script></div>
<!-- Served in 0.266 secs. --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -