Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DLL that read STL files

Author
Message
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 13th Apr 2011 21:03 Edited at: 7th Jul 2013 00:53
Hello

I need my objects to be loaded from modern Autocad STL files. those objects should have any other standard DBPro object features such as position and rotation.

if you feel that you are able to do it for me, contact me back as soon as possible so I can tell the company.

however, any answer may take up to four week.

once you are asked to do the plug-in for me a financial reward will be paid to you upon completion. but first I will have to try this plug-in.

remember that the plugg-in should be built in DLL file.

I uploaded an example file so you can try to read it.

best regards guys and wish you good luck.

note: This e-mail is not intented to advertise anybody in any sort.

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 13th Apr 2011 21:31 Edited at: 13th Apr 2011 21:41
I read your other thread here
http://forum.thegamecreators.com/?m=forum_view&t=183826&b=1
Uhh... I opened the file with notepad, and I saw weird characters. It looks like you assumed this to mean that the formatting is different. While that's entirely possible, the wikipedia article also describes a BINARY stl file. Soo...


that DOES NOT mean that if you opened it with a text file, the first line would have UINT8[80] on it. it means that the first part of the file has 80 unsigned, 8 bit integers, IE 80 bytes.

Here is how I'd interpret that:

So, the first 8*80 bits are the name of the model. The next 32 bits tells the number of triangles. THEN you have the section describing the geometry, so, FOR EACH triangle... You have three floats representing a normal vector, then three floats representing the first vertex of the triangle, three of the next, and three of the next (a total of 4*3*32 bits). Then you have 16 bits describing the number of bytes in the "attribute" section (I'll call this attribnum). So the size in bits of a given triangle is: 4*3*32 + 16 + attribnum*8.

Few applications work with a single bit, so you usually specify the size in bytes. I was just using bits because it's easier to describe (uint16 is 2 bytes, but I don't want to look like I'm pulling numbers out of nowhere).

Sooo... what I would do is write a program that parses the data, and checks if it is the right size, by parsing through the whole file. If it's a few bytes off, and your program is written correctly... well... I have no clue... but if it ISN'T, which I hope is the case, then it's OK to go ahead and write it up to export to a .x file and be loaded. (or you could implement a mechanism to load it directly as an object in DBPro, but I'm not sure how one would do that.




Also, do you know what specific application it's being loaded from? That would help.

[edit]

I'll try to work on this once I get some software development installed on my computer (it's doing MASSIVE updates ATM). This is similar to stuff in java i've done with named binary tags, which were used in minecraft for storing level data. I doubt I'll get a working DLL, but I'll probably be able to confirm what format the given file is in.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 14th Apr 2011 14:21
appreciate your advice but I tried all that before and it didn't work.

however, the file is sequential. and can be read using normal sequential file commands.
reading the file is very complicated and using the vertex commands is not very efficient. so the need of external plug-in is essential.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th Apr 2011 17:22
Quote: "reading the file is very complicated"

Nope, it's very easy as the format matches exactly the binary format within the wikipedia page. Even easier is that there is no colour information within the file either.

There are only two slight issues:
- The normals are face normals, not vertex normals, so the model may look faceted rather than smooth if the poly detail isn't high.
- There's no texture data included

Login to post a reply

Server time is: 2026-07-18 14:26:50
Your offset time is: 2026-07-18 14:26:50