replacing the filename with the file data but getting no graphical data


replacing the filename with the file data but getting no graphical data
#1
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?
Reply
Re: replacing the filename with the file data but getting no graphical data
#2
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
Reply
Re: replacing the filename with the file data but getting no graphical data
#3
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.
Reply
Re: replacing the filename with the file data but getting no graphical data
#4
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)?
____________________________________________________________________________________________________
I'm theJude! So that's what you call me. You know, that or, uh, his Judeness, or uh, Juder, or el Juderino if you're not into the whole brevity thing.
Reply
Re: replacing the filename with the file data but getting no graphical data
#5
Yes that makes sense but how do you edit the lines and triangles s a whole thing like line type one can do.
Reply
Re: replacing the filename with the file data but getting no graphical data
#6
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?
Reply
Re: replacing the filename with the file data but getting no graphical data
#7
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.
Reply
Re: replacing the filename with the file data but getting no graphical data
#8
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.
Reply
Re: replacing the filename with the file data but getting no graphical data
#9
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.
Reply
Re: replacing the filename with the file data but getting no graphical data
#10
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."
Reply
Re: replacing the filename with the file data but getting no graphical data
#11
At the minute I am trying to see if it works with an existing LDraw primitive, to save wasting time trying it what im wanting will not work.

I think I used 4-4disk.dat (the code for that is in the above posts)

The transformation matrix would be on a seperate line below the primatives (also listed above)
Reply
Re: replacing the filename with the file data but getting no graphical data
#12
Ok, I think I understand what you want to do.

You want to modify an existing primitive and then include it in a part file?

If this is what you trying to do the I can help you but if so, I highly recommend that you do see if there's a primitive that suits your needs. I recommend checking out the primitive reference
Reply
Re: replacing the filename with the file data but getting no graphical data
#13
I want to modify an existing primative, yes by using something like a type 1 line at the bottom of the script that edits the over all line color (for example.), the primitives are loaded into the grapical interface with a default colour, you can change it with the colour cool or you can set it as a certain colour in the bottom line of the script

[see bottom line of my above code examples, they are line type 1 but without the file at the end]

I can include it in a part file if I like, yes but if I do it will be a set color and rotation etc because of the bottom line that defines those paramaters
Reply
Re: replacing the filename with the file data but getting no graphical data
#14
Hello Kris, as far as I can see here, your main misunderstanding is about how a line
starting with "1" works.

You use it as if it would transform all the previous file contents encountered.
This is what I read from your post.

However, this is not what such a line does.

A line of type 1 simply takes another file, applies a transformation matrix plus coloring to it
and puts it into the current file as if it was there in that form.
So you always need a filename there.

What you tried to do is, you created some file,
and then wanted to transform it.
This requires that you split up the two things into 2 files.
One file will contain your triangles,
and the other will transform and colorize it and use it.

I hope I correctly read between your lines, because I really have difficulties understanding your English, sorry.
Reply
Re: replacing the filename with the file data but getting no graphical data
#15
Hmm, I think I understand what you are trying to do, but you are going about it the wrong way.

If I understand correctly, you want to define a file containing many primitives, but instead of just rotating/scaling/etc. to their final positions, you want some intermediate step, where they are all modified at once to their final state by a single final transformation.

You can't have a line type 1 without a file... the sole purpose it exists is to include files, without a file at the end it literally does nothing. I'm telling you man... read the file format standard and it'll all make sense, if you have specific questions about parts of the standard which you do not understand, I'm absolutely sure that many people here would be glad to help the answers to your questions would be much more constructive.

Now... about how to achieve what I think you are trying to achieve...

In order to have one line type 1 at the end modify everything defined so far (although if that's really all you're trying to do it would b preferable to just have things the right color/position/dimensions/etc. to begin with :| ) you would need to create two files, one with all the primitives you are trying to insert, etc, and the other file with a line type 1 that includes the previous file.

For example, say you were trying to create an abominable snowman part named subsnowman.dat (you should never name it this for the actual parts library, see this document, but it's fine for personal use).
Code:
0 ~Animal Abominable Snowman
0 Name: subsnowman.dat
0 Author: Kris Finney

1 16 0 0 0 1 0 0 0 1 0 0 0 1 48\8-8sphe.dat
1 0 0 -1.75 0 0.75 0 0 0 0.75 0 0 0 0.75 48\8-8sphe.dat
1 16 0 -3 0 0.5 0 0 0 0.5 0 0 0 0.5 48\8-8sphe.dat
0

And another file which includes the snowman, but makes him white
Code:
0 Animal Abominable Snowman (White)
0 Name: snowman.dat
0 Author: Kris Finney

1 15 0 0 0 1 0 0 0 1 0 0 0 1 subsnowman.dat
0

[Image: 6H8bB.png]
(Complete side note: See how it makes no sense for small enough images to be resized/compressed? Big deal, you saved a few pixels and now its a distorted jpeg too.)

But note that even though you tell the model to be white, the middle section is black. This is because as defined in the file format specification which must be read carefully and tested until understood changing the color of what you are including only effects things in the file with colors 16 and 24 which have special meanings.

This is sometimes done for shortcut parts, see, stuff like this (although that's a bad example because its not an official part, and will probably never become an official part because of licensing issues, it still illustrates the concept of shortcut parts better than other shortcuts I could find).

Note how both files need to be in the same directory for it to work. If you wanted subsnowman.dat to be in the s subdirectory (for subparts) then you would include it via:
Code:
1 15 0 0 0 1 0 0 0 1 0 0 0 1 s/subsnowman.dat
It is possible to have it be contained in one file by using a multi part document, but that is not allowed for parts (only for models).

But like I said... the better solution is often to just have one file, and include the primitives how you want them to be the first time.
Reply
Re: replacing the filename with the file data but getting no graphical data
#16
Hi,

What I want to do is edit the color using the matrix like you said ,
but cant the matrix rotate the model do a couple of other things too?

I want to have the co ordinates of the primative AND have the matrix in one file

So in this file there is no filenames loaded into it on the end of the matrix because it is editing the primative co ordinates.

There is no external files needed in this idea unless I load it into a model or a part.
Reply
Re: replacing the filename with the file data but getting no graphical data
#17
Have you actually read the specs? Or all the comments people have posted?

Unless I seriously misunderstand what you want to do you CAN'T DO IT! As many have already said and the specs would make clear.

And if you read the specs on MPDs you would see how you could do it for a model, but in a way that would be illegal for a part.

Tim
Reply
Re: replacing the filename with the file data but getting no graphical data
#18
This thread really belongs in help, not general discussion. Could an admin please move it?
Reply
replacing the filename with the file data but getting no graphical data
#19
-- moved topic --
Reply
Re: replacing the filename with the file data but getting no graphical data
#20
Good point. Done.
Reply
Re: replacing the filename with the file data but getting no graphical data
#21
ok, thanks pepole

Id really like to be able to do this in the future.
Reply
Re: replacing the filename with the file data but getting no graphical data
#22
Actually belongs in Part Authoring. Moving.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 6 Guest(s)