OpenSCAD to FreeCAD path generation on a sloping face

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
galgier
Posts: 3
Joined: Thu Jun 17, 2021 12:35 am
Location: Southern New Jersey

OpenSCAD to FreeCAD path generation on a sloping face

Post by galgier »

Hello,

Yes, this is my first time trying to make a 3D part with OPenSCAD and FreeCAD. I am a definite noob.

I have defined a simple shape in OpenSCAD that consists of a wedge shape on top of a block. This means the top surface is sloping downhill towards the Y axis. All my attempts to use FreeCAD to generate a G Code milling path shows a simulation that zigzags or spirals around the face, once. This does not look like it would properly go from a height (Z) of 19.05 mm at one edge to a height of 6.35 mm at the other edge.

I think the path would need to start at one edge and traverse parallel to the edge taking a little off at one edge and then work towards the other edge where a lot needs to be taken off. It would need to make many passes along the final edge taking a little every pass. Any diagonal (such as with a zigzag) cuts would need to change the Z value as the bit is cutting.

I must be missing some basic concept of generating a path when the cuts need to be orthogonal and multi-pass.

Can someone help me understand how to generate a proper path?

Gary
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by keithsloan52 »

galgier wrote: Sun Jun 20, 2021 6:53 pm Hello,

Yes, this is my first time trying to make a 3D part with OPenSCAD and FreeCAD. I am a definite noob.

I have defined a simple shape in OpenSCAD that consists of a wedge shape on top of a block. This means the top surface is sloping downhill towards the Y axis. All my attempts to use FreeCAD to generate a G Code milling path shows a simulation that zigzags or spirals around the face, once. This does not look like it would properly go from a height (Z) of 19.05 mm at one edge to a height of 6.35 mm at the other edge.

I think the path would need to start at one edge and traverse parallel to the edge taking a little off at one edge and then work towards the other edge where a lot needs to be taken off. It would need to make many passes along the final edge taking a little every pass. Any diagonal (such as with a zigzag) cuts would need to change the Z value as the bit is cutting.

I must be missing some basic concept of generating a path when the cuts need to be orthogonal and multi-pass.

Can someone help me understand how to generate a proper path?

Gary
Suggest if you can you post your scad or csg file.
galgier
Posts: 3
Joined: Thu Jun 17, 2021 12:35 am
Location: Southern New Jersey

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by galgier »

Below is the SCAD code. This is supposed to create a wedge shape on top of a slim block. This will be part of a spacer mounted behind something being placed against house siding. I will start with a board about 3/4 inches thick and take off the portion above the sloping face.

Code: Select all

module triangle_prism(b,d,h,ht,sc)
{
    linear_extrude(height=ht,scale=sc)
    polygon(points=[[0,0],[b,0],[d,h]]);
}
module wedge(x,y,z)
{
    translate([0,y,0]) rotate([90,0,0]) triangle_prism(x,x,z,y,1);
}
module block(x,y,z)
{
    cube(size = [x,y,z]);
}

// convert to mm while we are at it
      depth = 0.5 * 25.4;
      minimum = 0.25 * 25.4;
      height = 4 * 25.4;
      width = 6 * 25.4;
 
module section(x,y,z)
{
    hull () {
        translate([0,0,minimum]) wedge(x,y,z);
        block(x,y,z);
    }
}

section(height,width,minimum);
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by keithsloan52 »

galgier wrote: Wed Jun 23, 2021 11:14 pm Below is the SCAD code. This is supposed to create a wedge shape on top of a slim block. This will be part of a spacer mounted behind something being placed against house siding. I will start with a board about 3/4 inches thick and take off the portion above the sloping face.

Code: Select all

module triangle_prism(b,d,h,ht,sc)
{
    linear_extrude(height=ht,scale=sc)
    polygon(points=[[0,0],[b,0],[d,h]]);
}
module wedge(x,y,z)
{
    translate([0,y,0]) rotate([90,0,0]) triangle_prism(x,x,z,y,1);
}
module block(x,y,z)
{
    cube(size = [x,y,z]);
}

// convert to mm while we are at it
      depth = 0.5 * 25.4;
      minimum = 0.25 * 25.4;
      height = 4 * 25.4;
      width = 6 * 25.4;
 
module section(x,y,z)
{
    hull () {
        translate([0,0,minimum]) wedge(x,y,z);
        block(x,y,z);
    }
}

section(height,width,minimum);
Wondering if the hull operation is causing a problem as it results in the creation of a mesh, you could try replacing the hull request in the module section with a union.
withUnion.FCStd
(11.71 KiB) Downloaded 28 times
galgier
Posts: 3
Joined: Thu Jun 17, 2021 12:35 am
Location: Southern New Jersey

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by galgier »

I chose hull because when I first did this I read some warning somewhere about slightly disjointed pieces causing problems. A union could do this, a hull won't.

The original project has three sections created trough replication and translation. What I posted was a simplified single section.

I decided to rewrite it with no unions or hulls, just one solid:

Code: Select all

/*
 Make a spacer to fit behind something to be mounted to
 the outside of a house.  It fills the gaps caused by
 the sawtooth pattern of siding.
 
 This will make three sections.
 */

// convert to mm while we are at it
      maximum = 0.75 * 25.4;    // max thickness
      minimum = 0.25 * 25.4;    // min thickness
      height = 4 * 25.4;        // height of each siding piece
      width = 6 * 25.4;         // width of this device

translate([0,width,0])
rotate([90,0,0])
linear_extrude(height=width,scale=1)
polygon(points = [
    [ 0, 0 ],
    [ 0, minimum ],
    [ height, maximum ],
    [ height, minimum ],
    [ 2 * height, maximum ],
    [ 2 * height, minimum ],
    [ 3 * height, maximum ],
    [ 3 * height, 0 ]
    ]);
 
This reduces the job to only one solid, but it does not solve the problem.

I think what I am running into is the step value in the cutting with the tool. Path generation sets a 3.00 mm step and it can't be changed. For things I have already done with my mill (Genmitsu 3018) I have used a Z step / pass of 0.7mm. Where does one enter the constraints like maximum horizontal rate, spindle speed, Z step, etc? Anything I have seen seems to be read-only parameters.

Gary
Attachments
one-piece.FCStd
(18.6 KiB) Downloaded 23 times
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by keithsloan52 »

galgier wrote: Sat Jun 26, 2021 4:53 pm
I think what I am running into is the step value in the cutting with the tool. Path generation sets a 3.00 mm step and it can't be changed. For things I have already done with my mill (Genmitsu 3018) I have used a Z step / pass of 0.7mm. Where does one enter the constraints like maximum horizontal rate, spindle speed, Z step, etc? Anything I have seen seems to be read-only parameters.

Gary
In which case I think you might get a better response in Path/CAM section https://forum.freecadweb.org/viewforum.php?f=15
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by chrisb »

I completely missed this topic due to the OpenSCAD keyword in the title, which finally has nothing to do with the question. Moved to Path forum.

For such shapes you need a Path 3DSurface operation. Even better would be to span the stock sloped so you can mill 3 steps of a stair.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by sliptonic »

galgier wrote: Sat Jun 26, 2021 4:53 pm
I think what I am running into is the step value in the cutting with the tool. Path generation sets a 3.00 mm step and it can't be changed.
All the values can be changed. When you see a value in blue, that's the result of an expression being evaluated. Click on the icon in the corner of the input field to change the expression. You can clear it an enter any value you want.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by keithsloan52 »

chrisb wrote: Mon Jun 28, 2021 1:49 pm I completely missed this topic due to the OpenSCAD keyword in the title, which finally has nothing to do with the question. Moved to Path forum.

For such shapes you need a Path 3DSurface operation. Even better would be to span the stock sloped so you can mill 3 steps of a stair.
Still seems to be in General Help, rather than Path
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: OpenSCAD to FreeCAD path generation on a sloping face

Post by GeneFC »

keithsloan52 wrote: Mon Jun 28, 2021 3:56 pm Still seems to be in General Help, rather than Path
Moved.
Post Reply