/* * Copyright (c) 1991-2023 by STEP Tools Inc. * All Rights Reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation is hereby granted, provided that this copyright * notice and license appear on all copies of the software. * * STEP TOOLS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. STEP TOOLS * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. * * Author: David Loffredo (loffredo@steptools.com) */ #include #include #include #include "toolpath.h" // BUILD TOOLPATHS - This is a sample Program that demonstrates the // ToolpathMaker class. This creates a design containing a toolpath // that simply wiggles around a bit using 3-axis and 5-axis moves. // // The ToolpathMaker class provides a high level API for creating // STEP-NC toolpaths. It holds state information and populates a // design with the underlying STEP-NC entity instances needed to // describe toolpaths, speeds, and feeds. int main(int argc, char* argv[]) { stplib_init(); // initialize manufacturing library /* Create a RoseDesign to hold the instance data */ const char * output_name = "output_file.stpnc"; RoseDesign * design = new RoseDesign (output_name); // Declare it as a STEP-NC file stplib_put_schema (design, stplib_schema_ap238); /* Give the design some Part 21 header information */ design-> initialize_header(); design-> header_name()-> originating_system ("Toolpath Demo"); design-> header_description()-> description ()-> add ("Simple STEP-NC program containing 3 and 5-axis moves"); ToolpathMaker nc; nc.Design (design); nc.Inches(); nc.Cutter(1,0,0,0,0,0,2); nc.LoadTool(1); nc.Feedrate (200); nc.SpindleSpeed (1000); nc.CoolantOn(); // Do some 5-axis moves nc.GoToXYZ ("first point", 0,0,0); nc.GoToXYZ_IJK ("", 1,2,3, 0,1,0); nc.GoToXYZ_IJK ("", 1,4,3, 0,1,0); // Go back to 3-axis moves nc.GoToXYZ ("", 10,0,0); // Do an ARC nc.Arc ("", -10,0,0, 0,0,0, 10, 1); // Do an arc in a different plane nc.GoToXYZ_IJK ("", -10,0,10, 0,1,0); // Do an ARC nc.SetDirection (0,1,0, -1,0,0); nc.Arc ("", -10,0,-10, -10,0,0, 10, 0); // Go back to 3-axis moves nc.GoToXYZ ("", 10,20,30); // Do some rapid 3-axis moves nc.Rapid(); int i; for (i=5; i<20; i+=5) { nc.GoToXYZ ("", 10.1+i,20.2+i,30.3+i); } // Exercise some of the other NC functions nc.PPrint ("", "Hello World"); nc.GoHome (""); nc.Stop (""); nc.Done(); design-> save(); return 0; }