discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Where is "path_pos_from_start" in BOLS2 ?

AM
Adrian Mariano
Thu, Oct 13, 2022 8:52 PM

Ah, I didn't notice that there was other stuff being subtracted.  In that
case, you just just use the tube() module as you were doing before, instead
of using fulltube().  I fixed tube() first before writing fulltube() as an
alternative.  (Using the approach in fulltube() is nicer if you don't need
to subtract other stuff, since you don't get z-fighting, and it should be
faster as well.)

To really do it right, though, you should make the length of the last
segment a little longer at each end for the inside tube so the model
doesn't have z-fighting at the ends.

On Thu, Oct 13, 2022 at 2:56 PM Mr Yura Volodin via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: Mr Yura Volodin yur_vol@yahoo.com
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc:
Bcc:
Date: Thu, 13 Oct 2022 18:54:45 +0000 (UTC)
Subject: [OpenSCAD] Re: Where is "path_pos_from_start" in BOLS2 ?
I will go on with your sweep code. but

There is a problem.
Your code generates tube with walls. Insteed of subracting all internals
from externals.
This makes placing items complicated as I need to empty tube after all
once more.
Howto do it correctly? See pic

*Yes, if you draw pb with stroke() you see two lines "like you expect" but
it doesn't mean that it is correct or meaningful to interpolate this data
in 2d like resample_path() does.  The length of the path is a meaningless
value for this data, but the path resampling routines treat the path based
on its length.  *

*Your new example with the new pb that you use actually makes the problem
much larger.  You were getting away with it before because pb was very
close to just being a straight line, so the error was small.  But with your
new example, the error is now 10 - 15 units.  The cylinder you use to cut
away at one end appears in the wrong place and cuts into the curve.  This
makes it reasonably clear that the code is not following your intent and
that the errors may be a real problem for you under some parameters.  *

*I would argue that even if the error is small you should code correctly,
not write code that is wrong (and actually more complex) and be happy that
the error is just small.  Better to understand what you are doing and do it
right!  Or intentionally make an approximation that introduces a known
small error.  In your case, the error is only small if the radius has the
right shape, and no longer in your second example.  Note also that my
neck2.scad version is faster than your code and produces a nicer tube since
the ends are correct in preview.  If you don't want to use sweep() the way
that one does you can still use the old hull() approach, but with lookup()
to compute the diameters.  *

---------- Forwarded message ----------
From: Mr Yura Volodin via Discuss discuss@lists.openscad.org
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc: Mr Yura Volodin yur_vol@yahoo.com
Bcc:
Date: Thu, 13 Oct 2022 18:54:45 +0000 (UTC)
Subject: [OpenSCAD] Re: Where is "path_pos_from_start" in BOLS2 ?


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

Ah, I didn't notice that there was other stuff being subtracted. In that case, you just just use the tube() module as you were doing before, instead of using fulltube(). I fixed tube() first before writing fulltube() as an alternative. (Using the approach in fulltube() is nicer if you don't need to subtract other stuff, since you don't get z-fighting, and it should be faster as well.) To really do it right, though, you should make the length of the last segment a little longer at each end for the inside tube so the model doesn't have z-fighting at the ends. On Thu, Oct 13, 2022 at 2:56 PM Mr Yura Volodin via Discuss < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: Mr Yura Volodin <yur_vol@yahoo.com> > To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Thu, 13 Oct 2022 18:54:45 +0000 (UTC) > Subject: [OpenSCAD] Re: Where is "path_pos_from_start" in BOLS2 ? > I will go on with your sweep code. but > > There is a problem. > Your code generates tube with walls. Insteed of subracting all internals > from externals. > This makes placing items complicated as I need to empty tube after all > once more. > Howto do it correctly? See pic > > * On Thursday, October 13, 2022 at 01:40:53 PM GMT+3, Adrian Mariano > <avm4@cornell.edu <avm4@cornell.edu>> wrote: * > > > > *Yes, if you draw pb with stroke() you see two lines "like you expect" but > it doesn't mean that it is correct or meaningful to interpolate this data > in 2d like resample_path() does. The length of the path is a meaningless > value for this data, but the path resampling routines treat the path based > on its length. * > > > *Your new example with the new pb that you use actually makes the problem > much larger. You were getting away with it before because pb was very > close to just being a straight line, so the error was small. But with your > new example, the error is now 10 - 15 units. The cylinder you use to cut > away at one end appears in the wrong place and cuts into the curve. This > makes it reasonably clear that the code is not following your intent and > that the errors may be a real problem for you under some parameters. * > > > *I would argue that even if the error is small you should code correctly, > not write code that is wrong (and actually more complex) and be happy that > the error is just small. Better to understand what you are doing and do it > right! Or intentionally make an approximation that introduces a known > small error. In your case, the error is only small if the radius has the > right shape, and no longer in your second example. Note also that my > neck2.scad version is faster than your code and produces a nicer tube since > the ends are correct in preview. If you don't want to use sweep() the way > that one does you can still use the old hull() approach, but with lookup() > to compute the diameters. * > > > > > > ---------- Forwarded message ---------- > From: Mr Yura Volodin via Discuss <discuss@lists.openscad.org> > To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org> > Cc: Mr Yura Volodin <yur_vol@yahoo.com> > Bcc: > Date: Thu, 13 Oct 2022 18:54:45 +0000 (UTC) > Subject: [OpenSCAD] Re: Where is "path_pos_from_start" in BOLS2 ? > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
MY
Mr Yura Volodin
Fri, Oct 14, 2022 2:12 PM

Yes, now I use your separate code  to subtracte tubes.
On Thursday, October 13, 2022 at 11:52:56 PM GMT+3, Adrian Mariano avm4@cornell.edu wrote:

Ah, I didn't notice that there was other stuff being subtracted.  In that case, you just just use the tube() module as you were doing before, instead of using fulltube().   I fixed tube() first before writing fulltube() as an alternative.   (Using the approach in fulltube() is nicer if you don't need to subtract other stuff, since you don't get z-fighting, and it should be faster as well.)

To really do it right, though, you should make the length of the last segment a little longer at each end for the inside tube so the model doesn't have z-fighting at the ends. 

It seems complicated to extrapolate beyond bented end of tube. In my case I increase thickness of internals HULLs and translated down a bit.

Yes, now I use your separate code  to subtracte tubes. On Thursday, October 13, 2022 at 11:52:56 PM GMT+3, Adrian Mariano <avm4@cornell.edu> wrote: Ah, I didn't notice that there was other stuff being subtracted.  In that case, you just just use the tube() module as you were doing before, instead of using fulltube().   I fixed tube() first before writing fulltube() as an alternative.   (Using the approach in fulltube() is nicer if you don't need to subtract other stuff, since you don't get z-fighting, and it should be faster as well.) To really do it right, though, you should make the length of the last segment a little longer at each end for the inside tube so the model doesn't have z-fighting at the ends.  It seems complicated to extrapolate beyond bented end of tube. In my case I increase thickness of internals HULLs and translated down a bit.