discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BOSL2 offset_sweep() and vnf_polyhedron()

JW
Joe Weinpert
Fri, May 6, 2022 10:28 PM

I created a module and a function that both do the same thing ... run the
offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second
picture is the object when using the function call:

[image: module.png]

[image: function.png]

Why is there a difference?

I created a module and a function that both do the same thing ... run the offset_sweep() function: makeObject( shapeOuter ); module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ offset_sweep( shape, height = h, steps = stps, top = os_circle( r = r ), check_valid = chkIt ); } obj1 = makeIt( shapeOuter ); vnf_polyhedron( obj1 ); function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( offset_sweep( shape, height = h, steps = stps, top = os_circle( r = r ), check_valid = chkIt ) ); The first picture is the object when using the module call. The second picture is the object when using the function call: [image: module.png] [image: function.png] Why is there a difference?
AM
Adrian Mariano
Fri, May 6, 2022 11:03 PM

The module version of offset_sweep works by just calling the function
version, so there should not be a difference.  It looks like there's a bug
in the parameter passing, where your value of check_valid isn't passed
through, but instead it's always set to true.  So in the function case you
actually turned off check_valid but in the module case it ignored your
check_valid setting.

At least, that's how it looks.  When posting about things that aren't
working you should always post a minimal example of code that displays the
problem so people can actually run it and test it themselves.

On Fri, May 6, 2022 at 6:29 PM Joe Weinpert joe.weinpert@gmail.com wrote:

I created a module and a function that both do the same thing ... run the
offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second
picture is the object when using the function call:

[image: module.png]

[image: function.png]

Why is there a difference?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

The module version of offset_sweep works by just calling the function version, so there should not be a difference. It looks like there's a bug in the parameter passing, where your value of check_valid isn't passed through, but instead it's always set to true. So in the function case you actually turned off check_valid but in the module case it ignored your check_valid setting. At least, that's how it looks. When posting about things that aren't working you should always post a minimal example of code that displays the problem so people can actually run it and test it themselves. On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > I created a module and a function that both do the same thing ... run the > offset_sweep() function: > > makeObject( shapeOuter ); > > > module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ); > } > > > obj1 = makeIt( shapeOuter ); > vnf_polyhedron( obj1 ); > > function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ) > ); > > > The first picture is the object when using the module call. The second > picture is the object when using the function call: > > [image: module.png] > > [image: function.png] > > > Why is there a difference? > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JW
Joe Weinpert
Fri, May 6, 2022 11:25 PM

I have attached the SCAD as well as displaying it here.

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483],
[40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221,
62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096],
[40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233,
55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651],
[44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572,
47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289],
[53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358,
40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534],
[65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585,
32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044],
[79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043,
25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324,
21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739],
[86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656,
11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677],
[86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339,
7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378],
[87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661,
7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553],
[89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002,
8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814],
[97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909,
7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001],
[103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742,
6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292],
[105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382,
7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828],
[106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806,
15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087],
[106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652,
23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148],
[102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807,
34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473],
[86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598,
41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505],
[66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199,
50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247],
[53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496,
57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296],
[47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779,
63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805,
64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791],
[44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564,
65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707],
[42.1924, 65.6525], [41.8923, 65.4776]];

makeObject( shapeOuter );  // Results from a module call
//obj1 = makeIt( shapeOuter ); // Results from a function call
//vnf_polyhedron( obj1 );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

On Fri, May 6, 2022 at 7:03 PM Adrian Mariano avm4@cornell.edu wrote:

The module version of offset_sweep works by just calling the function
version, so there should not be a difference.  It looks like there's a bug
in the parameter passing, where your value of check_valid isn't passed
through, but instead it's always set to true.  So in the function case you
actually turned off check_valid but in the module case it ignored your
check_valid setting.

At least, that's how it looks.  When posting about things that aren't
working you should always post a minimal example of code that displays the
problem so people can actually run it and test it themselves.

On Fri, May 6, 2022 at 6:29 PM Joe Weinpert joe.weinpert@gmail.com
wrote:

I created a module and a function that both do the same thing ... run the
offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second
picture is the object when using the function call:

[image: module.png]

[image: function.png]

Why is there a difference?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I have attached the SCAD as well as displaying it here. include <BOSL2/std.scad> include <BOSL2/rounding.scad> shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483], [40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221, 62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096], [40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233, 55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651], [44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572, 47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289], [53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358, 40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534], [65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585, 32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044], [79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043, 25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324, 21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739], [86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656, 11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677], [86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339, 7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378], [87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661, 7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553], [89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002, 8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814], [97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909, 7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001], [103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742, 6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292], [105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382, 7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828], [106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806, 15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087], [106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652, 23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148], [102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807, 34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473], [86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598, 41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505], [66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199, 50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247], [53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496, 57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296], [47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779, 63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805, 64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791], [44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564, 65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707], [42.1924, 65.6525], [41.8923, 65.4776]]; makeObject( shapeOuter ); // Results from a module call //obj1 = makeIt( shapeOuter ); // Results from a function call //vnf_polyhedron( obj1 ); module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ offset_sweep( shape, height = h, steps = stps, top = os_circle( r = r ), check_valid = chkIt ); } function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( offset_sweep( shape, height = h, steps = stps, top = os_circle( r = r ), check_valid = chkIt ) ); On Fri, May 6, 2022 at 7:03 PM Adrian Mariano <avm4@cornell.edu> wrote: > The module version of offset_sweep works by just calling the function > version, so there should not be a difference. It looks like there's a bug > in the parameter passing, where your value of check_valid isn't passed > through, but instead it's always set to true. So in the function case you > actually turned off check_valid but in the module case it ignored your > check_valid setting. > > At least, that's how it looks. When posting about things that aren't > working you should always post a minimal example of code that displays the > problem so people can actually run it and test it themselves. > > On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com> > wrote: > >> I created a module and a function that both do the same thing ... run the >> offset_sweep() function: >> >> makeObject( shapeOuter ); >> >> >> module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ >> offset_sweep( >> shape, >> height = h, >> steps = stps, >> top = os_circle( r = r ), >> check_valid = chkIt >> ); >> } >> >> >> obj1 = makeIt( shapeOuter ); >> vnf_polyhedron( obj1 ); >> >> function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( >> offset_sweep( >> shape, >> height = h, >> steps = stps, >> top = os_circle( r = r ), >> check_valid = chkIt >> ) >> ); >> >> >> The first picture is the object when using the module call. The second >> picture is the object when using the function call: >> >> [image: module.png] >> >> [image: function.png] >> >> >> Why is there a difference? >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Sat, May 7, 2022 12:20 AM

I confirmed that this problem is due to the non-passing of the check_valid
parameter.  There is a pull request in to fix this.  Once it's fixed, both
versions of your code will produce the bad version with the extra circular
artifacts, unless you set check_valid to true.

On Fri, May 6, 2022 at 7:25 PM Joe Weinpert joe.weinpert@gmail.com wrote:

I have attached the SCAD as well as displaying it here.

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483],
[40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221,
62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096],
[40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233,
55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651],
[44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572,
47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289],
[53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358,
40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534],
[65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585,
32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044],
[79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043,
25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324,
21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739],
[86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656,
11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677],
[86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339,
7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378],
[87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661,
7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553],
[89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002,
8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814],
[97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909,
7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001],
[103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742,
6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292],
[105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382,
7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828],
[106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806,
15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087],
[106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652,
23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148],
[102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807,
34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473],
[86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598,
41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505],
[66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199,
50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247],
[53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496,
57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296],
[47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779,
63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805,
64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791],
[44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564,
65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707],
[42.1924, 65.6525], [41.8923, 65.4776]];

makeObject( shapeOuter );  // Results from a module call
//obj1 = makeIt( shapeOuter ); // Results from a function call
//vnf_polyhedron( obj1 );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

On Fri, May 6, 2022 at 7:03 PM Adrian Mariano avm4@cornell.edu wrote:

The module version of offset_sweep works by just calling the function
version, so there should not be a difference.  It looks like there's a bug
in the parameter passing, where your value of check_valid isn't passed
through, but instead it's always set to true.  So in the function case you
actually turned off check_valid but in the module case it ignored your
check_valid setting.

At least, that's how it looks.  When posting about things that aren't
working you should always post a minimal example of code that displays the
problem so people can actually run it and test it themselves.

On Fri, May 6, 2022 at 6:29 PM Joe Weinpert joe.weinpert@gmail.com
wrote:

I created a module and a function that both do the same thing ... run
the offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second
picture is the object when using the function call:

[image: module.png]

[image: function.png]

Why is there a difference?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I confirmed that this problem is due to the non-passing of the check_valid parameter. There is a pull request in to fix this. Once it's fixed, both versions of your code will produce the bad version with the extra circular artifacts, unless you set check_valid to true. On Fri, May 6, 2022 at 7:25 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > I have attached the SCAD as well as displaying it here. > > > include <BOSL2/std.scad> > include <BOSL2/rounding.scad> > > shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483], > [40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221, > 62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096], > [40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233, > 55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651], > [44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572, > 47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289], > [53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358, > 40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534], > [65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585, > 32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044], > [79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043, > 25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324, > 21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739], > [86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656, > 11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677], > [86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339, > 7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378], > [87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661, > 7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553], > [89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002, > 8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814], > [97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909, > 7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001], > [103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742, > 6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292], > [105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382, > 7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828], > [106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806, > 15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087], > [106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652, > 23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148], > [102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807, > 34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473], > [86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598, > 41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505], > [66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199, > 50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247], > [53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496, > 57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296], > [47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779, > 63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805, > 64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791], > [44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564, > 65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707], > [42.1924, 65.6525], [41.8923, 65.4776]]; > > makeObject( shapeOuter ); // Results from a module call > //obj1 = makeIt( shapeOuter ); // Results from a function call > //vnf_polyhedron( obj1 ); > > module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ); > } > > function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ) > ); > > On Fri, May 6, 2022 at 7:03 PM Adrian Mariano <avm4@cornell.edu> wrote: > >> The module version of offset_sweep works by just calling the function >> version, so there should not be a difference. It looks like there's a bug >> in the parameter passing, where your value of check_valid isn't passed >> through, but instead it's always set to true. So in the function case you >> actually turned off check_valid but in the module case it ignored your >> check_valid setting. >> >> At least, that's how it looks. When posting about things that aren't >> working you should always post a minimal example of code that displays the >> problem so people can actually run it and test it themselves. >> >> On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com> >> wrote: >> >>> I created a module and a function that both do the same thing ... run >>> the offset_sweep() function: >>> >>> makeObject( shapeOuter ); >>> >>> >>> module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ >>> offset_sweep( >>> shape, >>> height = h, >>> steps = stps, >>> top = os_circle( r = r ), >>> check_valid = chkIt >>> ); >>> } >>> >>> >>> obj1 = makeIt( shapeOuter ); >>> vnf_polyhedron( obj1 ); >>> >>> function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( >>> offset_sweep( >>> shape, >>> height = h, >>> steps = stps, >>> top = os_circle( r = r ), >>> check_valid = chkIt >>> ) >>> ); >>> >>> >>> The first picture is the object when using the module call. The second >>> picture is the object when using the function call: >>> >>> [image: module.png] >>> >>> [image: function.png] >>> >>> >>> Why is there a difference? >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JW
Joe Weinpert
Sat, May 7, 2022 12:25 AM

Very good ... appreciate it, and thanks!

On Fri, May 6, 2022 at 8:20 PM Adrian Mariano avm4@cornell.edu wrote:

I confirmed that this problem is due to the non-passing of the check_valid
parameter.  There is a pull request in to fix this.  Once it's fixed, both
versions of your code will produce the bad version with the extra circular
artifacts, unless you set check_valid to true.

On Fri, May 6, 2022 at 7:25 PM Joe Weinpert joe.weinpert@gmail.com
wrote:

I have attached the SCAD as well as displaying it here.

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483],
[40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221,
62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096],
[40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233,
55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651],
[44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572,
47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289],
[53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358,
40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534],
[65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585,
32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044],
[79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043,
25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324,
21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739],
[86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656,
11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677],
[86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339,
7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378],
[87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661,
7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553],
[89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002,
8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814],
[97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909,
7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001],
[103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742,
6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292],
[105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382,
7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828],
[106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806,
15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087],
[106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652,
23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148],
[102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807,
34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473],
[86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598,
41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505],
[66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199,
50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247],
[53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496,
57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296],
[47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779,
63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805,
64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791],
[44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564,
65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707],
[42.1924, 65.6525], [41.8923, 65.4776]];

makeObject( shapeOuter );  // Results from a module call
//obj1 = makeIt( shapeOuter ); // Results from a function call
//vnf_polyhedron( obj1 );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

On Fri, May 6, 2022 at 7:03 PM Adrian Mariano avm4@cornell.edu wrote:

The module version of offset_sweep works by just calling the function
version, so there should not be a difference.  It looks like there's a bug
in the parameter passing, where your value of check_valid isn't passed
through, but instead it's always set to true.  So in the function case you
actually turned off check_valid but in the module case it ignored your
check_valid setting.

At least, that's how it looks.  When posting about things that aren't
working you should always post a minimal example of code that displays the
problem so people can actually run it and test it themselves.

On Fri, May 6, 2022 at 6:29 PM Joe Weinpert joe.weinpert@gmail.com
wrote:

I created a module and a function that both do the same thing ... run
the offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second
picture is the object when using the function call:

[image: module.png]

[image: function.png]

Why is there a difference?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Very good ... appreciate it, and thanks! On Fri, May 6, 2022 at 8:20 PM Adrian Mariano <avm4@cornell.edu> wrote: > I confirmed that this problem is due to the non-passing of the check_valid > parameter. There is a pull request in to fix this. Once it's fixed, both > versions of your code will produce the bad version with the extra circular > artifacts, unless you set check_valid to true. > > On Fri, May 6, 2022 at 7:25 PM Joe Weinpert <joe.weinpert@gmail.com> > wrote: > >> I have attached the SCAD as well as displaying it here. >> >> >> include <BOSL2/std.scad> >> include <BOSL2/rounding.scad> >> >> shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483], >> [40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221, >> 62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096], >> [40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233, >> 55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651], >> [44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572, >> 47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289], >> [53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358, >> 40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534], >> [65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585, >> 32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044], >> [79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043, >> 25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324, >> 21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739], >> [86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656, >> 11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677], >> [86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339, >> 7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378], >> [87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661, >> 7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553], >> [89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002, >> 8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814], >> [97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909, >> 7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001], >> [103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742, >> 6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292], >> [105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382, >> 7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828], >> [106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806, >> 15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087], >> [106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652, >> 23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148], >> [102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807, >> 34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473], >> [86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598, >> 41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505], >> [66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199, >> 50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247], >> [53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496, >> 57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296], >> [47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779, >> 63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805, >> 64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791], >> [44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564, >> 65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707], >> [42.1924, 65.6525], [41.8923, 65.4776]]; >> >> makeObject( shapeOuter ); // Results from a module call >> //obj1 = makeIt( shapeOuter ); // Results from a function call >> //vnf_polyhedron( obj1 ); >> >> module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ >> offset_sweep( >> shape, >> height = h, >> steps = stps, >> top = os_circle( r = r ), >> check_valid = chkIt >> ); >> } >> >> function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( >> offset_sweep( >> shape, >> height = h, >> steps = stps, >> top = os_circle( r = r ), >> check_valid = chkIt >> ) >> ); >> >> On Fri, May 6, 2022 at 7:03 PM Adrian Mariano <avm4@cornell.edu> wrote: >> >>> The module version of offset_sweep works by just calling the function >>> version, so there should not be a difference. It looks like there's a bug >>> in the parameter passing, where your value of check_valid isn't passed >>> through, but instead it's always set to true. So in the function case you >>> actually turned off check_valid but in the module case it ignored your >>> check_valid setting. >>> >>> At least, that's how it looks. When posting about things that aren't >>> working you should always post a minimal example of code that displays the >>> problem so people can actually run it and test it themselves. >>> >>> On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com> >>> wrote: >>> >>>> I created a module and a function that both do the same thing ... run >>>> the offset_sweep() function: >>>> >>>> makeObject( shapeOuter ); >>>> >>>> >>>> module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ >>>> offset_sweep( >>>> shape, >>>> height = h, >>>> steps = stps, >>>> top = os_circle( r = r ), >>>> check_valid = chkIt >>>> ); >>>> } >>>> >>>> >>>> obj1 = makeIt( shapeOuter ); >>>> vnf_polyhedron( obj1 ); >>>> >>>> function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( >>>> offset_sweep( >>>> shape, >>>> height = h, >>>> steps = stps, >>>> top = os_circle( r = r ), >>>> check_valid = chkIt >>>> ) >>>> ); >>>> >>>> >>>> The first picture is the object when using the module call. The second >>>> picture is the object when using the function call: >>>> >>>> [image: module.png] >>>> >>>> [image: function.png] >>>> >>>> >>>> Why is there a difference? >>>> >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RD
Revar Desmera
Sat, May 7, 2022 12:57 AM

PR merged.  Wiki updated.

  • Revar

On May 6, 2022, at 5:20 PM, Adrian Mariano avm4@cornell.edu wrote:

I confirmed that this problem is due to the non-passing of the check_valid parameter.  There is a pull request in to fix this.  Once it's fixed, both versions of your code will produce the bad version with the extra circular artifacts, unless you set check_valid to true.

On Fri, May 6, 2022 at 7:25 PM Joe Weinpert <joe.weinpert@gmail.com mailto:joe.weinpert@gmail.com> wrote:
I have attached the SCAD as well as displaying it here.

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483], [40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221, 62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096], [40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233, 55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651], [44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572, 47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289], [53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358, 40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534], [65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585, 32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044], [79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043, 25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324, 21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739], [86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656, 11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677], [86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339, 7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378], [87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661, 7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553], [89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002, 8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814], [97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909, 7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001], [103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742, 6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292], [105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382, 7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828], [106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806, 15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087], [106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652, 23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148], [102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807, 34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473], [86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598, 41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505], [66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199, 50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247], [53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496, 57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296], [47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779, 63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805, 64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791], [44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564, 65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707], [42.1924, 65.6525], [41.8923, 65.4776]];

makeObject( shapeOuter );  // Results from a module call
//obj1 = makeIt( shapeOuter ); // Results from a function call
//vnf_polyhedron( obj1 );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

On Fri, May 6, 2022 at 7:03 PM Adrian Mariano <avm4@cornell.edu mailto:avm4@cornell.edu> wrote:
The module version of offset_sweep works by just calling the function version, so there should not be a difference.  It looks like there's a bug in the parameter passing, where your value of check_valid isn't passed through, but instead it's always set to true.  So in the function case you actually turned off check_valid but in the module case it ignored your check_valid setting.

At least, that's how it looks.  When posting about things that aren't working you should always post a minimal example of code that displays the problem so people can actually run it and test it themselves.

On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com mailto:joe.weinpert@gmail.com> wrote:
I created a module and a function that both do the same thing ... run the offset_sweep() function:

makeObject( shapeOuter );

module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
);
}

obj1 = makeIt( shapeOuter );
vnf_polyhedron( obj1 );

function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = (
offset_sweep(
shape,
height = h,
steps = stps,
top = os_circle( r = r ),
check_valid = chkIt
)
);

The first picture is the object when using the module call.  The second picture is the object when using the function call:

<module.png>

<function.png>

Why is there a difference?


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

PR merged. Wiki updated. - Revar > On May 6, 2022, at 5:20 PM, Adrian Mariano <avm4@cornell.edu> wrote: > > I confirmed that this problem is due to the non-passing of the check_valid parameter. There is a pull request in to fix this. Once it's fixed, both versions of your code will produce the bad version with the extra circular artifacts, unless you set check_valid to true. > > On Fri, May 6, 2022 at 7:25 PM Joe Weinpert <joe.weinpert@gmail.com <mailto:joe.weinpert@gmail.com>> wrote: > I have attached the SCAD as well as displaying it here. > > > include <BOSL2/std.scad> > include <BOSL2/rounding.scad> > > shapeOuter = [[41.5889, 65.2463], [41.1829, 64.8609], [40.8496, 64.4483], [40.5879, 64.0015], [40.3966, 63.5134], [40.2747, 62.9772], [40.221, 62.3857], [40.2345, 61.7319], [40.3142, 61.0089], [40.4588, 60.2096], [40.6673, 59.327], [40.9993, 58.2124], [41.4171, 57.1038], [41.9233, 55.9972], [42.5204, 54.8888], [43.2111, 53.7747], [43.9978, 52.651], [44.8833, 51.5139], [45.8699, 50.3593], [46.9604, 49.1835], [48.1572, 47.9825], [49.6142, 46.6026], [51.0448, 45.3217], [52.4642, 44.1289], [53.8877, 43.0138], [55.3307, 41.9654], [56.8083, 40.9733], [58.3358, 40.0267], [59.9286, 39.115], [61.6019, 38.2275], [63.3709, 37.3534], [65.8887, 36.1275], [68.3029, 34.9069], [70.5981, 33.7009], [72.7585, 32.5185], [74.7687, 31.3689], [76.6131, 30.2612], [78.2761, 29.2044], [79.7421, 28.2078], [80.9956, 27.2804], [82.021, 26.4314], [82.8043, 25.6303], [83.5182, 24.6855], [84.1615, 23.6], [84.7333, 22.377], [85.2324, 21.0198], [85.6579, 19.5314], [86.0088, 17.915], [86.284, 16.1739], [86.4825, 14.311], [86.6032, 12.3297], [86.6326, 11.6576], [86.6656, 11.0109], [86.7014, 10.3989], [86.7394, 9.83112], [86.7787, 9.31677], [86.8185, 8.86526], [86.8582, 8.48592], [86.8969, 8.18813], [86.9339, 7.98123], [86.9685, 7.87458], [87.0278, 7.81086], [87.1189, 7.76378], [87.245, 7.73354], [87.4094, 7.7203], [87.6154, 7.72425], [87.8661, 7.74557], [88.1649, 7.78443], [88.5149, 7.84103], [88.9195, 7.91553], [89.3818, 8.00812], [90.5115, 8.21672], [91.6136, 8.36802], [92.7002, 8.46141], [93.7838, 8.4963], [94.8766, 8.47208], [95.9909, 8.38814], [97.1389, 8.24389], [98.3331, 8.03873], [99.5856, 7.77204], [100.909, 7.44323], [101.554, 7.27301], [102.183, 7.10777], [102.785, 6.95001], [103.352, 6.80219], [103.874, 6.66679], [104.34, 6.5463], [104.742, 6.44318], [105.07, 6.35993], [105.315, 6.29902], [105.466, 6.26292], [105.754, 6.25542], [106.001, 6.38247], [106.209, 6.65929], [106.382, 7.10108], [106.521, 7.72303], [106.63, 8.54037], [106.711, 9.56828], [106.767, 10.822], [106.799, 12.3167], [106.812, 14.0676], [106.806, 15.8081], [106.777, 17.2995], [106.715, 18.5853], [106.614, 19.7087], [106.465, 20.7132], [106.26, 21.6423], [105.992, 22.5393], [105.652, 23.4477], [105.233, 24.4108], [104.727, 25.4722], [103.629, 27.4148], [102.292, 29.2625], [100.72, 31.0134], [98.9156, 32.6655], [96.8807, 34.2169], [94.6187, 35.6657], [92.1322, 37.0098], [89.4242, 38.2473], [86.4973, 39.3763], [83.3544, 40.3948], [81.5836, 40.9774], [79.1598, 41.8565], [76.2606, 42.9599], [73.0633, 44.2153], [69.7456, 45.5505], [66.4849, 46.8932], [63.4587, 48.1711], [60.8445, 49.3121], [58.8199, 50.2437], [57.5624, 50.8938], [56.335, 51.6927], [55.1024, 52.6247], [53.881, 53.6715], [52.6875, 54.8146], [51.5382, 56.0355], [50.4496, 57.3159], [49.4382, 58.6373], [48.5206, 59.9814], [47.7131, 61.3296], [47.0323, 62.6637], [46.8902, 62.9527], [46.7392, 63.2249], [46.5779, 63.4819], [46.4051, 63.7251], [46.2196, 63.956], [46.02, 64.1761], [45.805, 64.387], [45.5734, 64.5902], [45.3239, 64.787], [45.0553, 64.9791], [44.6072, 65.2683], [44.1946, 65.4981], [43.8126, 65.6691], [43.4564, 65.7814], [43.1212, 65.8355], [42.802, 65.8319], [42.494, 65.7707], [42.1924, 65.6525], [41.8923, 65.4776]]; > > makeObject( shapeOuter ); // Results from a module call > //obj1 = makeIt( shapeOuter ); // Results from a function call > //vnf_polyhedron( obj1 ); > > module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ); > } > > function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ) > ); > > On Fri, May 6, 2022 at 7:03 PM Adrian Mariano <avm4@cornell.edu <mailto:avm4@cornell.edu>> wrote: > The module version of offset_sweep works by just calling the function version, so there should not be a difference. It looks like there's a bug in the parameter passing, where your value of check_valid isn't passed through, but instead it's always set to true. So in the function case you actually turned off check_valid but in the module case it ignored your check_valid setting. > > At least, that's how it looks. When posting about things that aren't working you should always post a minimal example of code that displays the problem so people can actually run it and test it themselves. > > On Fri, May 6, 2022 at 6:29 PM Joe Weinpert <joe.weinpert@gmail.com <mailto:joe.weinpert@gmail.com>> wrote: > I created a module and a function that both do the same thing ... run the offset_sweep() function: > > makeObject( shapeOuter ); > > module makeObject( shape, h=3, r=2, stps=16, chkIt=false ){ > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ); > } > > > obj1 = makeIt( shapeOuter ); > vnf_polyhedron( obj1 ); > > function makeIt( shape, h=3, r=2, stps=16, chkIt=false ) = ( > offset_sweep( > shape, > height = h, > steps = stps, > top = os_circle( r = r ), > check_valid = chkIt > ) > ); > > The first picture is the object when using the module call. The second picture is the object when using the function call: > > <module.png> > > <function.png> > > > Why is there a difference? > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org