Threaded bolts

Help
2009-10-16
2013-04-22
  • Jack Devanney

    Jack Devanney - 2009-10-16

    Web page mentions a project called hex
    for creating threaded bolts.
    But the only hex I can find in my source is a dump.
    Any ideas where I can find/download this code.
    Many thanks,

    djw1

     
  • ljj038

    ljj038 - 2009-10-17

    you can download the code of hex from http://brlcad.org/wiki/Hex.  you must do exactly flow the Installation section.  Then you can enjoy your hex

     
  • Jack Devanney

    Jack Devanney - 2009-10-17

    Many thanks.  Everything compiled and worked as advertised.
    But threaded portion is not really a solid, so it does
    not participate in boolean operations and raytracing
    in the same way as a solid.  Am I missing something?

     
  • Sean Morrison

    Sean Morrison - 2009-10-21

    Alas, the 'hex' tool you encountered is not one of our supported tools as it's from a 3rd-party.  That said, I'm not understanding your comment about it not really being "a solid".  It's true that the threads are not a single primitive.  The tool creates the threads using boolean combinations (unions) of many torii.

    Regardless of the bolt being composed of many primitives, it is still solid.  It should raytrace just fine and the resulting bolt is usable in boolean operations.  Sounds like you are missing something, but it's not clear what.  Perhaps provide a more concrete example of what you're trying to do.

    Cheers!
    Sean

     
  • Jack Devanney

    Jack Devanney - 2009-10-23

    Sean,

    Imaybe I'm missing something but I wasted a half-day on something
    that not only does not look like a solid, took forever to raytrace,
    and does not closely model any real world thread.
    So I wrote my own.  Anyone who wants can download
    it from www.c4tx.org/ctx/brlcad/sample_threaded_rod.perl.
    This approximates a standard ISO 68 metric thread
    as closely as desired
    using trapezoidal arb8s.  Its compact and renders quickly.
    The core code is about 40 lines of perl.
    The perl script creates a tcl scipt which can then
    be sourced into mged.  I work far faster in Perl than tcl
    so this level of indirection works for me,
    but the Perl could easily be tranlated into tcl or C.

    KTF

    Jack

     
  • Sean Morrison

    Sean Morrison - 2009-10-29

    Jack,

    It sounds like something's not working right because that should have generated a solid bolt not unlike the one your script generates but using different primitives and is a different thread cut type.  Regardless, I'm glad you found a solution and (most importantly) thanks for sharing your script!  Hopefully that will be of use to others as well.

    For others that find this thread, it looks like the forum chewed up the original URL address, which should be

      : http://www.c4tx.org/ctx/brlcad/sample_threaded_rod.perl

    The difference between the two approaches is your script uses a piecewise linear approximation using arb8s.  The other hex bolt tool used torus primitives instead.   Using many torii is what makes it take substantially longer to render.

      : http://brlcad.org/tmp/hexbolt.png

    Cheers!<br>
    Sean

     
  • Sean Morrison

    Sean Morrison - 2009-10-29

    Jack,

    Also forgot to mention, feel free to add your script to the wiki as an example for others!  Here's a similar wiki page that is written in a tutorial style:

    Cheers!
    Sean

      : http://brlcad.org/wiki/SGI_Cube

     
  • Jack Devanney

    Jack Devanney - 2009-10-29

    Sean,

    I found the SGI_cube and the old chicken coop (where did it go)
    examples
    very useful in learning how to script BRL-CAD.

    When I get a chance, I will convert the script to TCL and put  it
    on the Wiki.  Also still getting some artifacts for certain
    combinations of diam and pitch which I need to fix.

    Question: is there a mged variant which takes the script
    as an argument rather than the compiled model database.
    For a scripter, it is his script that descibes the model
    not the database which is wiped out and rebuilt
    each time the script is run. What I think we need is
    a command (say brl_display xxx.tcl) which is the equivalent
    of

    rm xxx.g

    mged xxx.g (without the do you want a new db dialog)

    source xxx.tcl

    save some typing and more importantly the brl_display
    command could be included in a  master script,
    say a non-standard animation such as a ship
    responding to a wave.

    KTF

    Jack

     
  • Sean Morrison

    Sean Morrison - 2009-10-29

    Your perl script is actually a pretty good example already, just perhaps with some introductory/explanatory text to go along with it.  Showing how to script mged from various languages is useful in itself.

    If you take it a step further, you could improve/replace the simple hex/bolt binary written in C that is included with BRL-CAD.. ;-)  Contributions always welcome.

    As to your question, my first thought would be to run mged in single-command mode where it won't do any interactive prompting:

    mged -c xxx.g source xxx.tcl

    ( The "-c" is technically not necessary, but a good practice to indicate you're running without a GUI. )
    That said, you can create a Tcl proc that does *exactly* what you suggested pretty easily too, which you could put into your .mgedrc (See File->Create/Update .mgedrc menu option):

        # notional example without any error checking
        proc brl_display {xxx} {
            exec rm ${xxx}.g
            opendb ${xxx}.g y
            source ${xxx}.tcl
        }

    Cheers!
    Sean

     
  • Jack Devanney

    Jack Devanney - 2009-10-30

    Sean,

    We've gotten a long way from bolt thread profiles,, and I don't want to
    take up any more of yr time,  but  I think the need for a
    brl_display like command is important and should be part of
    the package.

    A scripter usually wants the GUI to view the model from various
    angles, check for conflicts, add/subtract stuff from the dispaly, etc.
    So  solution 1 is not the answer.

    I could not get solution 2 to work (probably my fault).
    The three commands work as advertised when I type
    them into the mged command window directly,
    but when I put them in my .mgedrc, the y argument
    to opendb seems to be ignored and I still get the dialog.

    But even if the put it in yr .mgedrc workaround can be
    made to work, it would be a poor solution.
    Asking the normal user to edit a configuration file
    to do the basic job of executing his script is
    bad pedagogy and will simply turn people off.

    I'll take a look at the mged source and,
    if it doesnt look too bad, submit a patch.

    KTF

    Jack

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks