Concerning the p/8 and p/48 folders


Concerning the p/8 and p/48 folders
#1
Hello!

I am looking for information on the p/8 and p/48 folders in regards to their location when searching the library for a part. Allow me to explain.

I am helping out with a Python-based .dat/.ldr parser (https://github.com/Tribex/LDRParser) that I eventually plan to use in my Blender import plugin (https://github.com/le717/LDR-Importer). As it stands, the parser does not support the 8/48 folders and I am looking into implementing it. I do have those folders supported in my plugin but lately I have begun to think I have implemented it incorrectly. I could not find a spec containing the info I am looking for, hence this topic. (If I am in the wrong section, please move it.) Smile

Currently, I have the search path set up as so (assume HighRes and LowRes are strings representing a three option, mutual selection (so basically, radio buttons). The third value is StandardRes but unused.):

Code:
ldrawDir = "C:/LDraw"
paths = []
paths.append(modelLocation)
paths.append(join(ldrawDir, "models"))

// Unofficial parts
if exists(join(ldrawDir, "unofficial"))
  paths.append(join(ldrawDir, "unofficial", "parts"))
  if opt == HighRes
    paths.append(join(ldrawDir, "unofficial", "p", "48"))
  else if opt == LowRes
    paths.append(join(ldrawDir, "unofficial", "p", "8"))
paths.append(join(ldrawDir, "unofficial", "p"))

// Standard library
paths.append(join(ldrawDir, "parts"))
if opt == HighRes
  paths.append(join(ldrawDir, "p", "48"))
else if opt == LowRes
  paths.append(join(ldrawDir, "p", "8"))
paths.append(join(ldrawDir, "p"))

My questions are:
1. Is this the correct search order I should be using?
2. Are use of the 8/48 mutual as I have it or not?
3. Any other errors I have in this code?

Thanks! Smile
Reply
Re: Concerning the p/8 and p/48 folders
#2
These aren't intended to both be added to the LDraw search path at the same time. To the best of my knowledge, they are intended for two uses:
  • Replacement for standard 16-facet equivalents
  • High/low-resolution geometry specifically referenced in a part
Neither usage would have them both added to the search path. For the first usage, a program would look in either p/8 or p/48 before looking in p. So either p/8 or p/48 would be added to the search path before p, but not both.

For the second usage, 48/ or 8/ is included in the part file itself prior to the dat filename. So, if a part has a large-radius circle, it can use 48/4-4cyli.dat instead of 4-4cyli.dat. The p/48/4-4cyli.dat file would then be picked up while processing the standard p part of the LDraw search path, not with a specific scan inside p/48.

Programs are free to completely ignore the 8 and 48 directories. If they do so, they will work fine (as long as they append the full part name/path to each entry in their search path while searching for the part, and don't just take the filename part).
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)