To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.dat.partsOpen lugnet.cad.dat.parts in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / LDraw Files / Parts / 4722
4721  |  4723
Subject: 
Re: POV in Part
Newsgroups: 
lugnet.cad.dat.parts, lugnet.admin.suggestions
Date: 
Wed, 11 Jun 2003 21:25:26 GMT
Viewed: 
3374 times
  
In lugnet.cad.dat.parts, Don Heyse wrote:
Since L3P already supports the LGEO part library, is it possible
to just add new LGEO parts and have L3P automatically use them?
The only problem I see with this is that the .tab files in the
LGEO library are binary files, but the format of the files seem
fairly simple.  For example, the l2p_elmt.tab file seems to have
an entry for each POV .inc element file.  These entries consist
of a 32 bit counter, an unknown 8 bit number, and a NULL terminated
string with the base filename of the .inc file containing the POV
code for the element.  If we knew what the unknown 8 bit number
was, it'd be a fairly simple matter to write a small program to
add new elements to the .tab file.

Here's a small program to dump the file out as text so we can
examine the unknown 8 bit value.  It looks to me like it contains
some flag bits.  Only 3 bits seem to be used (0x01, 0x02, and 0x80).
From the output it appears as if bit 0x80 indicates an element who's
ldraw part number was moved to a new number.  Bit 0x01 seems to
indicate a slope brick.  Perhaps this is a hint to pull use the
rough texture?  I'm not so sure about bit 0x02.  It seems to be used
on parts that may have old versions like the minifig head with a
solid stud.

Don

#include <stdio.h>

char filename[256] = "l2p_elmt.tab";
int main(void)
{
  FILE *fp;
  long filesize, n, nparsed;
  char *buffer;
  unsigned char *s;
  int i;
  unsigned char c;

  fp = fopen(filename, "rb");
  if (!fp)
  {
    printf("Could not open %s\n", filename);
    exit(1);
  }

  // How big is the file.
  fseek (fp , 0 , SEEK_END);
  filesize = ftell (fp);
  rewind (fp);

  // allocate enough memory to read the entire file.
  buffer = (char*) malloc (filesize);
  if (!buffer)
    exit (2);

  fread (buffer,1,filesize,fp);
  fclose (fp);

  s = buffer;
  for (n = 0; n < filesize; n += nparsed)
  {
    i = (int)*s++ << 24;
    i += (int)*s++ << 16;
    i += (int)*s++ << 8;
    i += (int)*s++;
    nparsed = 4;
    c = *s;
    nparsed++;
    s++;
    printf("%d 0x%02X %s\n", i, (int)c, s);
    nparsed += strlen(s);
    s += strlen(s);
    nparsed++;
    s++;
  }

  free (buffer);
  return 0;
}



Message has 1 Reply:
  Re: POV in Part
 
(...) Yes, L3P would automatically support new LGEO parts if they were added to the binary l2p_elmt.tab. (...) You can use the -d option to L3P to see the contents of LGEO's *.TAB files: l3p -d -lgeo somefile.dat | more (mentioned a couple of years (...) (21 years ago, 11-Jun-03, to lugnet.cad.dat.parts, lugnet.admin.suggestions)

Message is in Reply To:
  Re: POV in Part
 
(...) Since L3P already supports the LGEO part library, is it possible to just add new LGEO parts and have L3P automatically use them? The only problem I see with this is that the .tab files in the LGEO library are binary files, but the format of (...) (21 years ago, 11-Jun-03, to lugnet.cad.dat.parts, lugnet.admin.suggestions)

42 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