We are about to switch to a new forum software. Until then we have removed the registration on this forum.
i want to know the methode to iterate over object 3d located in my data base. please freinds i nead your help and thank you :)
for exemple ===> for (int i = 0; i < "number d'object in my data base "; i = i+1) { ... }
Answers
If it's in a database, you gotta find a library to deal w/ it! (:|
You rejected GoToLoop's answer, without adding a comment. Not a way to progress. What is your database, exactly?
I got the following 3d object in my data base ==> table.obj, canapet.obj, fauteuil.obj. and what i need exactly is all the object pun up when i click one button (one click on the button the first 3d object pun up and when i click another time the first object disappear and the next object pun up ) and like that until i finished all the object on the data base **
**this my code where there is three button and each button pun up one object but i think it is not a good idea because what i realy wanna do is one button pun up all the object **
Apparently, there is no database involved in your code. Perhaps you meant files in the data folder? You want to list the files there?
@Philho==> thank you very much brother ! that's exactly what i talking about . I am very interested with your help
Let's be clear here: You are not dealing with a database at all. A database is a collecting of tables, each of which has fields and records, that can be read and updated, usually over a network, by multiple users, atomically.
What you have is an array of objects, which is much simpler. You load each of your objects from a specific file, and are displaying them one at a time. Now you want one button that, when pressed, displays the next object in your array. Great. Ok. No one is going to write it for you, but here is an example button that displays several colors, one at a time:
@TfGuy44 you are great men thank you very much and this is so helpful ,but you gonna answer finally my question if you give the method haw i make an array of objects like the array you give it to me about the color
for exemple i have this object i wanna put them in an array==> table.obj , tv.obj, chair.obj .. and thank you very much
Well, first you would create an array to hold the objects. This would be global.
Then you would populate it, probably in setup().
And so on. And if you don't know how many objects and their names ahead of time, well, you'll need to get a list of .obj files from the directory... And PhiLho is better at that than me.
@TfGuy44 thank you brother for your help you are great ! but i realy nead a list of .obj :/ i hope that Philho find us a solution
Well, you can Google "list files in folder Processing" and see what you get yourself...
Now that @TfGuy44 found out what you've meant for "database", we can finally know how to help ya out! :-\"
I believe what you're looking for is a FilenameFilter in order to get all files from a folder w/ extension ".obj", is it? :-/
http://docs.oracle.com/javase/8/docs/api/java/io/FilenameFilter.html
Then we can use File's list() method to get a String[] of filtered filenames:
http://docs.oracle.com/javase/8/docs/api/java/io/File.html#list-java.io.FilenameFilter-
Check it out my sample below whether it serves ya right: ;;)
@GoToLoop ==> thank you brother very much for your help , but on my code here and after i fill in the list() dont forget there is a button when i click on one of the .obj pun up (one click on the button the first 3d object pun up and when i click another time the first object disappear and the next object pun up ) and like that until i finished all the object in the liste() ..
==> here in the mouseClicked() method (line 28) when i make the condition when i say if ( btn1.hasClicked()) (line 31) on this time i call ** model = new OBJModel(this,"mankey.obj");** (line 35) to pun up the .obj .. but when i change the code with the list() i dont know how i make the code change on this point .
Sorry, but your description of your current issues isn't exactly helpful. We've shown you how to have a button that displays one thing from an array, and we've shown you how to create an array of objects dynamically based on what's in a folder. It's up to you to understand these examples and merge them together to create the sketch you want.
If you need more help, post the entire code of your current sketch. Also, tell us what is wrong with it.
**please friend some help to fixed the code there is an erreur in the line 40 **