LDraw.org Discussion Forums

Full Version: replacing the filename with the file data but getting no graphical data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi,

If you load in a file data to a project, how do you edit the part colour like you would if you were to edit an entire sub part, for example by typing:
'1 16 0 -4 0 6 0 0 0 1 0 0 0 6 4-4disc.dat'
The '4-4'stud.dat' part is replaced by the file data, and that file data is listed below:

3 16 0 0 0 1 0 0 0.9239 0 0.3827
3 16 0 0 0 0.9239 0 0.3827 0.7071 0 0.7071
3 16 0 0 0 0.7071 0 0.7071 0.3827 0 0.9239
3 16 0 0 0 0.3827 0 0.9239 0 0 1
3 16 0 0 0 0 0 1 -0.3827 0 0.9239
3 16 0 0 0 -0.3827 0 0.9239 -0.7071 0 0.7071
3 16 0 0 0 -0.7071 0 0.7071 -0.9239 0 0.3827
3 16 0 0 0 -0.9239 0 0.3827 -1 0 -0
3 16 0 0 0 -1 0 -0 -0.9239 0 -0.3827
3 16 0 0 0 -0.9239 0 -0.3827 -0.7071 0 -0.7071
3 16 0 0 0 -0.7071 0 -0.7071 -0.3827 0 -0.9239
3 16 0 0 0 -0.3827 0 -0.9239 0 0 -1
3 16 0 0 0 0 0 -1 0.3827 0 -0.9239
3 16 0 0 0 0.3827 0 -0.9239 0.7071 0 -0.7071
3 16 0 0 0 0.7071 0 -0.7071 0.9239 0 -0.3827
3 16 0 0 0 0.9239 0 -0.3827 1 0 0
0

I can save the filename as newstud.dat for example

When I type this file data and the string '1 16 0 -4 0 6 0 0 0 1 0 0 0 6' to edit the whole part I just get a white screen when I save it and open it in the grapical display panel.

any ideas?
Need more detail and a better description of what you're trying to do if we'll even have a chance of helping.

Separate out each stage you're trying and write them out appropriately. And talk about what OS/software etc.

Tim
Hi Tim,

The files in the 'p' directory of LDraw do not have a file name in them if you open them in a text editor, which means if you paste the data you see in the text editor it will be just the string and the number values,

If you have a part that does have a subpart unlike above you can type the filename and before that you can type the number values, these are called strings or lines and they are arranged typically by having around 8 number, from left to right the numbers represent:

'Active/inactive string', 'colour', 'width', 'height', 'lengh', 'X rotation', 'Y rotation', 'Z rotation' then you have the 'file.dat'. The commands before filename.dat change this entire part that will be loaded in (which is the 'file.dat'), so how do you have a part like in the P folder but have the string work with it?
the rotation is not the the same as viewing angle, that is adjusted with the cursor tool in the GUI panel.
When I tried it I did not get anything grapical of the model and I get 'error parsing model line' on whatever line the sting is on.
The string does not have a 'file.dat' because it is working with editing the number values, it would have one if there is a part loaded into the project you are creating in script form.

Here is my project data:

0 ----number values----
3 16 0 0 0 1 0 0 0.9239 0 0.3827
3 16 0 0 0 0.9239 0 0.3827 0.7071 0 0.7071
3 16 0 0 0 0.7071 0 0.7071 0.3827 0 0.9239
3 16 0 0 0 0.3827 0 0.9239 0 0 1
3 16 0 0 0 0 0 1 -0.3827 0 0.9239
3 16 0 0 0 -0.3827 0 0.9239 -0.7071 0 0.7071
3 16 0 0 0 -0.7071 0 0.7071 -0.9239 0 0.3827
3 16 0 0 0 -0.9239 0 0.3827 -1 0 -0
3 16 0 0 0 -1 0 -0 -0.9239 0 -0.3827
3 16 0 0 0 -0.9239 0 -0.3827 -0.7071 0 -0.7071
3 16 0 0 0 -0.7071 0 -0.7071 -0.3827 0 -0.9239
3 16 0 0 0 -0.3827 0 -0.9239 0 0 -1
3 16 0 0 0 0 0 -1 0.3827 0 -0.9239
3 16 0 0 0 0.3827 0 -0.9239 0.7071 0 -0.7071
3 16 0 0 0 0.7071 0 -0.7071 0.9239 0 -0.3827
3 16 0 0 0 0.9239 0 -0.3827 1 0 0

0 ----string----
1 16 0 -4 0 6 0 0 0 1 0 0 0 6

The number values make up a basic brick and the string defines the other things such as the colour and its rotation.

I am using Windows XP Professional Edition and Mac OSX Snow Lepoard, I have tried putting the string above the number values and below them but no luck.
Hi Kris,

First of all, I'd highly recommend reading through all of this.

Now, the reason the lines you mentioned don't have part names after them is because they aren't parts. At the beginning of each line, there is a number. In the first line you posted...
3 16 0 0 0 1 0 0 0.9239 0 0.3827
... this number is 3. If you look through the article I mentioned, you'll see that this means it is a Triangle. In fact, it looks like all of your lines there are triangles.

Now, to include a sub-part in your file, you need line type 1, which you have later (and in your first post). Thus, typing in...
1 16 0 -4 0 6 0 0 0 1 0 0 0 6
... is meaningless, since you haven't included a filename at the end, and it is likely that whatever software you're using ignored the line because it was malformed. Either that or the whole file wasn't loaded due to the error (I'm not sure what you're seeing/not seeing).

Does this make sense (I'm not really an expert)?
Yes that makes sense but how do you edit the lines and triangles s a whole thing like line type one can do.
Perhaps if we understood what you are really trying to do, we could give you a better solution. What you are proposing does not really make much sense. Let me start by asking, why you are trying to inline the subfiles in the first place?
Im trying to make a new part for to use in LDraw, which is made from lines, quadrelaterals triangles, etc like the .dat files in the 'p' directory are made.

Below this I want to have a type 5 line which alters the entire model,

Line type 5 is an optional line. The generic format is:

5 <colour> x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4

The xyzabcdeafgi are typically things like rotation, positioning cordinates, etc
note that I am now trying with line type 5 because it does not use subfile name lookup and may be what im looking for.
Ok...

First, the P directory actually contains primitives, not parts. Primitives are things like boxes, cones, spheres, etc. which save time when authoring parts. You wouldn't want to model a stud a thousand times, so there's a primitive for that, which is included via line type 1.

Second, line type 5 doesn't alter the model, and it doesn't have a-i values, those are only present in line type 1. They define a transformation matrix which scales, rotates, etc. the subpart (or primitive) being included. The only things line type 5 does is either draw a line like in line type 2, or do nothing, depending on the angle from which the model is being viewed.

Perhaps if you would tell me exactly what you are really trying to do, I could help you out. Why are you trying to have your part modify itself? (Is that what you're saying?) That doesn't really make any sense in the context of authoring parts. If you want to create something once and use it multiple times, that is achieved by creating a subpart and including it multiple times via type 1 lines.

I appreciate your initiative in trying to help author parts, I really do. But please, read and understand the official parts specification before trying to proceed, it will save you many headaches as it did for me. I would suggest starting by making a few simple test parts just to understand the way LDraw works before proceeding to make actual lego parts.
I want to use the transformation matrix with the primitives, in one .dat file

the part is just so i can start to learn the programming side of LDraw/LDview.
Kris Finney Wrote:I want to use the transformation matrix with the primitives, in one .dat file
Ok, great, but to accomplish what.

Unless I know specifics, the best advice I can give is to point you to relevant documentation.

For example, if you said, I need four super huge suds arranged in a line on top of my thingamabob, then I could suggest that normally, one would use either p/stug-1x4.dat or stug4-1x4.dat (the difference being the orientation of the studs, which does matter) and include it with something that looks like
Code:
1 4 0 0 0 10 0 0 0 10 0 0 0 10 stug-1x4.dat
except that in your case, it would not be a good idea to use this technique for two reasons:
  • Many programs will substitute their own models for studs (ie. LDView for the stud logos, and pretty much every POV-Ray associated piece of code ever), and thus scaling them may have unexpected consequences.
  • You really shouldn't scale stud groups because they themselves are made up of primitives which are not meant to be scaled. If you want to use primitives that you can scale, use those found in the p/48/ directory because they have an extra digit of precision and thus can be scaled by up to a factor of 10 while retaining the same quality as their non-high-res versions, thus there would actually be a case for either inlining the stud and modifying it to use high-res primitives, or creating a high-res stud subpart and including that.

I understand that this is almost certainly not what you are trying to do and thus not very helpful (I just pulled it out of my ear) but without specific details the best I can do is say, "Umm, go read this thing? I think it'll help but I'm not really sure if its relevant because I don't actually know what you're trying to do."
Pages: 1 2 3