I've been using BRLCAD for some time now mainly for 3D printing, but am a relative newcommer to it. I am having problems with my current print project. Initially created in Archer .
I have created three fairly simple sketches (holder1, gaugebase1, mount1) and the using the following commands create and object:
in 01 extrude 0 0 0 0 0 -25 1 0 0 0 1 0 holder1
in 02 extrude 25 50 10 0 0 -15 1 0 0 0 1 0 gaugebase1
in 03 extrude 25 50 -17 0 -23.5 0 1 0 0 0 0 1 mount1
r body.r u 01 - 02
r DialHolder.r u body.r - 03
This will shade and raytrace and looks fine. Evaluating may cause Archer to crash or take a very long time.
I cannot export this to a .stl file for 3D printing. The file is created with 0 file size.
CLI feedback is: (maybe produced from a slight different file as changed the mount sketch/extrude to be formed using pipe command to see if that approach worked -- same result!)
g-stl -o Hold.stl DHold.g DialHolder.r
db_apply_state_from_comb(): WARNING: color override in combination within region '/DialHolder.r/Holder.r', ignored
db_apply_state_from_comb(): WARNING: material property spec in combination below region '/DialHolder.r/Holder.r', ignored
WARNING: region unioned into region at '/DialHolder.r/Holder.r', lower region info ignored
WARNING: region unioned into region at '/DialHolder.r/Holder.r/all/r.stl', lower region info ignored
nmg_fix_normals: nmg_classify_s_vs_s() failed for shells 0000020FF7D58160 and 0000020FF623EB00
Continuing anyway (shell is likely to have incorrectly oriented normals)
db_lookup(03) failed in /DialHolder.r/Holder.r
{s.stl} - {pipe.1}
nmg_bool: sA is unclosed, barging ahead
minus_class = (onAinB)
plus_class = (Unknown)
nmg_bool(): Dangling faces detected in rA after boolean
FAILED in boolean evaluation: /DialHolder.r
0 triangles written
Am I missing something and how can I get further feedback to troubleshoot what's happening?
Thanks
I have spent so much time on this and i'm sure there is some sort of bug. I understand the issues with regions and combinations mentioned in other posts. There seems to have been similar issues posted from time to time regards g-stl, but I've struggled with this and really hope someone can point me in the right direction.
I really like BRLCAD and am prepared for the steep learning curve ( i'm sure this is what puts 90% of people off adopting it) and annoyingly the more time you invest the less you wish to migrate to another package. - However I do wish somethings were easier!!
I attach the file dgholder.g which contains three sketch extrusions. I believe these are clean. I wish to create a combination of 01 with both 02 and 03 subtracted in .stl fromat for 3D printing. This easy procedure has seemed impossible to me - I have tried many times and also just 01 - 02 hoping to manually drill the 03 screw hole on the resulting 3D print.
I have tried in MGED and Archer and have had success in getting BRLCAD .g geometry files with the desired results but cannot export or convert to .stl format for subsequent 3D printing.
I have previously made quite a few 3D prints using BRLCAD with the usual beginners teething issues, but just cant get round this.
Could someone please take the file, produce what i am trying to achieve and explain to me my errors.
Thanks in anticipation!
Hi! Unfortunately, it looks like you've hit a bug with the facetization routines. I took a quick look, and was able to use a fallback method to work around the issue and produced the attached:
comb subt u 02 u 03
comb all u 01 - subt
facetize --SPSR --feature-size 0.3 --decimation-feature-size .05 all all.bot
bot_dump -o dgholder.stl -t stl all.bot
The feature size settings can be adjusted to trade off finer meshes for larger bot sizes.
Hi Cliff, I felt sure there must be a bug! Thank you very much for the .stl file and the method used. It prints a treat!
One thing I've found with BRLCAD, is for beginners there seems to be quite good documentation and tutorials readily available to get you going. However, once you get past that material the intricacies of the software become more difficult. For instance the documentation with regard to BOTs etc appears rather thin. Can you recommend any good references to help with this?
Many thanks for your help.
Unfortunately documentation of that sort often doesn't exist, beyond the source code itself - it depends on which aspect of the system you're looking at. BoTs in particular have a lot of relatively immature features that are experimental or added for specific purposes - the SPSR option used above being a case in point.
For specific commands, the best available documentation is usually the "man" pages. These are viewable with the "man" command in MGED, or the "brlman" command on the command line. You can also inquire on the Zulip channel (https://brlcad.zulipchat.com) - being a more interactive forum, that will sometimes allow for faster responses.
https://sourceforge.net/p/brlcad/support-requests/127/
mged> puts $brlcad_version
7.30.10
David Leech (2021-02-22), the ticket's creator, drew three fairly simple
sketches (holder1, gaugebase1, and mount1 in dgholder.g that he supplied), and
used the following commands to create his object (DialHolder):
mged> in 01 extrude 0 0 0 0 0 -25 1 0 0 0 1 0 holder1
mged> in 02 extrude 25 50 10 0 0 -15 1 0 0 0 1 0 GaugeBase1
mged> in 03 extrude 25 50 -17 0 -23.5 0 1 0 0 0 0 1 mount1
mged> r body.r u 01 - 02
mged> r DialHolder.r u body.r - 03
Note that 01 02 and 03 are already included in his database dgholder.g, but
body.r and DialHolder.r are not. As remarked by Cliff Yapp (2021-03-12), the
same construction can be obtained through
mged> comb subt u 02 u 03
mged> comb all u 01 - subt
David Leech complains rightly that g-stl cannot convert his object to .stl
(g-stl/nmg_bool() error message: Dangling faces detected in rA after boolean).
Cliff Yapp (2021-03-12) proposed a workaround which uses SPSR tessellation
mged> facetize --SPSR --feature-size 0.3 --decimation-feature-size .05 all all.bot
mged> bot_dump -o dgholder.stl -t stl all.bot
after some while (!) this reports
SPSR: decimation succeeded, final BoT has 12190 faces
As can be visualized through
mged> B all.bot
mged> view aet 18 11 0
mged> view size 80
the result seems to have excessively many tessellation triangles,
which, possibly, can be further decimated.
Note that g-stl relies on the NMG tessellation, which is, according to the
FACETIZE(nged) man page https://brl-cad.github.io/docs/man/n/facetize.html,
generally the best quality output that can be produced by any of BRL-CAD's
available facetization methods (NMG, CM, SPSR).
Both David and Cliff imply that there's some sort of a bug in g-stl, and
therefore nmg_bool(). However, this seems not to be the case at all. The
actual reasons are (i) possibly somewhat deficient design, for which (ii) the
default tolerances are insufficient for nmg_bool(). So we can see with
mged> B all
mged> view aet 270 90 0
mged> view center 24.5 35.75 -6
mged> view size 80
that while 03 and 02 align with (an imagined) symmetry axis at x=25mm, 01 is
--- intentionally or not --- 0.5 mm off to the left. Furthermore 02 is
centered 3mm deeper away from 01 and has the diameter of 47mm, smaller by 2mm
than the width of 01. So when 02 is subtracted from 01, it leaves a sidewall of
approximately 2mm on the left (x=0) and less than 1mm on the right (x=49).
Indeed, with the default tolerances,
mged> tol
Current tolerance settings are:
Tessellation tolerances:
abs None
rel 0.01 (1%)
norm None
Calculational tolerances:
distance = 0.0005 mm
perpendicularity = 1e-06 (cosine of 89.9999 degrees)
BRep specific tessellation tolerances:
absmax None
absmin None
relmax None
relmin None
lmax None
lmin None
the NMG tessellation on this design fails
mged> facetize -v -v --NMG all all.bot
Error: NMG: tessellating all...
{01} - {02}
class_lu_vs_s(): loop transits plane of shell/face?
It appears, that nmg cannot recover the tiny small sidewall on the right!
Therefore, let us impose an absolute tessellation tolerance of 0.01mm that
would make sure that a feature under 1mm is reproduced adequately.
mged> tol abs 0.01
mged> facetize -v -v --NMG all allNMG.bot
mged> bot_dump -o dgholderNMG.stl -t stl allNMG.bot
NMG: tessellating all...
NMG: tessellating all...
{01} - {02}
{(01 - 02)} - {03}
Works perfectly, as can be visualized through
mged> B allNMG.bot
mged> view aet 18 11 0
mged> view size 80
Similarly, g-stl with -a 0.01 will convert to the .stl without errors
We note that in comparison to all.bot, allNMG.bot looks rather minimal.
This is confirmed by >10-time reduction in size of the resulting .stl :
mged> file size dgholder.stl
2571849
mged> file size dgholderNMG.stl
214389
This closes the issue.
It seems, that this example can serve as a mini-tutorial on NMG and stl ...