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.

Newcomers DBPro Corner / DB for making primitive command line CAD program?

Author
Message
Seymour Clufley
17
Years of Service
User Offline
Joined: 6th Dec 2006
Location: Edinburgh
Posted: 1st Mar 2007 11:32
Hi,

DarkBASIC may not be the tool I need for this job. I have almost no experience using DB so excuse me if this is ridiculously inappropriate. It'll take some time to explain what I want to do, so please bear with me as I'm in a bit of a quandary.

Using Mediachance Multimedia Builder, I've made a program for helping the user to design a project. The project could be pretty much anything, but it will always have different kinds of elements that the user arranges, deletes, renames, creates, etc.

Anyway, this program was completed a week ago. Since then, it occurred to me it'd be great to add a new section to the program where the user could see their project as a 3D arrangement. All the planning they've done in the program would be translated into a primitive 3D "mindmap" - nice and retro.

Now I know exactly how I want the translation to be done, and I know exactly how I want the 3D result to look. The problem is, I have no idea how to achieve it. I would appreciate any advice from the people around here on how to do it.

What I want is a simple black background, and the elements of the user's project shown as primitive 3D shapes - a cube, a cone, a sphere and so on. And we're talking VERY primitive, like this:



The user should be able to add new elements (shapes) directly to the 3D visualisation, and to change the colours of shapes. They should also be able to click on any shape and the app would send an instruction to the MMB app ("shape clicked: cube16), which would display the details of the project element that the shape represents.

I want the 3D presentation to be binded into the MMB app - a window within the window. I know for a fact this is possible and that MMB can send instructions to a binded app. Yesterday I binded a very simple DB exe into the MMB app without any problems, except that it took about 5 seconds to load up.

It seems there are two options here.

a) I find an executable that already exists for this task. It would be controllable from the command line, and my program would feed instructions to it: "create x number of spheres, position sphere 1 here, sphere 2 here, colour sphere 6 rgb(128,0,92)" etc. Unfortunately I've been scouring the net for the last few days and haven't found anything.

b) I code such a program myself.

The latter option would require me to learn a new programming language. If necessary, I'm happy to do that - preferably BASIC - but does anyone know of an existing software utility that does what I want already? Secondly, if you think I'd be better creating the program myself, can you recommend a program to code it in? Do you think using DB to do this would be overkill? The wrong tool for the job?

Here are the requirements:

1. The app must be able to generate an infinite number of primitive 3D shapes, during runtime.
2. The app is almost 100% controlled from the host app.
3. The app can send information to the host app (shape clicked / mouse dragged to xyz pos / shape's xyz pos / etc.)
4. The app can compute distance+angle between two shapes for creating a link between them (the grey line in the image above)
5. Ideally, the app can take camera instructions from mouse dragging and from the host app, so that the user can move around their 3D plan.

Finally, if you can think of a better forum for me to ask this question in, please let me know as I don't like treading on people's toes. Once again, I apologise if this is the wrong place but I'm at a loss here.

Thanks in advance for any help,
Seymour.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Mar 2007 16:54 Edited at: 1st Mar 2007 16:55
There are a few ways I can think of doing this - if I understand what you are aiming for that is...

However, I think the biggest problem you are going to have with DB is that it uses DirectX which is designed to be used on it's own.

In other words, it's difficult to use at the same time as another Windows app and switch between the two. (The DirectX screen corrupts on return from the other app).

If it's a case of using DB to display a 3D view then you quit back to the controlling app then it shouldn't be too difficult.

If your controlling app can write text files to disk, you could quite simply write a script to disk and have your DB app read in the script and create the scene.

Creating any of the primitives in DB as shown in the image above is three simple lines - one to create the object, one to colour it and the third to position it.

The only other thing would be the lighting to recreate the above scene precisely.

TDK_Man

Seymour Clufley
17
Years of Service
User Offline
Joined: 6th Dec 2006
Location: Edinburgh
Posted: 1st Mar 2007 20:51
TDK, thankyou very much for replying.

>There are a few ways I can think of doing this - if I understand what you are aiming for that is...

Let me clarify. The DB "game" wouldn't be a game at all, but an engine for generating an arrangement of 3D shapes. The arrangement will be different every time because the user will have changed the project. It also needs to be able to send an instruction to the MMB app if a user clicks on one of the shapes - "sphere3 clicked" kind of thing - so that the MMB app can show the details of the project element that is represented by that shape.

>However, I think the biggest problem you are going to have with DB is that it uses DirectX which is designed to be used on it's own. In other words, it's difficult to use at the same time as another Windows app and switch between the two. (The DirectX screen corrupts on return from the other app).

I don't know about this because I'm not sufficiently experienced with DB to code something interactive. So far, I've made a spinning cube in a window with the right window size, and then binded that into the MMB project. It worked fine, but as I say there was a long startup time and I wasn't clicking between the DB app and the MMB app.

>If your controlling app can write text files to disk, you could quite simply write a script to disk and have your DB app read in the script and create the scene.

Creating any of the primitives in DB as shown in the image above is three simple lines - one to create the object, one to colour it and the third to position it.

Yes, I imagine the MMB app would write to file "spheres 6" and the DB app would have a For...Next loop for creating the specified number of spheres, with the x pos going up by an increment each time.

I do want it to be alterable during runtime. For example, the user might press a button in the MMB app to create a new sphere, and the DB app would need to be able to receive an instruction to create a new sphere on the fly. I don't want it to be clunky.

This seems to be quite an unorthodox thing that I'm trying to do. I thought it would be far more commonplace. Whilst I'm aware that DB is not designed for doing this kind of thing, I honestly can't find another way to achieve it. Not yet anyway. I've asked on a number of forums. Somebody even suggested hacking Blender, cutting it down and integrating it into my program! But I simply don't have the programming knowledge to do something like that. Since all I want to do is create primitive 3D shapes against a black background, creating an app with a games program may actually be the most sensible way to go.

>The only other thing would be the lighting to recreate the above scene precisely.

Oh, that's not an issue. I want the presentation to look very primitive, so that the user can concentrate on the elements, the shapes.

Login to post a reply

Server time is: 2024-09-25 19:23:23
Your offset time is: 2024-09-25 19:23:23