discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

issue with difference function

F
fractorr
Thu, Dec 24, 2015 9:07 PM

I am having an issue with the difference function.  I created a polygon shape
and linear_extrude and put a hole in each end.  The hole does not show when
I turn debug off.  The first image shows with debug on.  The second image
has debug off.  With the third image I move the hole up just to show how far
it actually goes into the shape.  Any idea why the hole would not show with
debug off?

http://forum.openscad.org/file/n15327/shape_debug.png

http://forum.openscad.org/file/n15327/shape_no_debug.png

http://forum.openscad.org/file/n15327/shape_depth.png

--
View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I am having an issue with the difference function. I created a polygon shape and linear_extrude and put a hole in each end. The hole does not show when I turn debug off. The first image shows with debug on. The second image has debug off. With the third image I move the hole up just to show how far it actually goes into the shape. Any idea why the hole would not show with debug off? <http://forum.openscad.org/file/n15327/shape_debug.png> <http://forum.openscad.org/file/n15327/shape_no_debug.png> <http://forum.openscad.org/file/n15327/shape_depth.png> -- View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Thu, Dec 24, 2015 9:58 PM

Perhaps you have not set convexity appropriately in the linear_extrude, but
that is just a guess without seeing the code.

On 24 December 2015 at 21:07, fractorr fractorr@gmail.com wrote:

I am having an issue with the difference function.  I created a polygon
shape
and linear_extrude and put a hole in each end.  The hole does not show when
I turn debug off.  The first image shows with debug on.  The second image
has debug off.  With the third image I move the hole up just to show how
far
it actually goes into the shape.  Any idea why the hole would not show with
debug off?

http://forum.openscad.org/file/n15327/shape_debug.png

http://forum.openscad.org/file/n15327/shape_no_debug.png

http://forum.openscad.org/file/n15327/shape_depth.png

--
View this message in context:
http://forum.openscad.org/issue-with-difference-function-tp15327.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Perhaps you have not set convexity appropriately in the linear_extrude, but that is just a guess without seeing the code. On 24 December 2015 at 21:07, fractorr <fractorr@gmail.com> wrote: > I am having an issue with the difference function. I created a polygon > shape > and linear_extrude and put a hole in each end. The hole does not show when > I turn debug off. The first image shows with debug on. The second image > has debug off. With the third image I move the hole up just to show how > far > it actually goes into the shape. Any idea why the hole would not show with > debug off? > > <http://forum.openscad.org/file/n15327/shape_debug.png> > > <http://forum.openscad.org/file/n15327/shape_no_debug.png> > > <http://forum.openscad.org/file/n15327/shape_depth.png> > > > > -- > View this message in context: > http://forum.openscad.org/issue-with-difference-function-tp15327.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
F
fractorr
Thu, Dec 24, 2015 10:46 PM

The only parameter I pass to linear_extrude is height.

This is the code that draws the shape.

module draw_vee_side(degrees, rows=4, part_width, height=part_height) {
difference() {
union() {
linear_extrude(height=height)
polygon(points=[
[0, 0],
[part_width, vh],
[part_width, vh+(rowslane_width)],
[0, (rows
lane_width)]
], paths=[[0, 1, 2, 3]]);
}

	union() {
		// Pin Holes		
		for (pin=[0:rows-1]) {
	        translate([-part_width-(pin_depth),

vh+(lane_width*pin)+(lane_width_half), height/2])
rotate([0, 90, 0])
draw_pin_hole();
}
}
}
}

module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5,
height=part_height) {
draw_vee_side(degrees, rows, part_width, height);

mirror([1,0,0]) 
	draw_vee_side(degrees, rows, part_width, height);

}

draw_vee();

--
View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The only parameter I pass to linear_extrude is height. This is the code that draws the shape. module draw_vee_side(degrees, rows=4, part_width, height=part_height) { difference() { union() { linear_extrude(height=height) polygon(points=[ [0, 0], [part_width, vh], [part_width, vh+(rows*lane_width)], [0, (rows*lane_width)] ], paths=[[0, 1, 2, 3]]); } union() { // Pin Holes for (pin=[0:rows-1]) { translate([-part_width-(pin_depth), vh+(lane_width*pin)+(lane_width_half), height/2]) rotate([0, 90, 0]) draw_pin_hole(); } } } } module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5, height=part_height) { draw_vee_side(degrees, rows, part_width, height); mirror([1,0,0]) draw_vee_side(degrees, rows, part_width, height); } draw_vee(); -- View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Thu, Dec 24, 2015 11:50 PM

You also need to set the convexity, try convexity = 5.

On 24 December 2015 at 22:46, fractorr fractorr@gmail.com wrote:

The only parameter I pass to linear_extrude is height.

This is the code that draws the shape.

module draw_vee_side(degrees, rows=4, part_width, height=part_height) {
difference() {
union() {
linear_extrude(height=height)
polygon(points=[
[0, 0],
[part_width, vh],
[part_width, vh+(rowslane_width)],
[0, (rows
lane_width)]
], paths=[[0, 1, 2, 3]]);
}

             union() {
                     // Pin Holes
                     for (pin=[0:rows-1]) {
                     translate([-part_width-(pin_depth),

vh+(lane_width*pin)+(lane_width_half), height/2])
rotate([0, 90, 0])
draw_pin_hole();
}
}
}
}

module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5,
height=part_height) {
draw_vee_side(degrees, rows, part_width, height);

     mirror([1,0,0])
             draw_vee_side(degrees, rows, part_width, height);

}

draw_vee();

--
View this message in context:
http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

You also need to set the convexity, try convexity = 5. On 24 December 2015 at 22:46, fractorr <fractorr@gmail.com> wrote: > The only parameter I pass to linear_extrude is height. > > This is the code that draws the shape. > > > module draw_vee_side(degrees, rows=4, part_width, height=part_height) { > difference() { > union() { > linear_extrude(height=height) > polygon(points=[ > [0, 0], > [part_width, vh], > [part_width, vh+(rows*lane_width)], > [0, (rows*lane_width)] > ], paths=[[0, 1, 2, 3]]); > } > > union() { > // Pin Holes > for (pin=[0:rows-1]) { > translate([-part_width-(pin_depth), > vh+(lane_width*pin)+(lane_width_half), height/2]) > rotate([0, 90, 0]) > draw_pin_hole(); > } > } > } > } > > > module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5, > height=part_height) { > draw_vee_side(degrees, rows, part_width, height); > > mirror([1,0,0]) > draw_vee_side(degrees, rows, part_width, height); > } > > > draw_vee(); > > > > -- > View this message in context: > http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
NH
nop head
Fri, Dec 25, 2015 12:06 AM

Actually, if you draw just one side you will see your bug. The holes are
drilled in the opposite side of the V, so have no effect.

On 24 December 2015 at 23:50, nop head nop.head@gmail.com wrote:

You also need to set the convexity, try convexity = 5.

On 24 December 2015 at 22:46, fractorr fractorr@gmail.com wrote:

The only parameter I pass to linear_extrude is height.

This is the code that draws the shape.

module draw_vee_side(degrees, rows=4, part_width, height=part_height) {
difference() {
union() {
linear_extrude(height=height)
polygon(points=[
[0, 0],
[part_width, vh],
[part_width,
vh+(rowslane_width)],
[0, (rows
lane_width)]
], paths=[[0, 1, 2, 3]]);
}

             union() {
                     // Pin Holes
                     for (pin=[0:rows-1]) {
                     translate([-part_width-(pin_depth),

vh+(lane_width*pin)+(lane_width_half), height/2])
rotate([0, 90, 0])
draw_pin_hole();
}
}
}
}

module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5,
height=part_height) {
draw_vee_side(degrees, rows, part_width, height);

     mirror([1,0,0])
             draw_vee_side(degrees, rows, part_width, height);

}

draw_vee();

--
View this message in context:
http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Actually, if you draw just one side you will see your bug. The holes are drilled in the opposite side of the V, so have no effect. On 24 December 2015 at 23:50, nop head <nop.head@gmail.com> wrote: > You also need to set the convexity, try convexity = 5. > > On 24 December 2015 at 22:46, fractorr <fractorr@gmail.com> wrote: > >> The only parameter I pass to linear_extrude is height. >> >> This is the code that draws the shape. >> >> >> module draw_vee_side(degrees, rows=4, part_width, height=part_height) { >> difference() { >> union() { >> linear_extrude(height=height) >> polygon(points=[ >> [0, 0], >> [part_width, vh], >> [part_width, >> vh+(rows*lane_width)], >> [0, (rows*lane_width)] >> ], paths=[[0, 1, 2, 3]]); >> } >> >> union() { >> // Pin Holes >> for (pin=[0:rows-1]) { >> translate([-part_width-(pin_depth), >> vh+(lane_width*pin)+(lane_width_half), height/2]) >> rotate([0, 90, 0]) >> draw_pin_hole(); >> } >> } >> } >> } >> >> >> module draw_vee(degrees=45, rows=4, part_width=i2m(1.5), rows=4, pegs=5, >> height=part_height) { >> draw_vee_side(degrees, rows, part_width, height); >> >> mirror([1,0,0]) >> draw_vee_side(degrees, rows, part_width, height); >> } >> >> >> draw_vee(); >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/issue-with-difference-function-tp15327p15329.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >
F
fractorr
Fri, Dec 25, 2015 4:42 AM

Thank you, that was the issue.  I was drawing the holes on the wrong side, I
thought I had checked that but I guess not.  I can't believe it was
something so silly.  I will have to keep that in mind for other shapes.

--
View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327p15334.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you, that was the issue. I was drawing the holes on the wrong side, I thought I had checked that but I guess not. I can't believe it was something so silly. I will have to keep that in mind for other shapes. -- View this message in context: http://forum.openscad.org/issue-with-difference-function-tp15327p15334.html Sent from the OpenSCAD mailing list archive at Nabble.com.