Using OpenCASCADE to import CAD data from step or iges formatted
This example will import a CAD file femoral head implant and visualise it.
Created May, 2011 by Hugh Sorby.
#Example_cad_implant: Import a CAD drawing saved in either step or iges formats. # # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is cmgui # # The Initial Developer of the Original Code is # Auckland Uniservices Ltd, Auckland, New Zealand. # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** */ # Import the CAD data gfx import file ${example}/femoral_head_implant.step # The CAD import function sets up three fields for each CAD entity found in # the file. A CAD entity is not only defined by the format but also from how # the object was constructed. For the femoaral head implant the CAD fields are # added to a region called "0:1:1:1". The import command will automatically # create three fields: temp0; temp0-geo; temp0-col. It will also set up an # RGB spectrum if one is not already defined, simply to use the CAD colour # field to colour the CAD entities correctly. The three fields that are # created on import are described here # DePuy...AP214 - This is the topological representation of the CAD entity, it is # essentially the interface between OpenCASCADE and Cmgui. This # field doesn't evaluate locations as it really knows nothing about # where it is. # DePuy...AP214_geo - This is the geometric representation of the CAD entity, # it is a triangulisation of the CAD entity elements # DePuy...AP214_col - This is a simple field that evaluates to, what may be # considered, the colour of the CAD entity when applied using the RGB # spectrum which is set up when the import command is used if not already # present. # Note: DePuy...AP214 is not the actual name of the field, it is a shortened form. The # actual field name is DePuy_S_FOR_47_9623_62_Femoral_Head_Impant___Not_to_size_STEPAP214 # To display the CAD entity the default coordinates need to be set to DePuy...AP214_geo # and a surface needs to be added. The lines are turned invisible because they # depict the construction and not the CAD entity outline as might be expected. gfx modify g_element "/" general clear; gfx modify g_element "/" lines coordinate DePuy_S_FOR_47_9623_62_Femoral_Head_Impant___Not_to_size_STEPAP214_1_geo tessellation default native_discretization NONE select_on invisible material default data DePuy_S_FOR_47_9623_62_Femoral_Head_Impant___Not_to_size_STEPAP214_1_col spectrum RGB selected_material default_selected; gfx modify g_element "/" surfaces coordinate DePuy_S_FOR_47_9623_62_Femoral_Head_Impant___Not_to_size_STEPAP214_1_geo tessellation default native_discretization NONE select_on material default data DePuy_S_FOR_47_9623_62_Femoral_Head_Impant___Not_to_size_STEPAP214_1_col spectrum RGB selected_material default_selected render_shaded; # Lets have a look at what we have gfx create window 1 # Look at a more more interesting aspect of the implant #gfx modify window 1 view parallel eye_point -130.869 -6.2138 277.71 interest_point 35.373 -52.323 0 up_vector -0.792015 0.408516 -0.453682 view_angle 40 near_clipping_plane 3.23963 far_clipping_plane 1157.73 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1; # So lets look at what this CAD entity has to say about itself
Name Modified Size
cad_implant.com 20-Apr-2012 4.6k 584_left_fitted.exelem 20-Apr-2012 355k 584_left_fitted.exnode 20-Apr-2012 269k COPYRIGHT 20-Apr-2012 504 femoral_head_implant.step 20-Apr-2012 890k
Name Modified Size
examples_a_backup_cad_implant.tar.gz 12-Aug-2014 753k
Status | Tested | Real time (s) | |
x86_64-linux | |||
cmgui-wx-gcc-cad-debug-memorycheck | Failure | Sun Mar 6 00:01:36 2016 | 0 |
last break | Wed Jun 3 16:07:00 2015 | 0 | |
last success | Wed Jun 3 00:05:00 2015 | 1 | |
cmgui-wx-gcc-cad-debug-valgrind | Failure | Sun Mar 6 00:02:16 2016 | 7 |
last break | Sun Mar 6 00:02:00 2016 | 7 | |
last success | Wed Jun 3 00:38:00 2015 | 45 |
x86_64-linux | |||
Failure | cmgui-wx-gcc-cad-debug-memorycheck: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-gcc-cad-debug-valgrind: | diff test: differences with generic answer; Test output. |
Html last generated: Sun Mar 6 05:50:53 2016
Input last modified: Fri Apr 20 15:56:50 2012