Use BRLSpiral.pl with BRL

Cyberchipz
2014-06-02
2014-06-16
  • Cyberchipz
    Cyberchipz
    2014-06-02

    I ran into the BRLSpiral code, which uses perl, but I'm not sure how I can use this to generate the image in BRL, or Archer. Can anyone help with that?

    I see that the code generates the commands by calling an executable and basically creating kind of a script to run. But, I'm not sure what format that is, or how to get a file to load, or where to load the commanddata to generate the image. When I ran the script, it just generated the data, not the image, and I had to cut and paste that into a file.

    I suppose I can somehow pipe it into a file (or at least I suspect)... I'm not an 'expert' at any of this by any means, I'm really a Windows guy pretty much at the core, but am learning Linux, and thus perl. Both Perl & BRL is on a Windows machine running the latest BRL & Perl (not 6). But I can program in most any language with a little cramming and a few examples, and this looks like the best way to get BRL to make what I want. This looks like a great sample program to... So, any help is appreciated.

    So, to rephrase, looking for help to just produce the Spiral image from the Spiral.pl or .plx file and not just the data. Sorry if I am repeating myself, just trying, in the absence of specific language skills, to get across what I'm looking for.

    Chip

     
  • Sean Morrison
    Sean Morrison
    2014-06-03

    Sure, thanks for the inquiry.

    Basically, the perl script creates a geometry file (named "spiral.g") with a model (named "spiral.c"). You could run MGED or Archer to view that model, modify it, or whatever, and there is a pretty detailed introduction to MGED at http://brlcad.org/wiki/Documentation (#2) or a quick command reference (#2.1) if you're really feeling adventurous.

    The piece you're wanting (a rendered image) is achieved using "rt" which is a command-line application similar to mged as well as a command you can run from within mged and/or archer. Basically, adding a line to your perl script like this should do the trick:
    rt -W -s1024 -o spiral.png spiral.g spiral.c;

    There's a manual page on all of those options to rt (run "man rt" in mged to read it). There's also a LOT more ways you can get that rendering like clicking a raytrace button in mged/archer.

    What might also be helpful to you is this script, which is very similar to the perl one but adds additional commands to create a rendering: http://brlcad.org/wiki/SGI_Cube

    Cheers!
    Sean

     
    • Cyberchipz
      Cyberchipz
      2014-06-16

      Thank you so much for your reply; I'll give your suggestions a go, and see where I get. Thank you again.