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
14920  |  14922
Subject: 
Re: Previous step color scaling
Newsgroups: 
lugnet.cad
Date: 
Wed, 17 Oct 2007 13:03:37 GMT
Viewed: 
7761 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



Message has 1 Reply:
  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)

Message is in Reply To:
  Re: Previous step color scaling  [DAT]
 
(...) Correct. Technically, the prel3p commands affect color substitution on following lines, so you'll need to insert code in two places: once at the beginning of the model to use the "faded" colors, and again at whatever point you wish to restore (...) (17 years ago, 17-Oct-07, to lugnet.cad)

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