//////////////////////////////////////////////////////////////////////
			// Code Example: Importing data: B-rep method 
			//
			//////////////////////////////////////////////////////////////////////


			// This function is passed the step number. This allows for an application to
			// produce code with several steps as demonstrated.
			// Return 1 if you have finished, 0 if otherwise and -1 to exit.

			int CMyCode::RunMyCode(int step)
			{

			// The code below is sample code. On exiting the function the bodies that
			// exist will be drawn

				int n_topols = 12;
				int n_relations = 14;

				PK_CLASS_t classes[12] = {PK_CLASS_body,  PK_CLASS_region, PK_CLASS_region, PK_CLASS_shell,
										  PK_CLASS_shell, PK_CLASS_face,   PK_CLASS_face,	PK_CLASS_loop,       
										  PK_CLASS_edge,  PK_CLASS_loop,   PK_CLASS_loop,	PK_CLASS_vertex};
				
				int parents[14]= {0, 0, 1, 2, 3, 3, 4, 4, 5, 7, 6, 6, 9, 10};
				int children[14] = {1, 2, 3, 4, 5, 6, 5, 6, 7, 8, 9, 10, 8, 11}; 
				
				PK_TOPOL_sense_t senses[14] = {PK_TOPOL_sense_negative_c,	PK_TOPOL_sense_positive_c,	PK_TOPOL_sense_none_c,
											   PK_TOPOL_sense_none_c,		PK_TOPOL_sense_positive_c,	PK_TOPOL_sense_positive_c,
											   PK_TOPOL_sense_negative_c,	PK_TOPOL_sense_negative_c,	PK_TOPOL_sense_none_c,       
											   PK_TOPOL_sense_negative_c,	PK_TOPOL_sense_none_c,		PK_TOPOL_sense_none_c, 
											   PK_TOPOL_sense_positive_c,	PK_TOPOL_sense_none_c};
				
				PK_BODY_create_topology_2_o_t options;
				PK_BODY_create_topology_2_r_t const_creation;	
				
				CString text;
				int finished = 0;

				PK_EDGE_attach_curves_o_t options_attach;
				PK_ENTITY_track_r_t tracking;
				
				double angle;
				int n_faces = 0;
				int n_edges = 0;
				int n_vertices = 0;
				
				PK_FACE_t faces[2] = {PK_ENTITY_null, PK_ENTITY_null};
				PK_SURF_t surfs[2] = {PK_ENTITY_null, PK_ENTITY_null};
				PK_LOGICAL_t face_senses[2] = {PK_LOGICAL_false, PK_LOGICAL_false};
				PK_EDGE_t edges[1] = {PK_ENTITY_null};
				PK_CURVE_t curves[1] = {PK_ENTITY_null};
				PK_VERTEX_t vertices[1] = {PK_ENTITY_null};
				PK_POINT_t points[1] = {PK_ENTITY_null};

				switch( step )
				{
				case 1:
					CExampleAppDoc::ExAppSetStatusBarString("Using the boundary representation method to import a cone to Parasolid");
					// Create topology
					PK_BODY_create_topology_2_o_m(options);
					
					PK_BODY_create_topology_2(n_topols, classes, n_relations, parents, children, senses, &options, &const_creation);

					if (const_creation.create_faults[0].state == PK_BODY_state_ok_c)
					{
						// Faces
						faces[0] = const_creation.topols[5]; // Topology 5
						faces[1] = const_creation.topols[6]; // Topology 6
						
						// Edges
						edges[0] = const_creation.topols[8]; // Topology 8
						
						//Vertices
						vertices[0] = const_creation.topols[11]; // Topology 11

						CExampleAppDoc::ExAppShowMessage("Created Topology");
					}
					else
					{
						CExampleAppDoc::ExAppShowMessage("Failed to Create Topology - stopping");
						return -1;
					}
					
					// Free the memory associated with the return structure
					PK_BODY_create_topology_2_r_f(&const_creation);	
					
					
					// Create Geometry

					// Plane 1 - Attached to topology 5
					PK_PLANE_sf_t plane1_sf;
					plane1_sf.basis_set.location.coord[0] = 0.0;
					plane1_sf.basis_set.location.coord[1] = 0.0;
					plane1_sf.basis_set.location.coord[2] = 10.0;
					plane1_sf.basis_set.axis.coord[0] = 0.0;
					plane1_sf.basis_set.axis.coord[1] = 0.0;
					plane1_sf.basis_set.axis.coord[2] = 1.0;
					plane1_sf.basis_set.ref_direction.coord[0] = 1.0;
					plane1_sf.basis_set.ref_direction.coord[1] = 0.0;
					plane1_sf.basis_set.ref_direction.coord[2] = 0.0;
					PK_PLANE_create(&plane1_sf, &surfs[0]);

					// Cone 1 - Attached to topology 6
					PK_CONE_sf_t cone1_sf;
					cone1_sf.basis_set.location.coord[0] = 0.0;
					cone1_sf.basis_set.location.coord[1] = 0.0;
					cone1_sf.basis_set.location.coord[2] = 0.0;
					cone1_sf.basis_set.axis.coord[0] = 0.0;
					cone1_sf.basis_set.axis.coord[1] = 0.0;
					cone1_sf.basis_set.axis.coord[2] = 1.0;
					cone1_sf.basis_set.ref_direction.coord[0] = 1.0;
					cone1_sf.basis_set.ref_direction.coord[1] = 0.0;
					cone1_sf.basis_set.ref_direction.coord[2] = 0.0;
					angle = (3.16159265358979 / 6);
					cone1_sf.radius = 0;
					cone1_sf.semi_angle = angle;
					PK_CONE_create(&cone1_sf, &surfs[1]);

					// Circle 1 - Attached to topology 8
					PK_CIRCLE_sf_t circle1_sf;
					circle1_sf.basis_set.location.coord[0] = 0.0;
					circle1_sf.basis_set.location.coord[1] = 0.0;
					circle1_sf.basis_set.location.coord[2] = 10.0;
					circle1_sf.basis_set.axis.coord[0] = 0.0;
					circle1_sf.basis_set.axis.coord[1] = 0.0;
					circle1_sf.basis_set.axis.coord[2] = -1.0;
					circle1_sf.basis_set.ref_direction.coord[0] = 1.0;
					circle1_sf.basis_set.ref_direction.coord[1] = 0.0;
					circle1_sf.basis_set.ref_direction.coord[2] = 0.0;
					circle1_sf.radius = (10 * (tan(angle)));
					PK_CIRCLE_create(&circle1_sf, &curves[0]);

					// Point 1 - Attached to topology 11
					PK_POINT_sf_t point1_sf;
					point1_sf.position.coord[0] = 0.0;
					point1_sf.position.coord[1] = 0.0;
					point1_sf.position.coord[2] = 0.0;
					PK_POINT_create(&point1_sf, &points[0]);

					CExampleAppDoc::ExAppShowMessage("Created 2 surfaces, 1 curve and 1 point");
				
					// Attach Geometry
					face_senses[0] = PK_LOGICAL_true;
					face_senses[1] = PK_LOGICAL_true;

					n_edges = 1;
					n_vertices = 1;
					n_faces = 2;

					PK_VERTEX_attach_points(n_vertices, vertices, points);
					PK_EDGE_attach_curves_o_m(options_attach);
					PK_EDGE_attach_curves_2(n_edges, edges, curves, &options_attach, &tracking);
					PK_FACE_attach_surfs(n_faces, faces, surfs, face_senses);

					PK_ENTITY_track_r_f(&tracking);

					CExampleAppDoc::ExAppShowMessage("Attached geometry to topology");
					
					// The model is now complete and can now be used for modelling in Parasolid

					break;
				default:
					int n_parts;
					PK_PART_t *parts;

					PK_SESSION_ask_parts(&n_parts, &parts);
					PK_ENTITY_delete(n_parts, parts);
					PK_MEMORY_free(parts);
					finished = 1;
				}

				return finished;
			}