SubFile resolving


SubFile resolving
#1
Hello,

I'm trying to write simple program that parse .dat files and build tree representation of LDraw model in memory. I have problem to read some sub file references. For example line:
Code:
1 16 290 0 230 1 0 0 0 1 0 0 0 1 stud.dat
This line is reference to file "stud.dat". Problem is that this file doesn't exists. I can't find advise how to resolve "stud.dat" to existing file name in LDraw part library. Is there any way how to resolve it?

Thanks

Jan
Reply
Re: SubFile resolving
#2
The file stud.dat is a primitive, and is in the p/ subdirectory of the LDraw parts library. File loading in LDraw involves a kind of search path. The standard search path is as follows:
  • . (the main model's directory)
  • <LDraw Dir>\p
  • <LDraw Dir>\parts
  • <LDraw Dir>\models
LDView and some other programs add the following after the above:
  • <LDraw Dir>\Unofficial\p
  • <LDraw Dir>\Unofficial\parts

If your project is in C/C++, you might consider using's Lars C. Hassing's LDrawIni code to find sub-files. (LDView uses this.)
Reply
Re: SubFile resolving
#3
stud.dat is a primitive, those live in the "ldraw/p/" subfolder.

When resolving any type 1 line you need to fist look into the file's own folder, if it's not there look in "ldraw/parts/" if also not there look into "ldraw/p/". If still not found it's a missing file or the user needs to supply additional search paths to your program.

Also if the file is an MPD document, you need to search the "0 FILE " lines before searching the fs.

hope this helps.

[edit] Travis was a bit quicker Smile
Reply
Re: SubFile resolving
#4
Thanks you both for reply, it helps me to move forward. But I'm still struggling with following. When I look at file:
Code:
<LDraw Dir>/parts/10.dat
there is at line 46 next sub file reference:
Code:
1 16 290 0 230 1 0 0 0 1 0 0 0 1 stud.dat
I can't find referenced file "stud.dat" in any LDraw dir. I believe that I'm missing some rule.

Thanks Jan
Reply
Re: SubFile resolving
#5
As written by Roland and Travis, this file must be in <LDraw Dir>/p folder. There are many other primitives, too.
You can try to redownload the complete package...
Unfortunately I am writing on my phone, so that I can't give you the link.

/Max
Reply
Re: SubFile resolving
#6
Thanks, it was my fault. For some reason I don't have "stud.dat" in my <LDraw Dir>/p directory. I found this file is in downloaded complete.zip.

Thanks Jan
Reply
Re: SubFile resolving
#7
The parts library update zips only work if you already have the previous version installed. In other situations, it's best to just go with complete.zip.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)