building_your_application.htm

来自「acis说明文档」· HTM 代码 · 共 909 行 · 第 1/5 页

HTM
909
字号
.sln) (for NT_V<strong class='error'>Failed to parse (Missing texvc executable; please see math/README to configure.): C_8</strong>)</p><ol><li> Choose one of these configurations:<dl><dd><i>Release</i> - Use with HOOPS version 10 or higher to link release ACIS to V<strong class='error'>Failed to parse (Missing texvc executable; please see math/README to configure.): C_8</strong></dd></dl></li></ol><p>.0 release HOOPS or</p><ol><li><dl><dd><i>Debug</i> - Use with HOOPS version 10 or higher to link debug ACIS to V<strong class='error'>Failed to parse (Missing texvc executable; please see math/README to configure.): C_8</strong></dd></dl></li></ol><p>.0 debug HOOPS. </p><ol><li> Select from menu: <tt>Build-&gt;Build the library</tt></li></ol><a name="Building_the_SpaHPart.2C_SpaHBridge.2C_and_admhoops_Libraries_on_UNIX"></a><h2> <span class="mw-headline"> Building the SpaHPart, SpaHBridge, and admhoops Libraries on UNIX </span></h2><ol><li> Set the following environment variables:<dl><dd>set <b>A3DT</b> to your ACIS RX installation</dd><dd>set <b>ARCH</b> to the ACIS architecture you would like to build against</dd><dd>set <b>HOOPS_INSTALL_DIR</b> to the location of your HOOPS installation</dd><dd>set <b>HOOPS_VER</b> to the version of your hoops installation. </dd></dl></li><li> Change your working directory: <dl><dd><tt>cd $A3DT/src/ha_bridge</tt> (or src/ha_part or src/admhoops)</dd></dl></li><li> Build the library:<dl><dd><tt>make <i>arch</i></tt>; where <i>arch</i> is one of the following: <tt>aix aix64 hpux11 hpux64 linux linux_amd_64 solaris solaris_64</tt></dd></dl></li></ol><a name="Building_the_SpaHPart.2C_SpaHBridge.2C_and_admhoops_Libraries_on_Mac_OS_X"></a><h2> <span class="mw-headline"> Building the SpaHPart, SpaHBridge, and admhoops Libraries on Mac OS X </span></h2><ol><li> Open the desired Xcode project in <tt>A3DT/src/ha_bridge</tt> (or src/ha_part or src/admhoops), where <tt><b>A3DT</b></tt> is your ACIS installation location. </li><li> Update the settings regarding your HOOPS installation.<ol><li> In the <i>Groups &amp; Files</i> window, expand the <i>Target Category</i> and select the <b>target</b> (ha_bridge, ha_part or admhoops).</li><li> Click the <i>Info Button</i> in the main toolbar, or select <i>File-&gt;Get Info</i>.</li><li> Select the <i>Build</i> pane.</li><li> Scroll down through the settings to the two custom build settings <b>HOOPS_INSTALL_DIR</b> and <b>HOOPS_VER</b>.</li><li> Select <i>Edit Setting</i> for each one and enter the appropriate value.</li></ol></li><li> Click <i>Build</i>  on the main window. The library is placed in <tt>A3DT/src/ha_bridge/build</tt>, which is Xcode's default build location. To change the destination location:<ol><li> In the <i>Groups &amp; Files</i> window, select the <i>project icon</i> at the top of the window (titled ha_bridge, ha_part, or admhoops).</li><li> Click the <i>Info Button</i> in the main toolbar, or select <i>File-&gt;Get Info</i>.</li><li> Select the <i>General</i> pane.</li><li> Change the "Place Build Products In" setting to <b>"Separate location"</b> and enter your desired location.<dl><dd><b>Note: </b>The project supports two build styles, both of which link against ACIS release libraries and the HOOPS release library. The Development style builds with debug symbols on and optimization off. The Deployment style builds with debug symbols off and optimization level -O1.</dd></dl></li><li>Upon opening the project for the first time, the active Build Style is Development. To switch the style:<ol><li>Open the build results window by selecting Build-&gt;Detailed Build Results.</li><li>Select Deployment from the Active Build Style drop down list.</li></ol></li></ol></li></ol><a name="Building_as_a_Standalone_Application"></a><h1> <span class="mw-headline">Building as a Standalone Application</span></h1><ol><li>Create a batch file which sets the following environment variable: A3DT, ARCH, and PATH. An example of such a batch file is shown below:<dl><dd><a href="/r18/index.php/Image:BuildingStandAlone01.jpg" title="Image:BuildingStandAlone01.jpg">Image:BuildingStandAlone01.jpg</a></dd></dl></li><li>Choose from the two options below<dl><dd>Option 1:- Open the Visual Studio 2005 Command Prompt window by selecting</dd><dd>Start/All Programs/Microsoft Visual Studio 2005/ Visual Studio Tools/ Visual Studio 2005 Command Prompt. Drop the batch file created in the previous step into the command window and hit Enter.</dd><dd><a href="/r18/index.php/Image:BuildingStandAlone02.jpg" title="Image:BuildingStandAlone02.jpg">Image:BuildingStandAlone02.jpg</a></dd><dd><br></dd><dd>Option 2:- Add the following line to the batch file created in step one </dd><dd>"C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat. An example of such a batch file is shown below and follow the next steps.</dd><dd><a href="/r18/index.php/Image:BuildingStandAlone03.jpg" title="Image:BuildingStandAlone03.jpg">Image:BuildingStandAlone03.jpg</a><dl><dd><ul><li>Click on Start which in on the lower left corner of your screen</li><li>Select Run and it will open the following window</li><li>Type cmd in the window as shown below</li></ul></dd><dd><a href="/r18/index.php/Image:BuildingStandAlone04.jpg" title="Image:BuildingStandAlone04.jpg">Image:BuildingStandAlone04.jpg</a></dd></dl></dd></dl></li><li>Next drag and drop the batch file created using the above steps in the newly launched command window</li><li>Hit Enter. This should run the batch file and it will set all the required path need to build an ACIS based console application</li><li>Type devenv in the command window</li><li>Select File/New/Project or type Ctrl+Shift+N</li><li>Select Win32 from Visual C++ Option and Win32 Console Application from Templates, enter an appropriate name and a location and hit OK. This should create a stock project. For eg MyfirstAcisProject<dl><dd><a href="/r18/index.php/Image:BuildingStandAlone05.jpg" title="Image:BuildingStandAlone05.jpg">Image:BuildingStandAlone05.jpg</a></dd></dl></li><li>The Win32 Application Wizard will pop up, hit Next</li><li>Under the Application Settings&gt;Application type select Console application and Additional options select Empty project, then hit Finish</li><li>Under Project, select Add New Item In the Add New Item window, select Code for the category and C++ file (.cpp) as the template to use. Give it a desired name and location and hit add</li><li>Next we will setup the project settings. Open the Property Pages selecting the project name under the Solution Explorer, then hitting Alt-F7 or right click and select Properties. The following is a sample Project Properties screen (note: make sure that this is the properties screen for the project and not an item in the project).</li><li>Now expand the Configuration Properties and select C/C++ from the resulting list</li><li>Select the Configuration Manager button and then set the Active Solution configuration as follows and hit close.<dl><dd><ul><li>ARCH=NT_VC8_DLL -&gt;Release</li><li>ARCH=NT_VC8_DLLD-&gt;Debug</li></ul></dd></dl></li><li>Expand the C/C++ list and select General and add $(A3DT)/include in the Additional Include Directories  field</li><li>Next Select Preprocessor option from the C/C++ tree and append NT_VC8_DLL(or NT_VC8_DLLD),ACIS_DLL, SPA_NO_AUTO_LINK</li><li>Now expand the linker tree and select General option and  then add $(A3DT)/lib/$(ARCH) in the Additional Library Directories field</li><li>Next select Input option and then added the following libraries in Additional Dependencies field SPAAcis.lib SPABase.lib SpaLicExtBase.lib SpaLicErrGUI.lib</li><li>Select Apply, then OK</li><li>Now copy the set of code below these instructions into the cpp file</li><li>Select Build / Rebuild Solution (Ctrl+Alt+F7) </li><li>Viola Your program is read to useNow add the license key and make different calls to the ACIS functions to do wonderful things.</li></ol><ul><li>Code to Copy into .cpp file</li></ul><pre class="source-cpp"><span class="co1">// MyfirstAcisProject.cpp&nbsp;: Defines the entry point for the console application.</span><span class="co1">//</span><span class="kw2">#include</span> <span class="st0">&quot;acis.hxx&quot;</span><span class="kw2">#include</span> <span class="st0">&quot;kernapi.hxx&quot;</span><span class="kw2">#include</span> <span class="st0">&quot;lists.hxx&quot;</span><span class="kw2">#include</span> <span class="st0">&quot;acistype.hxx&quot;</span>&nbsp;<span class="kw4">void</span>			process<span class="br0">&#40;</span><span class="kw5">outcome</span> result<span class="br0">&#41;</span>;<span class="kw4">void</span>			process_file<span class="br0">&#40;</span><span class="kw4">FILE</span>* fp<span class="br0">&#41;</span>;<span class="kw7">ENTITY_LIST</span>		retrieve_sat_file <span class="br0">&#40;</span><span class="kw4">char</span> *fileName<span class="br0">&#41;</span>;<span class="kw4">void</span>			create_sat_file	<span class="br0">&#40;</span><span class="kw7">ENTITY</span> *ent, <span class="kw4">char</span> *fileName<span class="br0">&#41;</span>;<span class="kw4">void</span>			create_sat_file <span class="br0">&#40;</span><span class="kw7">ENTITY_LIST</span> <span class="kw7">elist</span>, <span class="kw4">char</span> *fileName<span class="br0">&#41;</span>;<span class="kw4">void</span>			Initialize_ACIS <span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="kw4">void</span>			Terminate_ACIS <span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="kw4">void</span>	        Check_Entity <span class="br0">&#40;</span><span class="kw7">ENTITY</span>* input<span class="br0">&#41;</span>;&nbsp;<span class="kw4">void</span> main<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>	api_start_modeller<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>;&nbsp;	Initialize_ACIS <span class="br0">&#40;</span><span class="br0">&#41;</span>;	<span class="co1">//add unlock license key here</span>&nbsp;	<span class="co1">//add ACIS calls here</span>&nbsp;	Terminate_ACIS<span class="br0">&#40;</span><span class="br0">&#41;</span>;&nbsp;	api_stop_modeller<span class="br0">&#40;</span><span class="br0">&#41;</span>;<span class="br0">&#125;</span>&nbsp;<span class="kw4">void</span> Initialize_ACIS <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>  <span class="kw5">outcome</span> result;&nbsp;  result = api_initialize_kernel<span class="br0">&#40;</span><span class="br0">&#41;</span>;  process<span class="br0">&#40;</span>result<span class="br0">&#41;</span>;&nbsp;&nbsp;  <span class="kw7">FileInfo</span> fileinfo;&nbsp;  fileinfo.<span class="me1">set_units</span> <span class="br0">&#40;</span><span class="nu0">1.0</span><span class="br0">&#41;</span>;  fileinfo.<span class="me1">set_product_id</span> <span class="br0">&#40;</span><span class="st0">&quot;ACIS (c) SPATIAL&quot;</span><span class="br0">&#41;</span>;&nbsp;  result = api_set_file_info <span class="br0">&#40;</span><span class="nu0">3</span>, fileinfo<span class="br0">&#41;</span>;  process <span class="br0">&#40;</span>result<span class="br0">&#41;</span>;&nbsp;<span class="br0">&#125;</span>	&nbsp;<span class="kw4">void</span> Terminate_ACIS <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>  <span class="kw5">outcome</span> result;&nbsp;  result = api_terminate_kernel<span class="br0">&#40;</span><span class="br0">&#41;</span>;  process<span class="br0">&#40;</span>result<span class="br0">&#41;</span>;&nbsp;<span class="br0">&#125;</span>&nbsp;<span class="kw4">void</span> process<span class="br0">&#40;</span><span class="kw5">outcome</span> result<span class="br0">&#41;</span><span class="br0">&#123;</span>  <span class="kw1">if</span> <span class="br0">&#40;</span>!result.<span class="me1">ok</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>   <span class="br0">&#123;</span>											print_warnerr_mess<span class="br0">&#40;</span><span class="st0">&quot;API&quot;</span>, result.<span class="me1">error_number</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="kw2">stdout</span><span class="br0">&#41;</span>;	&nbsp;  <span class="br0">&#125;</span> 	<span class="kw7">err_mess_type</span>* warnings =<span class="kw2">NULL</span>;  	<span class="kw4">int</span> nwarn = get_warnings<span class="br0">&#40;</span>warnings<span class="br0">&#41;</span>;  	<span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i = <span class="nu0">0</span>; i &lt; nwarn; ++i<span class="br0">&#41;</span>	<span class="br0">&#123;</span>  &nbsp;	<span class="kw3">printf</span><span class="br0">&#40;</span><span class="st0">&quot;Warning&nbsp;%d&nbsp;:&nbsp;%s<span class="es0">\n</span>&quot;</span>, warnings<span class="br0">&#91;</span>i<span class="br0">&#93;</span>,   find_err_mess<span class="br0">&#40;</span>warnings<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;  	<span class="br0">&#125;</span>  &nbsp;<span class="br0">&#125;</span>&nbsp;<span class="kw4">void</span> process_file<span class="br0">&#40;</span><span class="kw4">FILE</span>* fp<span class="br0">&#41;</span><span class="br0">&#123;</span>  <span class="kw1">if</span> <span class="br0">&#40;</span>!fp<span class="br0">&#41;</span>   <span class="br0">&#123;</span>			<span class="kw3">printf</span> <span class="br0">&#40;</span><span class="st0">&quot;Unable to open input/output File<span class="es0">\n</span>&quot;</span><span class="br0">&#41;</span>;	<span class="kw3">exit</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>;									  <span class="br0">&#125;</span> <span class="br0">&#125;</span>&nbsp;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?