To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 14921
     
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 17 Oct 2007 13:03:37 GMT
Viewed: 
7856 times
  

In lugnet.cad, Jim DeVona wrote:
   Here is the example car with PreL3P commands inserted:

0 Car 0 Name: CAR.DAT 0 Author: James Jessiman 0 Original LDraw Model - LDraw beta 0.27 Archive 0 Car 0 !PREL3P +codes none 0 !PREL3P -ldconfig faded.ldr 1 0 0 0 -90 1 0 0 0 1 0 0 0 1 4315.DAT 1 7 0 0 -60 1 0 0 0 1 0 0 0 1 4600.DAT 1 0 0 0 0 1 0 0 0 1 0 0 0 1 3031.DAT 1 7 0 0 60 1 0 0 0 1 0 0 0 1 4600.DAT 1 0 0 0 90 -1 0 0 0 1 0 0 0 -1 4315.DAT 0 !PREL3P -ldconfig normal.ldr 1 46 30 -8 -90 1 0 0 0 1 0 0 0 1 3024.DAT 1 46 -30 -8 -90 1 0 0 0 1 0 0 0 1 3024.DAT 1 4 0 -8 -60 0 0 1 0 1 0 -1 0 0 3020.DAT 1 4 30 -8 -10 0 0 1 0 1 0 -1 0 0 3623.DAT 1 4 -30 -8 -10 0 0 1 0 1 0 -1 0 0 3623.DAT 1 4 30 -8 30 1 0 0 0 1 0 0 0 1 3024.DAT 1 4 -30 -8 30 1 0 0 0 1 0 0 0 1 3024.DAT 1 4 0 -8 50 0 0 1 0 1 0 -1 0 0 3021.DAT 1 4 0 -8 90 1 0 0 0 1 0 0 0 1 3710.DAT 1 1 0 -8 0 1 0 0 0 1 0 0 0 1 4079.DAT

If you have access to a *nix machine, or have installed the appropriate cygwin components on a Windows box, the following script should take a bunch of step files spit out from MLCad and insert the appropriate PREL3P commands in.

#! /bin/sh

prevfile=''
for thisfile in $*; do
    if [ "$prevfile" = "" ]; then
        echo 0 !PREL3P -ldconfig normal.ldr > faded.$thisfile
        cat $thisfile >> faded.$thisfile
    else
        echo 0 !PREL3P +codes none > faded.$thisfile
        echo 0 !PREL3P -ldconfig faded.ldr >> faded.$thisfile
        cat $prevfile >> faded.$thisfile
        echo 0 !PREL3P -ldconfig normal.ldr >> faded.$thisfile
        diff $prevfile $thisfile | egrep ^\> | cut -c3- >> faded.$thisfile
    fi
    prevfile=$thisfile
done

Example usage:

./fadesteps.sh CAR*.ldr

Given the two CAR ldr files in Jaco’s message, here is the output for step 2 (saved in a file named faded.CAR_00002.ldr):

0 !PREL3P +codes none
0 !PREL3P -ldconfig faded.ldr
0 Car
0 Name: CAR.DAT
0 Author: James Jessiman
0 Original LDraw Model - LDraw beta 0.27 Archive
0 Car
1 0 0 0 -90 1 0 0 0 1 0 0 0 1 4315.DAT
1 7 0 0 -60 1 0 0 0 1 0 0 0 1 4600.DAT
1 0 0 0 0 1 0 0 0 1 0 0 0 1 3031.DAT
1 7 0 0 60 1 0 0 0 1 0 0 0 1 4600.DAT
1 0 0 0 90 -1 0 0 0 1 0 0 0 -1 4315.DAT
0 !PREL3P -ldconfig normal.ldr
1 46 30 -8 -90 1 0 0 0 1 0 0 0 1 3024.DAT
1 46 -30 -8 -90 1 0 0 0 1 0 0 0 1 3024.DAT
1 4 0 -8 -60 0 0 1 0 1 0 -1 0 0 3020.DAT
1 4 30 -8 -10 0 0 1 0 1 0 -1 0 0 3623.DAT
1 4 -30 -8 -10 0 0 1 0 1 0 -1 0 0 3623.DAT
1 4 30 -8 30 1 0 0 0 1 0 0 0 1 3024.DAT
1 4 -30 -8 30 1 0 0 0 1 0 0 0 1 3024.DAT
1 4 0 -8 50 0 0 1 0 1 0 -1 0 0 3021.DAT
1 4 0 -8 90 1 0 0 0 1 0 0 0 1 3710.DAT
1 1 0 -8 0 1 0 0 0 1 0 0 0 1 4079.DAT


Note that the script assumes that the files will be fed to it in step order. On a *nix machine (and under cygwin as well, I assume), alphabetical order will be used if you say *.ldr, so that makes usage easy. It also assumes that each step file is an exact superset of the previous step file. This is true of the two sample files Jaco posted.

The script is quick and dirty, so you’ll want to modify the lines that insert the PREL3P meta-commands to use the ldr filenames of your own custom LDConfig files if you choose to use filenames other than faded.ldr and normal.ldr for those.

--Travis

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 17 Oct 2007 13:37:08 GMT
Viewed: 
7267 times
  

In lugnet.cad, Travis Cobbs wrote:
   If you have access to a *nix machine, or have installed the appropriate cygwin components on a Windows box, the following script should take a bunch of step files spit out from MLCad and insert the appropriate PREL3P commands in.

#! /bin/sh

prevfile=''
for thisfile in $*; do
    if [ "$prevfile" = "" ]; then
        echo 0 !PREL3P -ldconfig normal.ldr > faded.$thisfile
        cat $thisfile >> faded.$thisfile
    else
        echo 0 !PREL3P +codes none > faded.$thisfile
        echo 0 !PREL3P -ldconfig faded.ldr >> faded.$thisfile
        cat $prevfile >> faded.$thisfile
        echo 0 !PREL3P -ldconfig normal.ldr >> faded.$thisfile
        diff $prevfile $thisfile | egrep ^\> | cut -c3- >> faded.$thisfile
    fi
    prevfile=$thisfile
done

Example usage:

./fadesteps.sh CAR*.ldr

I tried the script out in Windows using cygwin, and it seems to work. Some observations:
  • Until prel3p 1.3 is released by Jim, I can’t be sure it works.
  • The output is a mixture of DOS and Unix line endings. The files generated by MLCAD have DOS line endings, and the extra lines added by the script have Unix line endings. LDView doesn’t have a problem with this, but prel3p might. In cygwin, this can be corrected by adding | unix2dos at the end of each echo command (right before the > or >>). The output files are then in pure DOS format.
  • The script would be a lot more useful if it actually included the prel3p execution as part of the script so that the output files were really faded, instead of just having prel3p meta-statements inside.
  • On that note, adding an LDView command line to the script would likely also be useful, assuming you want to use LDView to generate the step images.
I think prel3p 1.3 needs to be released before the script can be updated to automate things further.

--Travis

   
         
     
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 17 Oct 2007 16:28:17 GMT
Viewed: 
7507 times
  

Here’s a slightly tweaked version that seems to work OK with paths and filenames containing spaces:

#! /bin/sh

prevfile=''
for thisfile in "$@"; do
 if [ "$prevfile" = "" ]; then
  echo 0 !PREL3P -ldconfig normal.ldr > "faded.$thisfile"
  cat "$thisfile" >> "faded.$thisfile"
 else
  echo 0 !PREL3P +codes none > "faded.$thisfile"
  echo 0 !PREL3P -ldconfig faded.ldr >> "faded.$thisfile"
  cat "$prevfile" >> "faded.$thisfile"
  echo 0 !PREL3P -ldconfig normal.ldr >> "faded.$thisfile"
  diff "$prevfile" "$thisfile" | egrep ^\> | cut -c3- >> "faded.$thisfile"
 fi
 prevfile=$thisfile
done

  
   Example usage:

./fadesteps.sh CAR*.ldr

Depending on your shell, keep in mind this may not give the intended sequence if you’ve got 10 or more step files. bash on Mac OS X sorts like this:

step1.ldr, step11.ldr, step12.ldr, step2.ldr, step3.ldr, ...

There’s probably some trick to make the shell expansion sort smarter. Otherwise it’d probably be easiest just to sort the arguments in the script.

   I tried the script out in Windows using cygwin, and it seems to work. Some observations:
  • Until prel3p 1.3 is released by Jim, I can’t be sure it works.

It does. It would work with Bricksmith’s step export, too, if Bricksmith included a final newline in its exported files. Until then, it’s easy enough to add newlines manually or with your favorite editor’s multi-file search & replace tool.

  
  • The output is a mixture of DOS and Unix line endings. The files generated by MLCAD have DOS line endings, and the extra lines added by the script have Unix line endings. LDView doesn’t have a problem with this, but prel3p might. In cygwin, this can be corrected by adding | unix2dos at the end of each echo command (right before the > or >>). The output files are then in pure DOS format.

PreL3P can read any line endings, including a mixture. It outputs DOS line endings per LDraw convention.

  
  • The script would be a lot more useful if it actually included the prel3p execution as part of the script so that the output files were really faded, instead of just having prel3p meta-statements inside.
  • On that note, adding an LDView command line to the script would likely also be useful, assuming you want to use LDView to generate the step images.

Agreed. In fact, that’s basically how I’ve been planning to use prel3p. Ideally a script like this would be able to insert different ldconfig files and pass additional options through to LDView/prel3p.

I am pleased with the reception that PreL3P has received, especially since this step-fading trick wasn’t part of the original idea. Please continue to provide feedback, including examples like this and ideas for improvements.

   I think prel3p 1.3 needs to be released before the script can be updated to automate things further.

Tomorrow!

Jim

    
          
     
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Thu, 18 Oct 2007 08:47:23 GMT
Viewed: 
7717 times
  

All previous posts look promising! If you guys could use your precious time to write some Windows tools to do things like executing the script and stuff I can’t wait to try it out!

    
          
     
Subject: 
PreL3P 1.3
Newsgroups: 
lugnet.cad
Date: 
Thu, 18 Oct 2007 17:42:02 GMT
Viewed: 
8168 times
  

I posted the new version of PreL3P today. The only addition, of course, is
support for meta commands at any point in the model.

http://anoved.net/2007/10/prel3p.html

Meta commands at the beginning of the model are still "special" in that they
override the default command line options. This facilitates cases like the drag
and drop actions described by Tore where it is desirable to be able to configure
everything from within the file.

Subsequent meta commands in the model only take effect at that point.

I am working on a more informative post about using PreL3P for step fading, but
it probably won't be finished until some time tomorrow.

As always, feedback is welcome. I am aware of one bug (a design flaw with the
-ldconfig meta command, really) that I will try to fix soon, too.

Jim

    
          
     
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Mon, 22 Oct 2007 06:47:43 GMT
Viewed: 
8254 times
  

In lugnet.cad, Jim DeVona wrote:
I posted the new version of PreL3P today. The only addition, of course, is
support for meta commands at any point in the model.

http://anoved.net/2007/10/prel3p.html


==== 8< - - -

Jim

Too busy with my latest project, I haven't tried PreL3P that much yet.
I may have misunderstood the -help option, because I tried the v1.3.1 both from
DOS Prompt Box as well as from a batch file, with same result:

----------------------------------------
F:\LDraw\Apps\Utils>prel3p.exe -help
Invalid input file: couldn't open "-help": no such file or diectory

F:\LDraw\Apps\Utils>
----------------------------------------

Ah, and one more thing on my wish list: Accepting wildcard input wouldn't be so
bad. Like:
PreL3P.exe *.ldr
, instead of writing a 10+ lines batch file or "zipping" all the subfiles into
an .MPD. (I think the concept of MPDs is good, but personally I prefer not to
use it if I can get away without it.)


/Tore

    
          
     
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Mon, 22 Oct 2007 13:20:05 GMT
Viewed: 
8399 times
  

In lugnet.cad, Tore Eriksson wrote:

Too busy with my latest project, I haven't tried PreL3P that much yet.
I may have misunderstood the -help option, because I tried the v1.3.1 both from
DOS Prompt Box as well as from a batch file, with same result:

----------------------------------------
F:\LDraw\Apps\Utils>prel3p.exe -help
Invalid input file: couldn't open "-help": no such file or diectory

F:\LDraw\Apps\Utils>
----------------------------------------

For what it's worth, that is the error message that version 1.1 would report
given the -help argument. Otherwise, you appear to be using it correctly. Do
either of the synonyms "-h" or "--help" work? I can't seem to reproduce the
problem.

Anyway, the -help option simply prints the summary from the box under the
"Usage" section on the PreL3P web page.

Ah, and one more thing on my wish list: Accepting wildcard input wouldn't be so
bad. Like:
PreL3P.exe *.ldr
, instead of writing a 10+ lines batch file or "zipping" all the subfiles into
an .MPD.

No, that wouldn't be so bad. PreL3P handles one file at a time because it's what
made sense with the original stdin->stdout syntax. The explicit -in and -out
options use that model, too; "prel3p -in FILE" prints output to standard out.
I'll consider it.

Jim

    
          
     
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Thu, 25 Oct 2007 05:16:06 GMT
Viewed: 
8797 times
  

&In lugnet.cad, Jim DeVona wrote:
In lugnet.cad, Tore Eriksson wrote:

Too busy with my latest project, I haven't tried PreL3P that much yet.
I may have misunderstood the -help option, because I tried the v1.3.1 both from
DOS Prompt Box as well as from a batch file, with same result:

---------------------------------------- • ; F:\LDraw\Apps\Utils>prel3p.exe -help
Invalid input file: couldn't open "-help": no such file or diectory

F:\LDraw\Apps\Utils>
----------------------------------------

For what it's worth, that is the error message that version 1.1 would report
given the -help argument. Otherwise, you appear to be using it correctly. Do
either of the synonyms "-h" or "--help" work? I can't seem to reproduce the
problem.

I've added the ability to process multiple files in one run, but before I
release that I'd like to check whether there's any more information regarding
this -help issue. Can you confirm whether either of the alternate help options
(-h or --help) work with 1.3.1, or can anyone else confirm that they don't?

Thanks!
Jim

    
          
      
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Thu, 25 Oct 2007 06:54:46 GMT
Viewed: 
8920 times
  

In lugnet.cad, Jim DeVona wrote:
I've added the ability to process multiple files in one run

Just curious, how'd you end up implementing that?  If I recall,
unix shells will expand a *.ldr arg for you, but on Windows it's
left to the program to do it.

Don

     
           
      
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad, lugnet.cad.dev
Date: 
Thu, 25 Oct 2007 09:46:55 GMT
Viewed: 
10133 times
  

In lugnet.cad, Don Heyse wrote:
In lugnet.cad, Jim DeVona wrote:
I've added the ability to process multiple files in one run

Just curious, how'd you end up implementing that?  If I recall,
unix shells will expand a *.ldr arg for you, but on Windows it's
left to the program to do it.

Ah, thanks for bringing that to my attention. I was not aware of the difference.

My addition currently understands multiple arguments with this syntax:

prel3p 1.ldr 2.ldr 3.ldr

Each ldr file is processed in place and the originals are copied to 1.ldr.bak,
2.ldr.bak, and 3.ldr.bak. I had indeed assumed the shell would take care of
wildcard expansion, as is the case with unix shells.

However, with some careful thought it will not be hard to internalize wildcard
support: http://www.tcl.tk/man/tcl8.4/TclCmd/glob.htm

Jim

     
           
      
Subject: 
PreL3P 1.4
Newsgroups: 
lugnet.cad
Date: 
Mon, 5 Nov 2007 19:14:06 GMT
Viewed: 
9327 times
  

PreL3P 1.4 can process multiple files. It understands wildcard characters, too,
so you can easily process many files at once in environments that don't perform
wildcard expansion automatically (ie, "prel3p *.ldr").

http://anoved.net/2007/10/prel3p.html

As always, please report any bugs you discover. Thanks!

Jim

     
           
      
Subject: 
Re: PreL3P 1.4
Newsgroups: 
lugnet.cad, lugnet.cad.dev.mac
Date: 
Tue, 6 Nov 2007 10:01:31 GMT
Viewed: 
14269 times
  

In lugnet.cad, Jim DeVona wrote:

http://anoved.net/2007/10/prel3p.html

As always, please report any bugs you discover. Thanks!

I've posted a Mac "Service" version, too. You put it in ~/Library/Services/, and
then you can process any selected LDraw text by selecting "PreL3P" from the
Services submenu of the current application menu. I haven't tested it much.

Although you can't use any of the command line options in this context, you can
still control what it does with the meta commands.

Jim

    
          
     
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Thu, 25 Oct 2007 07:03:04 GMT
Viewed: 
8967 times
  

In lugnet.cad, Jim DeVona wrote:
&In lugnet.cad, Jim DeVona wrote:
In lugnet.cad, Tore Eriksson wrote:

Too busy with my latest project, I haven't tried PreL3P that much yet.
I may have misunderstood the -help option, because I tried the v1.3.1 both from
DOS Prompt Box as well as from a batch file, with same result:

---------------------------------------- ; F:\LDraw\Apps\Utils>prel3p.exe -help
Invalid input file: couldn't open "-help": no such file or diectory

F:\LDraw\Apps\Utils>
----------------------------------------

For what it's worth, that is the error message that version 1.1 would report
given the -help argument. Otherwise, you appear to be using it correctly. Do
either of the synonyms "-h" or "--help" work? I can't seem to reproduce the
problem.

I've added the ability to process multiple files in one run, but before I
release that I'd like to check whether there's any more information regarding
this -help issue. Can you confirm whether either of the alternate help options
(-h or --help) work with 1.3.1, or can anyone else confirm that they don't?

Thanks!
Jim

Sorry, my wrong!

I thought I used the latest version, but I didn't. All variants of the -help
switch work on 1.3.1.

Time to delete all outdated versions from my HD. :)


/Tore

    
          
     
Subject: 
Re: PreL3P 1.3 -help :)
Newsgroups: 
lugnet.cad
Date: 
Thu, 25 Oct 2007 09:48:42 GMT
Viewed: 
8956 times
  

In lugnet.cad, Tore Eriksson wrote:

I've added the ability to process multiple files in one run, but before I
release that I'd like to check whether there's any more information regarding
this -help issue. Can you confirm whether either of the alternate help options
(-h or --help) work with 1.3.1, or can anyone else confirm that they don't?

Thanks!
Jim

Sorry, my wrong!

I thought I used the latest version, but I didn't. All variants of the -help
switch work on 1.3.1.

Time to delete all outdated versions from my HD. :)

No problem. Thanks for the clarification - I thought it was entirely possible
that something else might have been intercepting the -help argument.

Jim

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Tue, 30 Oct 2007 01:11:37 GMT
Viewed: 
7845 times
  

And how can one create building instructions without access to a *nix machine (what is that anyway :-) and no cygwin components on a Windows PC?

I am desperately looking for a way to create smooth building step images top view for a very large project I am working on.

I can’t tell much more about the project yet, but the model is a nearly 7 feet tall statue containing over 26.000 bricks.

Here is a screenshot of a step that MLCad produces on screen and what I am looking for to create:



Creating images using MLCad gives all kind of trash pixels in the images if I create GIF’s or JPG. Bitmaps would be too large.

And I want the previous step colors to be lighter so that you can really tell what parts are new and what are allready there.

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Tue, 30 Oct 2007 04:36:04 GMT
Viewed: 
8045 times
  

In lugnet.cad, Jaco van der Molen wrote:

And how can one create building instructions without access to a *nix machine
(what is that anyway :-) and no cygwin components on a Windows PC?

Well, that's what LPub does, right?

Anyway, PreL3P should work at a Windows DOS prompt (or whatever you call it), so
the PreL3P-LDView technique we talk about here should be possible in Windows.
The shell script does require unix or cygwin, but you can do the same thing
manually - insert the two lines at the beginning of each step model and the line
at the beginning of the last step. Might not be fun with such a big model,
though.

For my own projects, I'd started a similar script to apply PreL3P to many files
and render the results. It's far from presentable, but I suppose I could
eventually package it up for PC usage the same way I did with PreL3P. Won't be
soon, but might be useful.

Jim

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Tue, 30 Oct 2007 22:52:02 GMT
Viewed: 
8026 times
  

In lugnet.cad, Jim DeVona wrote:
In lugnet.cad, Jaco van der Molen wrote:

And how can one create building instructions without access to a *nix machine
(what is that anyway :-) and no cygwin components on a Windows PC?

Well, that's what LPub does, right?

LOL! I know (ofcourse). I wrote it wrong. I ment: how can one use the script
Travis provided to insert the PreL3P codes into the LDraw files :-)

Anyway, PreL3P should work at a Windows DOS prompt (or whatever you call it), so
the PreL3P-LDView technique we talk about here should be possible in Windows.
The shell script does require unix or cygwin, but you can do the same thing
manually - insert the two lines at the beginning of each step model and the line
at the beginning of the last step. Might not be fun with such a big model,
though.

No it won't be fun at all :-(

For my own projects, I'd started a similar script to apply PreL3P to many files
and render the results. It's far from presentable, but I suppose I could
eventually package it up for PC usage the same way I did with PreL3P. Won't be
soon, but might be useful.

I am still a bit confused how to work things out with PreL3P, but I will do some
testing and trying.

Thanks!

Jaco

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 31 Oct 2007 06:58:00 GMT
Viewed: 
8165 times
  

In lugnet.cad, Jaco van der Molen wrote:
   In lugnet.cad, Jim DeVona wrote:
   In lugnet.cad, Jaco van der Molen wrote:

   And how can one create building instructions without access to a *nix machine (what is that anyway :-) and no cygwin components on a Windows PC?

Well, that’s what LPub does, right?

LOL! I know (ofcourse). I wrote it wrong. I ment: how can one use the script Travis provided to insert the PreL3P codes into the LDraw files :-)

Try the following (assumes Win2K/WinXP):
  • Download cygwin from http://www.cygwin.com/ (click the “Install or update now!” link)
  • Run cygwin’s setup.exe file that you downloaded
  • Follow the instructions for a default install and choose a working mirror. (I used mirror.rhsmith.umd.edu after much trial and error.)
  • Start->Run: cmd
  • Note the directory that you’re in, and explore to there in Windows Explorer
  • Create a file named StepFade.sh (or whatever you want to call the script) in that directory, and paste the contents of my script text into that file. Modify the bits that I said to modify to suit your setup
  • Start->All Programs->Cygwin->Cygwin Bash Shell
  • Change into the directory containing your step files using the cd command. Note that cygwin is very strange with paths, so instead of C:, you use /cygdrive/c. Also, instead of \ (back slash) in paths, you use / (forward slash). So to go to C:\ldraw\models\TestModel, you would type the following:
cd /cygdrive/c/ldraw/models/TestModel
  • Run the script like so:
~/StepFade.sh Model*.ldr
  • (Replace Model above with the base filename of your model.)
Let me know if you have any questions or problems.

Some notes about the above:
  • The directory you start out in when you run cmd is your USERPROFILE directory in Windows. In cygwin, this is considered to be your home directory.
  • In the bash shell (and all other unix shells), ~ maps to your home directory, so ~/StepFade.sh tells it to run the StepFade.sh script that’s located in your home directory. That’s why I had you place the script there. Alternatively, you can place it in C:\cygwin\usr\local\bin, and it will be in the path in cygwin, allowing you to just run it. (This assumes that you install cygwin into the C:\cygwin directory. If you put it elsewhere, adjust accordingly.)
--Travis

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 31 Oct 2007 14:17:40 GMT
Viewed: 
8335 times
  

In lugnet.cad, Travis Cobbs wrote:
   In lugnet.cad, Jaco van der Molen wrote:
   In lugnet.cad, Jim DeVona wrote:
   In lugnet.cad, Jaco van der Molen wrote:

   And how can one create building instructions without access to a *nix machine (what is that anyway :-) and no cygwin components on a Windows PC?

Well, that’s what LPub does, right?

LOL! I know (ofcourse). I wrote it wrong. I ment: how can one use the script Travis provided to insert the PreL3P codes into the LDraw files :-)

Try the following (assumes Win2K/WinXP):
  • Download cygwin from http://www.cygwin.com/ (click the “Install or update now!” link)
  • Run cygwin’s setup.exe file that you downloaded
  • Follow the instructions for a default install and choose a working mirror. (I used mirror.rhsmith.umd.edu after much trial and error.)
  • Start->Run: cmd
  • Note the directory that you’re in, and explore to there in Windows Explorer
  • Create a file named StepFade.sh (or whatever you want to call the script) in that directory, and paste the contents of my script text into that file. Modify the bits that I said to modify to suit your setup
  • Start->All Programs->Cygwin->Cygwin Bash Shell
  • Change into the directory containing your step files using the cd command. Note that cygwin is very strange with paths, so instead of C:, you use /cygdrive/c. Also, instead of \ (back slash) in paths, you use / (forward slash). So to go to C:\ldraw\models\TestModel, you would type the following:
cd /cygdrive/c/ldraw/models/TestModel
  • Run the script like so:
~/StepFade.sh Model*.ldr
  • (Replace Model above with the base filename of your model.)
Let me know if you have any questions or problems.

Some notes about the above:
  • The directory you start out in when you run cmd is your USERPROFILE directory in Windows. In cygwin, this is considered to be your home directory.
  • In the bash shell (and all other unix shells), ~ maps to your home directory, so ~/StepFade.sh tells it to run the StepFade.sh script that’s located in your home directory. That’s why I had you place the script there. Alternatively, you can place it in C:\cygwin\usr\local\bin, and it will be in the path in cygwin, allowing you to just run it. (This assumes that you install cygwin into the C:\cygwin directory. If you put it elsewhere, adjust accordingly.)

Or if you’re really, really scared of cygwin, this StepFade.bat file might work on XP. But I didn’t test it all that much, and I don’t claim to know all the nuances of the old DOS fc and find commands. The unix diff and grep commands are so much easier to use.

@ECHO OFF

:Expand wildcard args and create a real file list.
IF EXIST #files.txt DEL #files.txt
:makelist
IF "%1."=="." GOTO gotlist
FOR %%i IN (%1) DO ECHO %%i >> #files.txt
SHIFT
GOTO makelist
:gotlist

:Process the files in that list and then clean up.
SET prevfile=
:fileloop
    FOR /F %%f IN (#files.txt) DO CALL :eachfile %%f
    IF EXIST #files.txt DEL #files.txt
    IF EXIST tmpfile.txt DEL tmpfile.txt
    IF EXIST tmpfile2.txt DEL tmpfile2.txt
    GOTO done

:Subroutine to process each file in the list.
:eachfile
    IF "%prevfile%."=="." GOTO firstfile
    GOTO nextfile
:firstfile
    ECHO Firstfile "%1"
    ECHO 0 !PREL3P -ldconfig normal.ldr > faded.%1
    TYPE %1 >> faded.%1
    SET prevfile=%1
    GOTO :eof
:nextfile
    ECHO Nextfile "%1"
    ECHO 0 !PREL3P +codes none > faded.%1
    ECHO 0 !PREL3P -ldconfig faded.ldr >> faded.%1
    TYPE %prevfile% >> faded.%1
    ECHO 0 !PREL3P -ldconfig normal.ldr >> faded.%1
    FC %prevfile% %1 > tmpfile.txt
    FIND /i /v "FC: no differences encountered" <tmpfile.txt >tmpfile2.txt
    FIND /i /v "Comparing files " <tmpfile2.txt >tmpfile.txt
    FIND /i /v "*****" <tmpfile.txt >tmpfile2.txt
    TYPE tmpfile2.txt >> faded.%1
    SET prevfile=%1
    GOTO :eof

:done

Have fun,

Don

   
         
   
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Fri, 2 Nov 2007 11:36:48 GMT
Viewed: 
8249 times
  

In lugnet.cad, Don Heyse wrote:

   Or if you’re really, really scared of cygwin, this StepFade.bat file might work on XP. But I didn’t test it all that much, and I don’t claim to know all the nuances of the old DOS fc and find commands. The unix diff and grep commands are so much easier to use.

Me? Scared? No :-) I have succesfully installed Cygwin on my XP PC and Vista Laptop. After some errors and Travis helping me solve those, I am now able to run his script and create LDraw files with the PreL3P commands in them.

Thanks for your effort, Don. I will try your script too!

 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR