Using WoodWOP Component Macros in ONGAA CAM. Easier Macros, Easier Use.

WoodWOP offers a way to create and reuse ‘multi step programs’ as ‘Component Macros’ which are in essence subprograms. Component Macros are great for repeated machining such as Cam Lock machining or Euro hinge machining or even dowel drilling/insertion. Since anything you can program in WoodWOP can become a Component Macro, they can be very powerful and at the same time they can be very complicated.

For a Component Macros to be of any use, we need to tell them ‘what to do’, ‘how to do it’ and ‘where’ to do it. The ‘what’ and ‘how’ may seem obvious, for example Horizontal Drill a 8mm hole 32 mm deep. But is it really that simple?

Many processes have macro parameters that depend on ‘where’ the process takes place. H. Drill for example needs the direction of drilling, X+, X- Y+ or Y- to be set. A wrong setting may cause a head crash.

The ‘where’ may also be deceivingly simple but it is not always so. Some macros always work in ‘machine coordinates’ while others can work with user defined coordinates systems.

The final challenge is telling the Comp. Macro everything that it needs to do all its programmed steps without access to outside information.

To illustrate what needs to happen, imagine you have a 3 axis machine with horizontal drilling capabilities but no horizontal milling. The part you are programming, a door, needs a pocket on a side to receive a lock mechanism. You would like to use a drill to repeatedly drill holes to rough out the pocket. How would you create a Component Macro to do this?

Let’s create it now!

The first thing we need to do is create a new program in WoodWOP and place the program in the /ML4 folder of WoodWOP. Call it the program ONG_MORTICE_HDRILL.mpr and saving it. WoodWOP will later look in this folder when it need to run it.

Before we start, the workpiece process needs some dimensions ,even though we won’t be using them. Put 10mm in for all three dimensions. This just to get rid of any warning messages.

Next, let’s really simplify the problem to get started. Let’s assume the pocket/mortice is exactly square and is the diameter of a drill you have, say 10mm, and is on Side A and is 30mm deep. This means we need only one drilling process (for now) in the Y+ direction.

Now add a H-Drill process, at X=0.0, Y=0.0 and Z=0.0. Make the direction Y+ and the diameter 10mm and the depth 30mm. We should now have a H-Drill symbol/outline hanging out in space at 0,0,0 pointing down (or up depending on your favorite view setting). (Save the program)

Single H Drill

This brings us to how we tell the main program ‘where’ to place this Comp Macro. Create a new program in /MP4 and add a Component Macro process. The process will ‘call’ our saved program and we will provide it with a X Y and Z offset. These three passed values are added to every X, Y and Z reference in all program steps. It shifts all the steps/macros the same amount.

So, if we call this with X=20, Y=0 and Z=_BSZ/2, the hole will be at 20 , 0 , half the thickness. So if the middle of the desired ‘simple square 10mm mortice’ is centered on 20, 0, _BSZ/2 its a good start. This what we get.

Now let’s make it longer. But how long will it be, or more importantly, how many drills holes will be required?

That’s where ‘parameters’ coming in. WoodWOP refers to these as ‘Component Values’. The calling program sets the values of variables in the program and we (the component macro) just use them like any variables we define. Note, the component macro program defines the name. The component macro process sets that name to a value.

So let’s create a variable called HD_LEN for the length of the pocket/mortice. The number of drills would be somewhere above HD_LEN / Tool DIA. But more precisely, the row length needs to be HD_LEN – Tool DIA and the spacing (matrix) would be that length / the number of holes.

To make this work, we will need to make some more variables. HD_DIA for the diameter, HD_NUM to work out the number and HD_SPC for the spacing. (and we might as well add the depth here too)

HD_LEN = 40 , to be set by the calling program ( but give it a value of 40 to start with )

HD_DIA = 10

HD_DEP = 30

HD_NUM = 2 + MOD( HD_LEN / HD_DIA )

HD_SPC = (HD_LEN-HD_DIA) / HD_NUM

These give us:

A) The tool diameter to calculate with.

B) The depth so the calling program can set it.

C) The number of holes that would fit, not overlapped, +2. To increase the amount of overlap, increase by more than 2.

D) The spacing required to get this number of holes inside the length – exactly.

With these values, we can turn our single hole into a row. Enable the grid option and set the length to HD_LEN – HD_DIA and set Matrix to HD_SPC.

40 mm length, 10mm dia., 30mm depth at X=20, Y=0, Z=_BSZ/2

The result is looking better, but now we want wider.

Just like HD_LEN, we need the calling program to let us how wide. We will need HD_WID as another variable.

Add HD_WID = 15 , to be set by the calling program but give is starting value of 15mm

For now, let’s assume that the we will always need 2 rows of holes. The first row would need to be offset from the upper edge by half a diameter. The lower row would be offset by half a diameter from the lower edge. Let’s duplicate the one HDrill process and then adjust the first Z up to the edge and the second Z down to the edge.

In the first HDrill, set the Z value to (HD_WID/2) – (HD_DIA/2). Up half a width then down half a diameter.

In the second HDrill, set the Z value to -(HD_WID/2)+(HD_DIA/2). Down half the width then up half a diameter. (save)

Length 40mm, Width 15mm, Depth 30mm – centered at X=20, Y=0, Z=_BSZ/2

If we want more rows we will need to add/(copy) more, but more than that, we will need to decide when we need them. For decisions we will use the Condition (?) parameter in the processes and another variable (for convenience because WoodWOP shows us the results on the screen).

So let’s copy(duplicate) the last HDrill and set the Z back to 0.0. The third row would be evenly spaced in the middle. (save)

Overlapping Horizontal drilling in three rows

This immediately gives us another row, which in this case is not needed. As we see in the earlier 2 row version, there is enough overlap already, at least for the 15mm wide pocket. We can use ‘does a 2 row overlap enough’ as a condition to turn is on or off.

In the variables add the following

HD_TST3 = IF HD_DIA * 1.75 > HD_WID THEN 0 ELSE 1

This means: If the diameter * 1.75 (a little less than 2) is larger than the width then 2 rows is enough. Send a 0 or OFF otherwise send a 1 or ON. Set the Condition (?) in the third row to HD_TST3. (save)

15mm width with the third row turned off.

If we widen the pocket to 25 mm we get the following.

25mm width which turns the third row on

Since we now have a way to turn things off or on, we would be smart to add a similar test to the first 2 rows. 1) If the diameter of the drill is larger than the width, don’t do anything and 2) if the width is exactly the diameter, don’t do the second row.

HD_TST1 = IF HD_DIA <= HD_WID THEN 1 ELSE 0

HD_TST2 = IF HD_DIA < HD_WID THEN 1 ELSE 0

Set the condition of the row 1 process to HD_TST1 and the condition for the row 2 process to HD_TST2.

Now we can rough out any length and any width (up to 3 X the diameter). We could extend the width further by duplication and adjusting the Z and condition tests, but for now this is enough.

So far, we have talked about a program written in WoodWOP program calling a Component Macro. In fact, so far, we have a component macro that only goes in one direction too (Y+). Now let talk about how ONGAA CAM calls this Component Macro. Magic…!

Let’s start with a part 36mm thick, it requires a 23 mm wide by 100mm long by 25mm deep pocket roughed out. The center of this pocket is 80mm (x) and 18mm (z).

In ONGAA CAM we create a Component Macro process and the select file we just created.

For location, which sets the X Y and Z, we select the sketch that was used to create the pocket cut-extrude. ONGAA CAM will take the geometric center of this rectangle. We will also select the face that the pocket is on. (I’ll explain why in a moment). We then open the ‘edit variables’ and set the tool diameter to 10 and the depth to 25.

For HD_LEN we enter &LA: and for HD_WID we enter &BR:. (In the download we have set these for you.) These two special values will set the length and width based on the sketch automatically.

This is what the inputs look like

 

This gives us the following program in WoodWOP. 3 rows in the Y plus direction. Just like we programmed it, perfect.

 

But what if I want the pocket in the Y minus direction? In WoodWOP most Component Macros come with 4 internal copies or each process with a test for SIDE. IF SIDE_A THEN turn on a copy of processes in the Y- and turn off all others. (etc.) This makes the programming of Component Macros very tedious and this is why most people don’t even try.

Pocket moved to the opposite side

In ONGAA CAM, the very same Component Macro we created for Y+ also work for Y- or for X+ and X- for that matter.

Remember that Face that was selected? That’s how ONGAA CAM does it. The face provides a new ‘rotated’ coordinate system. With this rotation, all the examples above are Y+. In fact the coordinate system also takes care of the X, Y, and Z. See below for what ONGAA CAM has provided the Component Macro. The F04 (in the first column, last row) is the coordinate system. HD_DIA and HD_DEP were manually entered. The Sketch and Face provides the rest.

 

The special values &LA: and &BR: can be permanently set in the component macro (available this way) and ONGAA CAM recognized these as max length and max width substitutions.

Also note that ‘Embed’ is turned on. This ‘delivers’ the component macro, ‘a complete copy’, inside the program that uses it. Now the programmer can create special machining routines, in the office, and deliver a completed, all in program, without having to send the component macros to the machine first.

 

I hope this example demonstrates that a relatively simple component macro can be made easily and flexibly and turned into a powerful new process for use with ONGAA CAM.

 

To download a copy of ONG_MORTICE_HDRILL.mpr right click here and select ‘save as’.

For other programming tips and tutorials go to Tutorials

 

Tags: ,

Verified by MonsterInsights