Spatial Developer Tips & Tricks eBook

April 5, 2018 | Author: Anonymous | Category: Technology
Report this link


Description

1. Spa al Developer Tips & Tricks 2. Developer Tips & Tricks Articles taken from Spatial’s Quarterly e-Newsletter, The Spatial Blend ACIS Memory Manager 1 ACIS Adaptive Faceting 2 Configurable Translation using 3D InterOp 3 ACIS Healing Workflow 4 Choosing a Stitching Tolerance 6 Library Consolidation 7 Using Entity Point Distance Functionality 8 Spa al Developer Tips & Tricks 2 3. ACIS Memory Manager Deciphering the Memory Usage and Leaks Report After running his application, the user has a ‘mmgr.log’ file. You can use ACIS Memory Manager to keep track of memory This report contains information about memory usage and usage and leaks in your C++ application. leaks. By default, ACIS memory management is used only within ACIS code. However, the application developer can also use The Report has Two Parts: ACIS memory management within the application code. I. Memory Leaks details: c:appfilename.cpp(119) : {0000270302} at 0x093932F0 16 Bytes Type: 1 Call: 27 Advantages:  Route all memory requests through a common interface Where each line contains seven pieces of information, as for processing follows:  Allocate and deallocate memory, and allow this to be  The first two are the file and line where the allocation customizable by the application developer took place  Pattern-fill unused memory with SNaN (Signal Not A  The rest provide additional details to track the exact Number) or other easily recognizable data to help spot allocation call which leaked. The third field is allocation references to uninitialized memory sequence number, followed by the address of the storage  Collect statistics about memory usage, such as who location, and the number of bytes allocated. To be able allocates memory, how much memory is being used, the to make full use of this information see ‘Breaking’ on a maximum amount of memory used, and where memory Particular Allocation Number. leaks have occurred II. Memory usage statistics How to Implement:  Use ACIS_NEW and ACIS_DELETE instead of ‘new’ and  High-water-mark: 3022316 Bytes ‘delete’, respectively  Bad delete pointers: 0  Stack high-water-mark: 333948 Bytes  To get the complete memory report, initialize base  Elapsed seconds: 16.315 component with base_configuration parameter enable_ audit_leaks=TRUE By Mohit Jain, Software Developer  Similarly, to customize memory allocation and deallocation, customer can plug-in their own allocator/ deallocator functions to base_configuration Spa al Developer Tips & Tricks 1 4. ACIS Adaptive Faceting The adaptive faceting algorithm offers significant quality and performance. To increase the quality of facets, change the global option header adaptive_triangles (or adaptive_t for short) to TRUE. Normally the faceting algorithm estimates the number of grid lines necessary for a surface, and for the sake of performance, does not refine any further. This works very well for the vast majority of surfaces. But for surfaces that vary greatly in curvature, having low curvature in some area and high curvature in other areas, this approach will not necessarily meet surface and normal tolerances. This can be compensated for by using adaptive faceting, which will make the faceting algorithm further refine the facets until it does meet tolerances. The result is that surfaces with highly varying degrees of curvature will improve in rendering quality. Click here for more information on Adaptive Faceting. By Guy Radcliffe, Software Engineer Spa al Developer Tips & Tricks 2 5. Configurable Translation A common use of this workflow is in translation of large assemblies. Often an application only needs to translate a few Using 3D InterOp parts or sub-assemblies, so translating the entire assembly would incur unnecessary performance costs. 3D InterOp translators have a flexible interface which gives 1. Use SPAIDocumentAssemblyInfo to create an xml an application developer many more options than traditional summary of the product structure for the input assembly. one step file-to-file translation. Application developers can use this flexible interface to configure the mode of file import/ 2. Parse the xml file and its nodes to process the product export in their application. structure to obtain the file names and paths of the parts or sub-assemblies. The Basic Workflow Consists of Three Steps: 3. Use the file names and paths to convert each part or sub- 1. Query the source file for document type using the assembly file individually. This could be done in a loop or SPAIDocumentHeaderInfo interface, and then query even in different processes of a multi-process application. for key document settings (e.g. units) and/or summary information using the appropriate document info class By Venugopal Chiramdasu, Software Developer (SPAIDocumentBRepInfo or SPAIDocumentAssemblyInfo). These query methods load only small sections of the file and are faster than doing a full translation. 2. Use the queried information to configure the conversion step using the SPAIOptions and SPAIConverter classes. During this step the user can also review the summary information to determine if some or all of the file or associated files should be converted. 3. Finally, perform the conversion as specified. Spa al Developer Tips & Tricks 3 6. ACIS Healing Workflow  Geometrical inaccuracies  Topological inaccuracies Working with Imported CAD Models in ACIS The workflow efficiently addresses these issues to create an The more advanced modeling operations customers intend optimized ACIS model. Here is the recommended workflow to perform, the more preprocessing of the ACIS model is for healing ACIS models. required. For example, a visualization application would need less preprocessing than an engineering application. The figure The workflow involves three steps: ‘Stitch’, ‘Simplify’ and below gives the typical preprocessing needed on a translated ‘Tighten gaps’. ACIS model for engineering applications. Step 1: Stitch The stitch (Tolerant Stitch) functionality builds topology, if not already present or partially present, in the translated ACIS model by stitching or sewing separate faces together to make a sheet or manifold solid body that is topologically complete. Is there a need to stitch? The stitch step is required if the customer application requires surface connectivity. If the incoming model is already stitched, then the stitch step can be skipped. How to customize stitch? The Tolerant Stitch functionality allows a tolerance parameter In comparison, a visualization application may import the to be passed for stitching the separate faces having gaps less CAD model into ACIS without any preprocessing. than this parameter value. For details on this click here. Healing Workflow Click here for more information on customizing the stitch The Healing Workflow improves CAD models imported into functionality. ACIS in order to make them most usable in ACIS. Models created in some other modeling system and translated into an Step 2: Simplify ACIS model may have: The simplify step converts spline data in the incoming model to corresponding analytic forms (for example: plane, cone, Spa al Developer Tips & Tricks 4 7. torus, or sphere) wherever possible. It results in reduction of Is there a need to Tighten Gaps? data size and speed improvements in geometric operations. The tighten gaps step can be skipped if:  There is no requirement on model tolerances being below Is there a need to simplify? a particular limit The simplify step can be skipped if:  There is no plan to do complex modeling operations like  The customer application does not require changes in the blending model geometry  The customer application does not want the gaps in the The tighten gaps step changes the model geometry and is model to increase (up to simplification tolerance) usually associated with increased data size. How to customize simplify? How to customize Tighten Gaps? The simplification functionality works with a user defined Users can pass in a ‘desired_gap_tightness’ parameter simplification tolerance. Users can set this tolerance value to to enable the functionality to tighten only those gaps in either: the model that are greater than this value. The ‘desired_  The source modeler tolerance in which the data was gap_tightness’ parameter should be same as the users created (best choice) manufacturing tolerance which is usually bigger than ACIS  If the above information is not available, then users can resolution SPAresabs. use their manufacturing tolerance (i.e. how big gaps user wants to permit)  105 is a good value to use by default for CAD & CAM applications Click here for more information on customizing the simplify  104 may be sufficient for CAE applications functionality By Rajesh Chakravarty, Software Developer Step 3: Tighten Gaps The Tighten Gaps step tightens the gaps (inaccuracies) in the input models by building geometry as necessary. In this phase a series of geometric operations are performed to improve the precision of face, edge, and vertex data. Geometry building essentially removes the gaps between adjacent surfaces by recomputing the intersections. Examples of tightening gaps Spa al Developer Tips & Tricks 5 8. Choosing a Stitching Tolerance Healing allows you to import a model and prepare it for use in ACIS. One of the key decisions you will need to make is specifying a stitching tolerance. It is advised that you choose a tolerance that is smaller than the minimum allowable feature in your application. So how do you choose a minimum allowable tolerance? Here are two types of applications and some guidance on choosing a minimum allowable tolerance: CAE Applications – In many analysis cases an edge length less than 1 mm is considered too small to affect the analysis output. In this case you would select 1 mm as the stitching tolerance. CAM Applications – Many machining processes allow users to have a surface accuracy of 1 micron, but an edge length below 1 mm is too small. In this case you would also select 1 mm as the stitching tolerance. The choice of tolerance depends on the specific application and should be selected carefully. If you use ACIS tolerance capabilities, the algorithm chooses by default a very high value of maximum stitch tolerance (of the order of 1.0). Internally the algorithm does incremental stitching by increasing the tolerance value until maximum stitch tolerance. The impact of using the ACIS default is that it may overrun the edges/faces that are part of the model and, therefore, may corrupt results (e.g. overlapping tolerant vertex due to edge removal). By Yogesh Biyani, Support Operations Manager Spa al Developer Tips & Tricks 6 9. Library Consolidation just performing a simple modeling operation. Having all core components “glued” together into a single ACIS dll eliminates dll jumps. Additionally, the linker optimizer can inline more Reducing the number of dll’s in your application by of these lightweight calls, avoiding function call overhead consolidating them into fewer numbers can produce many altogether. benefits. As an example, before ACIS R10, we built ACIS into a set of dll’s that corresponded to each ACIS component. In conclusion, there are lots of benefits to dll consolidation: For instance, blending functionality was in blend.dll and improved run-time performance, smaller disk footprint, advanced blending functionality was in abl.dll. and faster application start up. Consider this the next time you’re asked to tackle one of these problems and you may be In an effort to simplify our packaging, we consolidated like surprised. pieces of ACIS functionality into what we call ‘composite’ libraries. For example, all blending and advanced blending By Kevin Tatterson, Director QA & Production functionality are now merged into a single ‘composite’ library named SpaABlend.dll. In doing so, we achieved a 5% overall performance improvement. We continue to look at ways to consolidate dll’s. One area of investigation is placing all core ACIS functionality into a single dll: SpaACIS.dll. In our preliminary tests, we are observing a 5% performance improvement. Not only do we obtain a nice performance improvement each time we’ve consolidated many dll’s into fewer dll’s, but we also 1) make smaller the ACIS disk footprint (roughly 10% smaller), and 2) our ACIS based test applications start up much faster - up to 50% faster once cached. These types of improvements can be achieved within your applications through dll consolidation. We achieved these performance gains largely due to how ACIS is designed: while componentized, we make 100’s of thousands of lightweight calls into our “base” component Spa al Developer Tips & Tricks 7 10. Using Entity Point Within the multi-point interface, ACIS provides a ‘signed_ distance’ mode. In the default mode, ACIS returns the closest Distance Functionality point on the solid – so a point inside a body returns a distance of 0. In the ‘signed distance’ mode, ACIS returns the closest point on the solid boundary, so a point inside a body returns a The api_entity_point_distance algorithm has had significant negative distance. improvements in ACIS in recent releases. An optimized multi- point interface is available for large point sets – a common By Tony Hornbuckle, Software Engineer workflow for Metrology customers. The multi-point interface is ‘thread-hot’, and automatically makes use of multiple processor cores when ACIS threading is enabled. The API returns a distance and a closest point. Optionally we provide the closest entity and any relevant parameter information about the closest point on that entity. When using the algorithm, for best performance we recommend that:  The multi-point interface be used for all but the smallest sets of points – the optimizations can show benefits even for sets of 2 or 3 points  The application passes complete entities, rather than making multiple calls for each face on a body for a set of points – otherwise internal optimization may be bypassed Better performance is also gained if sequential points are close together – such as ‘scanline’ data. Spa al Developer Tips & Tricks 8 11. Learn More Find out how Spatial’s 3D Software Components will help you bring your market to application faster by signing up for a Free 90-day Product Evaluation: www.spatial.com/products/evaluation Read More Spatial Developer-Authored Articles at www.spatial.com


Comments

Copyright © 2024 UPDOCS Inc.