Variational: Mill * Holes

This is a document explaining the hole features used in Synergy's Variational Design.

Mill * Holes * ( Feature Library )

What is a hole feature?
A hole feature is a specific type of Variational Strategy.    It is a play back method used in Variational Design to capture many sets of data and apply them against existing Synergy geometry.    You can place a hole feature in one of two ways.    You can choose to place them one at a time by choosing the Single option from the input line.    You can also place them at a group of points.    You can choose a group of points or circles.    If a circle is chosen then the hole feature will be placed at the center of the hole location.    The hole feature consists of one or more holes that were created by a tool.

This particular hole feature is a spotdrill that drills deep enough to create a chamfer.    Then, a HSS twist drill creates a hole that is as deep as the user specified.

Changing the information:

The hole feature data is contained in a record that cannot be picked on the screen.    In order to edit the data in a feature choose the Feature Variables button from the Modify Menu.    You will be asked the hole feature that you want to edit.    After picking it you will get several choices as seen in the picture below.

(see EditFeatureVars.bmp)

You can change any of the following:

Name - You can change this to change the name of the hole feature.    It is not recommended that you change it.

Finish_depth - This is the depth of the hole. This value determines where the bottom of the drill is at. Depending on the value of "Thru_hole" this value may be modified.

Hole_diameter - This determines the size of the hole. It is standard and changing it will have no effect on the holes you see on the screen.

Chamfer - This will specify the size of the chamfer to be placed around the top of the hole.

Thru_hole - This can be one of two values. It is a true/false switch with 1 (true) being a thru hole and 0 (false) being a blind hole.    A thru hole will automatically add the distance of the tip of a pointed drill onto the value for the finish_depth.

Z_offset - This value specifies that the top level of the hole is somewhere other than where the hole was placed.    If you have flat geometry, you may pick a circle for placement.    However, the actual location of that hole may be 1 inch below the top of the part.    So you would specify this value to be -1.


Also included in the variable list are choices for different tool combinations.    There is a possibility of using 5 different tools during a drilling operation.    Mostly you may use anywhere from 1 to 4 of these tools.    Using these variables at run time is not the recommended use of the system.    It is recommended that you create a library of hole features for use at job creation.    That will be covered later.    For now, there are 2 sets of variables for each type of tool.    One to specify the directory in the tool library where that type pf tool can be found and the name of the tool file as found in the tool library.


Spotdrill_dir , Spotdrill - Specifies the spotdrill to be used for starting a hole and chamfering.

Cdrill_dir, Cdrill - Specify a center drill to use to create a start hole. (Generally, use this or a spot, not both)

Predrill_dir, Predrill - For larger holes a preliminary drill will drill to depth to create a starting hole.

Drill_dir, Drill - The drill to be used to create the hole.

Csink_dir,Csink - A countersink to be used to place a chamfer on a hole.


The hole features are designed for a wide range of tooling possibilities.    So, in almost all cases, some of the tooling available in a hole feature will not be used.    These unused tools are then "blanked out".    The "blanked out" tools will have a value of either "- - - -" or "none".    That way that tool will not be used for that set of holes.    Generally the tool combinations for drilling may be a combination of either;


a spotdrill or a centerdrill with a countersink and,


a drill with the possibility of a pre drilled hole


or,


a single drill for carbide insert drills that self-start a hole.

In either case the tools not used should be given the value "- - - -".


There are 5 commonly used hole features.    To get a sense of how they can work the unique variables for each are described below (common variables have been left out):

Taps

Finish_depth - This specifies the depth of the drill only.

Thru hole - In the case of a tap the thru hole is generally 0 so that the drill only goes to finish_depth.

Tap_depth - The specific depth of the tap.    The depth of the drill is not effected by this number.

Tap_dir, Tap - Specify the location of the tapping tool.

Dowels

Ream_depth - Like the tap depth it specifies the ream depth.

Reamer_dir, Reamer - Specifies the reamer.    This tool will go to ream depth.

Plungemill_dir, Plungemill -- Specifies that an endmill should be used to ream depth.

Capscrews

Finish_allowance - For a roughing endmill.    This specifies the amount of stock on the head diameter.

Bottom_allowance-For a roughing endmill.    This specifies the amount of stock on the bottom of the head.

Thru_diameter - Not used.    Specifies the thru hole diameter for the pin.

Finish_depth - Specifies the depth of the thru hole.

Socket_head_dia - Specifies the counterbore diameter for the head.

Socket_head_depth - Specifies the depth of the counterbore for the head.

Second_chamfer - Not used.    Specifies the chamfer at the head/pin corner

Cbore_dir, Cbore - Specifies if a counterbore should be used to create the socket head.

Plungemill_dir, Plungemill -- Plunge an endmill to the counterbore_depth.

Roughmill_dir, Roughmill -- Round cut endmill.    Roughs the counterbore.

Finishmill_dir, Finishmill -- Round cut endmill.    Finishes the counterbore.

Leaderpins

Counterbore_diameter - The diameter to mill for the head of the leaderpin.

Counterbore_depth - The depth to mill for the head of the leaderpin.

Cbore_rgh_allow -- The finish allowance for roughing the counterbore.

Counterbore_chamfer - The chamfer around the top of the counterbore.  Ф Applies to csinks or chamfermills.

Boringbar_dir, Boringbar - A boringbar to be used in the thru hole for the leaderpin.

Chamfermill_dir, Chamfermill - The chamfering endmill around the top of the counterbore.

Chamf_add_depth - The additional depth to add on to the calculated depth of the chamfermill.

Plungemill_dir, Plungemill - Plunge an endmill to chamfer the head/pin corner.

How to create a hole feature

It is not recommended that you change the tools while trying to create a job.    Synergy is set up with a Knowledge Base that allows you to capture the data that you want to use.    The hole features are simply captured sets of data.    This data can be manipulated to get the results that the user requires.    So, there is a database of information held for each type of hole feature.    These entries can be modified or deleted and new ones can be added.    The data is contained in information packets that are stored in the;


/usr/weber/database/properties/HoleFeatures.d


and also contained in its sub directories.    In order to edit these, a process has been laid out for you in advance.

First, start a new job in Synergy.    Second, run the Design * Drafting * Table * External Tables * Import.

This will pop up a file box.    Under there go into the HoleFeatures.d directory and choose Inches or Metric.    There are two separate libraries for programming in Inch and in Metric.    You will get a menu that looks like this:

(See TableChoices.bmp)

These directories contain two tables.    First there is a data table.    This table contains all the values captured for different types of features.    Second, is the value table this is a table containing storage information.    For an example, proceed to the drilling directory and choose the drilldata.    Change to free point mode and place the table on the screen.    A sample layout can be seen in the figure below.

(See TableLayout.bmp)

The yellow highlighted area is represented in (See TableTop.bmp).    The Red outlined area represents an area where the columns start changing.    This area represents different hole features and will be discussed following (See TableMiddle.bmp)

The table on top is the drillvalues table.    It contains informational data that describes the data being stored.

The first two lines describe the names of the two tables that you placed on the screen.    Since you are going to create new data, change the names of the files by changing the drill part of the file name.    This will create unique filenames to store down the tables later.    To modify a table entry, go to Drafting * Table * Modify * Edit Entry.    Pick the boxed in area of the text (cell) and enter the new data.    The second part of the table contains information that describes the data packets.    Leave this section alone at this time.

The other table is the first few rows of the drilldata table.    It contains headings that correspond directly with the variables that are in the hole feature that we edited earlier.    The table contains many rows of data that represent different combinations of values for those variables.    In this way you can create as many unique hole features as you would like to create.    The first column is the name column.    This represents the name of the hole feature and also the file name of the holefeature. This name has two restrictions, it cannot have spaces and it cannot have minus signs ("-").

Find in the list the row for the twistdr.125.    You will see it has a half-inch spotdrill.    The two spotdrill variables represent the directory and the filename of the spotdrill.    Although the directory name seems unnecessary, it is used when you have a custom library that does not follow the Synergy Tool Library layout.    This provides another level of use flexibility.    In the centerdrill section (cdrill) there is no definition.    There cannot be a blank entry in the table so "- - - -" is used to show no value.    The same goes for the predrill and the countersink (csink).    The drilling hole feature has the ability to output 5 different holes that can be made by 5 different tools.    When an entry is voided out, no hole is output because there is no tool to associate to it.    The other tool that is defined is the drill which is always necessary since that is the purpose the hole feature.    The other tool entries are support tools that create start holes and chamfers.    That is all dependent upon your specific needs.    After the tooling are variable fields for hole_diameter, finish_depth, chamfer size, z level and a switch for specifying a thru or blind hole.    Since finish_depth and thru_hole are set by questions, the values specified here are only defaults.    For example, if you drill to 1.25 inches 80% of the time then you would set finish_depth to be 1.25 and that would show up in the "REP=" field of the question.    This way you can save on typing values.

The reason this table exists is so that you can create your own set of hole features.    We changed the names of the tables earlier so that unique tables could be stored down and saved.    The default table can be modified to fit your needs.    Under Drafting * Table * Modify the are several useful options.    You can use Delete Row to remove any row that you don't need in your hole features.    Also, you can use add or insert row to create a new row of blank data that can be filled in.    Two very useful commands are the Copy Entries and Copy Row routines.    When using these, you block out a section of the table to copy.    They are useful devices to save on typing. Earlier we also talked about the Edit Entry button for changing one cell of data.

If we look at the middle section of the table again

(See tableMiddle.bmp)

You notice that there are three different types of hole features.    The first has spotdrills and twist drills.    The second has a centerdrill, twistdrill and, a countersink.    The third has a is the same but with a pre-drill.

Examples of manipulating the table will be laid out here.    But, first choose File->Save Options->Backup.    This will save the file so that you can come back to it to make your own changes.    For now we will manipulate it to show some different editing techniques.

Whenever referring to a hole feature is proper to refer to its name in the first column of the table.    We will convert the twistdr.6562 thru the twistdr.7188 so they use spotdrills only.    All table edit functions can be found under the Drafting->Modify menu.

  1. Choose Copy entries.
  2. Pick the table.
  3. Pick the twistdr.5781 spotdrills entry (2nd column).
  4. Drag the box down two more rows and over one column to the right.    This will be the spotdr.750 box in the twistdr.625.
  5. Pick that box.    (This boxes in many cells at once.    It can be used to choose a cell by clicking it twice)
  6. Choose the twistdr.6562 2nd column.    This places the copied entries in the table.
  7.   
  8. Hit the undo button.
  9. Do steps 2-6 again. This time drag the box over 3 columns to the "- - - -" in the centerdrill column.    (This will enter the spotdrills and blank out the centerdrills)
  10. Do the same steps but now do them to the countersinks column.

Now that are targets are done, the new spotdrills are too large for the holes we want.    So we will change those three entries to read spotdr.875 instead of spotdr.750.

  1. Choose Edit Entry.
  2. Pick the spotdr.750 cell of the twistdr.6562.
  3. The old entry will come up in the input line.    You can choose to re-type it or click in the window and replace the 750 and with .875.    (Typing will overwrite a highlighted entry).
  4. Now that the entry has changed.    Choose the next cell.
  5. In order to answer this question, pick the previous cell that was changed in step #3.    Synergy can use the picking of text to answer questions.    Instead of typing the same value in again, pick it from existing data in the table.
  6. Repeat #4 and #5 with the next cell.

Let's take the example where you do not need any drills over .875 in diameter.    We will delete these tools from our small section.

  1. Choose Delete Row.
  2. Pick any cell in the twistdr.9062 row.    (The row will highlight)
  3. The question now asks to Undo (you didn't mean to delete it) or Proceed (go ahead and delete).    Choose Proceed.
  4. Now that the row is gone.    Pick the next 5 rows one at a time.
  5. Choose Proceed.    This will delete multiple rows at one time.

Hole features can be used in different instance.    If you look at the twistdr.750 row, you will notice there is a countersink available.    There may be an instance when you want to remove the countersink.    This can be accomplished in two ways.    First, when the twistdr.750 hole feature is used, edit the csink variable to be "none".    This will eliminate the tool.    The other way is to create two hole features.    One with a countersink and one without a countersink.

  1. Choose Insert Rows.    This will insert 1 or more blank lines into the table.    (For rows at the end of the table use Add Rows).
  2. Choose the twistdr.7656.    This is the row we want to insert the blank rows before.
  3. Enter 1 row to insert.
  4. Choose Copy Row.
  5. Pick the twistdr.750 cell.    This is the row we want to copy.
  6. Pick the first blank cell in the new row.    This is the destination and you will get a copy.    You will have two twistdr.750 rows.    We will change the second one (the copy).
  7. Choose Edit Entry.
  8. Choose the twistdr.750 cell in the copied row.
  9. Add a "_nocs" to the end of the twistdr.750 so it becomes twistdr.750_nocs.
  10. Choose the countersink directory and countersink tool entries in that column and replace them with "- - - -" from another cell.
  11. This method can be used to create different entries for

    Now go to File * Open * Recover Backup.    This will restore the tables as they looked previously.    You can now modify the table to contain the information that you need to create a hole feature library.

    Storing the table information

    When you are done creating your own hole features you will need to store them.    Storing them creates info packets in the directory you will specify.    When you choose a hole feature you are designating which packet will be used in answering the hole feature variables.

    Zoom up on the small table and the top of the large table.    (See Zoomin.bmp)    This is the drillvalues table.    It contains all the information you need to store the hole features.    You should have already changed the table path names.    The other field that will need changing is the Overwrite: field.    Change the Yes to Delete.    This will wipe out the drilling directory as it exists with the system and recreate as defined by the table.

    Go to the DrftCtrl * Property * Info packets * Create * Make Properties From Table.    Now here's the fun part.    Ignore the box that just popped up.    Look at the drillvalues table.    Each question that comes up will be answered in succession by the table.    So to answer the PACKET CLASS DIRECTORY question pick the table cell that contains HoleFeatues.d/Inches.d/drilling.    Then keep answering the questions down the list.

    When Synergy asks for what table to use, choose the large drilldata table.    You have now stored the hole features.    The only time caution needs to be used is at the overwrite question.    That question is not asked if the feature directory does not already exist.

    Creating a custom hole feature directory

    The process previously discussed will create hole features that are stored in the same directory as the hole features released with Synergy.    This can and will cause problems in the future when you load an update or patch.    Your first option is to read back in each of the tables for the hole features that you create and restore them.    The other option make it much simpler.    Add the following line to your userconstants file (if you do not have a custom one create it).

    V1=CreateVariable("hole feature sub dir",WsSystemVars,"HoleFeatures.d")

    However, change HoleFeatures.d to read something that is unique to you.    Such as using your company's initials and HoleFeat to make; (for Weber Systems)

    V1=CreateVariable("hole feature sub dir",WsSystemVars,"WS_HoleFeat.d")

    Your name should be a unique name so that it is not in danger of being over written by a Synergy update.

    In order to complement this action, go back to the tables and change the Directory: entry in the drillvalues from, HoleFeatures.d/ Inches.d/drilling

    to, WS_HoleFeat.d/Inches.d/drilling (whatever your name was above)

    Now, repeat the hole feature storage process but, use the new directory that you created.    You now have a unique set of hole features that you can delete, add, and modify freely.    Try this process on other hole feature types such as tapped holes and dowels.    This should be enough to cover all of you needs.    Test out your hole features first before proceeding onto the next part.    The next part will explain how you can create your own hole feature script to use with Synergy.    It is detailed and advanced.

    Creating custom hole feature scripts

    Creating a custom hole feature file can be done in two ways.    The most direct of which involves editing the file directly.    It may also require a knowledge of VDM techniques.    Go to Variational * Vcontrol * Strategy * Edit * File.    The hole feature file directory is located in;

    /usr/weber/database/strategies/

    1. Choose holefeatures.
    2. Under that there are two directories; inches and metric. One of these directories is chosen based upon what unit of measure you use to program your job. For our purposes go to inches.
    3. Choose drilling.
    4. There are two hole feature scripts here. Choose drillmaster. The pdrillmaster script is for mill-turn power tooling. (Note: Older systems may have individual file names that start with twistdr. They can be removed since they are outdated)

    The hole feature script: drillmaster

    The hole feature script is broken down into sections.    Each one will be explained as you read along.    What you will see is a Synergy strategy.    This is the Variational Design Module (VDM) technique of teach-in and play-back.    It will look very different but, for all differences there is a reason.    The strategy has a structure that must be followed in order for it to work.    Following this structure is easy when you know what to do and why things are a certain way.    That's what this document will accomplish.

    This script has its origins in Synergy.    It was created by teaching-in geometry through the graphical system.    However, over the years it has seemed easier to manipulate the script through editing rather than trying to create it through the system.    The next few pages will go through the script by showing a section first and then explaining it afterwards.    The sections are self-contained any information outside of them is ignored.

    START HEADER:

    Strategy file name: /usr/weber/database/strategies/holefeatures/inches/drilling/drillmaster

    Instruction 1:

    Instruction 2:

    END HEADER:

    This is the header information associated with the file.    It contains the name of the file and two lines for instructions.    The instructions are not commonly used with holefeatures.    The name should be changed when you are creating a new file.    A new file can be used through the Vdesign * Holes * User defined button.

    START STRATEGY SETTINGS:

    info packet strategy: 1

    edit strategy vars: 2

    END STRATEGY SETTINGS:

    The strategy settings are values to get the strategy to behave in different ways. The different values that can be used with hole features are:

    START ENTITY REFERENCES:

    END ENTITY REFERENCES:

    Describes any entity that must be picked to implement the strategy.    Not used in hole features.

    START TOOL REFERENCES:

    END TOOL REFERENCES:

    A different way to describe tooling non-variationally.    Not used in hole features.

    START PROPERTY DATA:

    Hole feature dir: Inches.d/drilling

    END PROPERTY DATA:

    This describes the subdirectory where the hole feature packets are stored.    This directory was specifed in the drillvalues table earlier in the document.    If you stored the packets under a different directory other than drilling, this value would have to be changed to match.    The value in the table had HoleFeatures.d at the beginning of the path.    That was for reference when storing down the packets.    This value describes where the features are underneath the "Hole feature sub dir" that you changed (or not) in userconstants.    This way you can change the "Hole feature sub dir" and not have to have a custom hole feature script.

    START VARIABLE REFERENCES:



    Xxx_ext_var_name: twistdr.3125: inactive: Name

    Xxx_ext_var_spotdrill_dir: spotdrills: inactive: Spot drill directory

    Xxx_ext_var_spotdrill: spotdr.500: inactive: Spot drill

    Xxx_ext_var_cdrill_dir: none: inactive: Center drill directory

    Xxx_ext_var_cdrill: none: inactive: Center drill

    Xxx_ext_var_predrill_dir: none: inactive: Pre drill directory

    Xxx_ext_var_predrill: none: inactive: Pre drill

    Xxx_ext_var_drill_dir: twistdrills: inactive: Drill directory

    Xxx_ext_var_drill: twistdrLq: inactive: Drill

    Xxx_ext_var_csink_dir: none: inactive: Countersink directory

    Xxx_ext_var_csink: none: inactive: Countersink

    Xxx_ext_var_hole_diameter: 0.375: diameter inactive: Hole diameter

    Xxx_ext_var_finish_depth: 1: depth active: Drill depth

    Xxx_ext_var_chamfer: 0.015: inactive: Chamfer

    Xxx_ext_var_z_offset: 0: inactive: Z offset value

    Xxx_ext_var_thru_hole: 0: active: Hole type ( 0 )BLIND or ( 1 )THRU

    END VARIABLE REFERENCES:

    These are the variables used for this hole feature.    You will notice a one-to-one correspondence with the headings in the drilldata table.    They are the same except for the Xxx_ext_var_.    That specifies that they are variables that are external to the strategy.    In other words, they can be changed by the user.    If it is necessary to add your own variable at any time you can add it here.    Just copy one of the other lines and change the name and default value.    The default value is after the first colon.    It is needed for strategies to be run but is not used in the hole features.    This value is overridden by the info packet that is chosen.

    There are 4 fields in each line of this section.    They are separated by colons.    The first two have already been described.    The third one is a field with nultiple uses.    If you look at the hole_diameter line you will notice that there are two words, diameter and inactive.    These are just 2 of the possible 9 values that can be in this section.    They are;

    active or inactive - One or the other is always specified.    An active variable will have questions asked.    An inactive variable will have no questions and must be changed through editing.

    global - Variables are unique to each hole feature unless global is set.    The cdrill variable in a tap is different than the cdrill variable in a dowel.    The global switch use the same variable for both.

    numeric - Specifies that a variable's value is a number and not a string.

    string - Specifies a variable's value is a string and not a number. A string can be both letters and numbers (i.e. "123"). So, string is used to specify that this variable should be initialized as a string and not a number. This way a value of "ABCD" can replace "123".

    4 other names allow you to specify that a variable contains more than just numeric data. diameter, radius, depth and, angle are used to modify the variables so that circles, lines and, holes can be picked where appropriate.

    START OBJECT: O1

    This section contains the rest of the file sections. It goes from here to;

    END OBJECT: O1

    This is called the VDM object. It is the encapsulation of data for the hole feature. Objects contain records.

    START RECORD:

    Record descr: FEATURE DATA: Twistdrill Operation

    This section is the beginning of the first record in the object. For hole features there is only one record. The record has a description specified at the beginning. This can be edited. However inside the code for the record there is a call to change it automatically to the name of the hole feature. This record goes until;

    END RECORD:

    That ends the first record. If another record were to be specified, it would follow this END RECORD with another START RECORD, then code, then another END RECORD. All of that would be contained in between the previously discussed START OBJECT and END OBJECT.

    The rest of the script is the record of the hole feature. This same code can be seen when the hole feature gets used in the system by using Vcontrol->Control->List->Record. The breakdown will be on a line per line basis.

    The first section of code is generally not touched. The first main editng area is the Finish_depth area.

    Vstr=StringConstant(FindNamedVar("Xxx_ext_var_name",WsVariationVars))

    The name variable is copied into the variable Vstr. StringConstant is a function used to create a temporary variable (Vstr) that is only active inside of this record. Whereas, all the variables discussed previously are always accessible. The Vstr is a Synergy script variable. Any of these temporary variables you will see are named V1,V2,Vstr etc. The common usage is to have a V as the first character. For this example Vstr will be equal to twistdr.250

    Vname= StringConstant(JoinStrings("FEATURE DATA: ",Vstr))

    Stat= CurrentRecordDescr(Vname)

    The Vname variable is created and then used to replace the record description with "FEATURE DATA: twistdr.250".

    Vtl=StringConstant("none")

    IF UPC$(VariableString(Vtl))<> "NONE" THEN

    Vtinst=StringConstant(JoinStrings("--",Vtl))

    ELSE

    Vtinst=StringConstant("")

    END IF

    A StringConstant can be changed just like a variable can be changed.    Use the Mill * Modify * Record Strings to edit the "none" in Vtl.    This string is used to append onto tool names so that you get distinct tool names per hole feature.    This is useful in AMO when you want to order when to use the twistdr.250 if it is used in more than one hole feature.    This functionality is only used when Vtl is something other than "none".    The Vtl portion will not show up when you edit Record Strings.    All that shows up in the list is the word none.

    V1=FreeParameter("Finish depth","Xxx_ext_var_finish_depth")

    V2=FreeParameter("Hole diameter","Xxx_ext_var_hole_diameter")

    V3=FreeParameter("Chamfer","Xxx_ext_var_chamfer")

    V4=FreeParameter("Thru hole","Xxx_ext_var_thru_hole")

    Mdef=HoleFeatureDef(WsDrillOperation,V1,V3,V2,V4)

    Stat=NameEntity(Mdef,"Xxx.Ent.Mdef1")

    Stat=SetMachDefDescr(Mdef,Vstr)

    The name variable is copied into the variable Vstr

    Vo1=StringConstant(JoinStrings("New func: 1",CHR$(10)))

    Odata=CreateUserData(WsOperation,Vstr,Vo1)

    Vo2=StringConstant("Group name:")

    Group1=CreateGroup("Xxx.Ent.G2",WsMachDefGroup)

    Stat=PutUserString(Odata,Vo2,"Xxx.Ent.G2")

    The name variable is copied into the variable Vstr

    Vtdirstr=StringConstant("Tools dir")

    Vtdir=FindNamedVar(Vtdirstr,WsSystemVars)

    Tool_lib=StringConstant(VariableString(Vtdir))

    The name variable is copied into the variable Vstr

    V1=StringConstant(VariableString("Xxx_ext_var_spotdrill_dir"))

    V2=StringConstant(VariableString("Xxx_ext_var_spotdrill"))

    V3=StringConstant(FileNameString(Tool_lib,V1,V2))

    Tool=ReadUserData(WsToolData,V2,V3)

    V4=StringConstant(JoinStrings(ToolIdName(Tool),Vtinst))

    Stat=NameEntity(Tool,V4)

    V1=FreeParameter("Diameter to chamfer","Xxx_ext_var_hole_diameter")

    H1=SpotDefinition("Xxx.Ent.Mdef1",Tool,WsSpotChamfer,V1)

    V1=FreeParameter("Spotdrill rap level","Xxx_ext_var_z_offset")

    Stat=SetMachDefValue(H1,WsHoleDefZoffset,V1)

    Stat=AddToGroup("Xxx.Ent.G2",H1)

    The name variable is copied into the variable Vstr

    V1=StringConstant(VariableString("Xxx_ext_var_cdrill_dir"))

    V2=StringConstant(VariableString("Xxx_ext_var_cdrill"))

    V3=StringConstant(FileNameString(Tool_lib,V1,V2))

    Tool=ReadUserData(WsToolData,V2,V3)

    V4=StringConstant(JoinStrings(ToolIdName(Tool),Vtinst))

    Stat=NameEntity(Tool,V4)

    H1=CdrillDefinition("Xxx.Ent.Mdef1",Tool)

    V1=FreeParameter("Cdrill rap level","Xxx_ext_var_z_offset")

    Stat=SetMachDefValue(H1,WsHoleDefZoffset,V1)

    Stat=AddToGroup("Xxx.Ent.G2",H1)

    The name variable is copied into the variable Vstr

    V1=StringConstant(VariableString("Xxx_ext_var_predrill_dir"))

    V2=StringConstant(VariableString("Xxx_ext_var_predrill"))

    V3=StringConstant(FileNameString(Tool_lib,V1,V2))

    Tlpre=ReadUserData(WsToolData,V2,V3)

    V4=StringConstant(JoinStrings(ToolIdName(Tlpre),Vtinst))

    Stat=NameEntity(Tlpre,V4)

    Hpre=DrillDefinition("Xxx.Ent.Mdef1",Tlpre)

    V1=FreeParameter("Predrill rap level","Xxx_ext_var_z_offset")

    Stat=SetMachDefValue(H1,WsHoleDefZoffset,V1)

    Stat=AddToGroup("Xxx.Ent.G2",Hpre)

    The name variable is copied into the variable Vstr

    V1=StringConstant(VariableString("Xxx_ext_var_drill_dir"))

    V2=StringConstant(VariableString("Xxx_ext_var_drill"))

    V3=StringConstant(FileNameString(Tool_lib,V1,V2))

    Tool=ReadUserData(WsToolData,V2,V3)

    V4=StringConstant(JoinStrings(ToolIdName(Tool),Vtinst))

    Stat=NameEntity(Tool,V4)

    H1=DrillDefinition("Xxx.Ent.Mdef1",Tool)

    Stat=ShareMachDefValue(Hpre,H1,WsHoleDefDepth)

    V1=FreeParameter("Drill rap level","Xxx_ext_var_z_offset")

    Stat=SetMachDefValue(H1,WsHoleDefZoffset,V1)

    Stat=AddToGroup("Xxx.Ent.G2",H1)

    The name variable is copied into the variable Vstr

    V1=StringConstant(VariableString("Xxx_ext_var_csink_dir"))

    V2=StringConstant(VariableString("Xxx_ext_var_csink"))

    V3=StringConstant(FileNameString(Tool_lib,V1,V2))

    Tool=ReadUserData(WsToolData,V2,V3)

    V4=StringConstant(JoinStrings(ToolIdName(Tool),Vtinst))

    Stat=NameEntity(Tool,V4)

    Vd1=FreeParameter("Diameter to countersink", GetMachDefValue("Xxx.Ent.Mdef1",WsDiameter1))

    H1=CsinkDefinition("Xxx.Ent.Mdef1",Tool,Vd1)

    V1=FreeParameter("Csink rap level","Xxx_ext_var_z_offset")

    Stat=SetMachDefValue(H1,WsHoleDefZoffset,V1)

    Stat=AddToGroup("Xxx.Ent.G2",H1)