A non-transitory storing medium storing a program for creating a tool reference plane that is offset from a machining plane model in accordance with a tool shape model, the program comprising instructions for a processor to perform the following steps:
- storing machining plane model data that describes the machining plane model that is arranged in a first XYZ coordinate system;
- storing inversed tool shape data that describes the tool shape model that is inversely arranged in a second XYZ coordinate system, wherein the tool shape model has a tool reference point that is located at the origin of the second XYZ coordinate system;
- determining a plurality of sphere regions in the first XYZ coordinate system and the second XYZ coordinate system respectively, wherein center points of the sphere regions are grid points that are arranged three dimensionally with a predetermined grid interval and a radius of each sphere regions is equal to 31/2/2 times the predetermined grid interval;
- identifying a plurality of machining plane containing sphere regions, in which the machining plane model is contained, from among the plurality of sphere regions in the first XYZ coordinate system;
- further identifying, for each machining plane containing sphere region, a nearest point on the machining plane model from the center point of the machining plane containing sphere region;
- storing machining plane containing sphere region data, each of which describes the identified machining plane containing sphere region in association with the nearest point on the machining plane model identified based on the center point of the machining plane containing sphere region;
- identifying a plurality of inversed tool model containing sphere regions, in which the inversed tool model is contained, from among the plurality of sphere regions in the second XYZ coordinate system;
- further identifying, for each inversed tool model containing sphere region, a nearest point on the inversed tool model from the center point of the identified inversed tool model containing sphere region;
- storing inversed tool model containing sphere region data, each of which describes the identified inversed tool model containing sphere region in association with the nearest point on the inversed tool model identified based on the center point of the inversed tool model containing sphere region;
- identifying, based on the machining plane containing sphere region data and the inversed tool model containing sphere region data, a plurality of the tool reference plane containing sphere regions from among the plurality of sphere regions in the first XYZ coordinate system, wherein a sphere region in the first XYZ coordinate system is identified as a tool reference plane containing sphere region if one or more inversed tool model containing sphere regions make contact with one or more machining plane containing sphere regions when the sphere region has its center point coinciding with the tool reference point of the inversed tool model and the inversed tool model containing sphere regions are arranged inversely in the first XYZ coordinate system;
- further identifying one or more contact point containing sphere regions, wherein the one or more machining plane containing sphere regions making contact with the one or more inversed tool model containing sphere regions are identified as the contact point containing sphere regions;
- identifying a plurality of offset points, which is a step in which an offset candidate point identifying process is performed for each of the identified contact point containing sphere region to calculate one or more offset candidate points and to identify one of the identified offset candidate points that is contained within the tool reference plane containing sphere region and is closest to the center point of the tool reference plane containing sphere region as an offset point, wherein the offset candidate point identifying process comprises:
- retrieving, from the machining plane containing sphere region data, the nearest point on the machining plane model from the center point of the contact point containing sphere region;
- calculating a relative coordinate position from the center point of the contact point containing sphere region to the center point of the tool reference plane containing sphere region;
- identifying, from the inversed tool model containing sphere region data, one inversed tool model containing sphere region that has a relative position from the tool reference point to its center point equaling to the calculated relative coordinate position;
- retrieving, from the inversed tool model containing sphere region data, the nearest point on the inversed tool model from the identified inversed tool model containing sphere regions;
- and
- calculating the offset candidate point by shifting the retrieved nearest point on the machining plane model by an amount equal to the coordinate position of the retrieved nearest point on the inversed tool model;
- and
- storing tool reference plane model data that describes coordinate positions of the plurality of identified offset points.