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 / 14924
14923  |  14925
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 17 Oct 2007 16:28:17 GMT
Viewed: 
7506 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



Message has 1 Reply:
  Re: Previous step color scaling
 
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! (17 years ago, 18-Oct-07, to lugnet.cad, FTX)

Message is in Reply To:
  Re: Previous step color scaling
 
(...) 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 (...) (17 years ago, 17-Oct-07, to lugnet.cad, FTX)

34 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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