Beginner Question: 3D Models

A

andrewblundon

Hi there,

Sorry for the complete beginner question but I thought the readers here might be able to provide me with some guidance.

I've done some programming with Visual Basic and VBA plus a little PHP, CSSand HTML. I'm looking at developing a program for work that can be distributed to others (i.e. and exe file). The application would open various dialogue boxes and ask the user for input and eventually perform mathematicalcalculations on the input. From what I've read Python would have no trouble with this.

However, for one part of the program I'd like to be able to create a 3D model based on the user input. The model would be very basic consisting of a number of lines and objects. We have 3D models of each component within our CAD system so it would be great if we could utilize those models.

Most of the 3D graphic capabilities I've seen seem to center around either gaming or mathematical plotting. Are there any capabilities to import existing CAD geometry, arrange the components in particular 3D coordinates in space and then view the results in some sort of 3D viewer? Ideally the userwould then be able to zoom in and orbit around looking at the model.

Is this possible? Is Python the right language?

Thanks
AB
 
S

Steven D'Aprano

However, for one part of the program I'd like to be able to create a 3D
model based on the user input. The model would be very basic consisting
of a number of lines and objects. We have 3D models of each component
within our CAD system so it would be great if we could utilize those
models. [...]
Is this possible? Is Python the right language?


Is Blender the sort of thing you are looking for?

https://duckduckgo.com/html/?q=blender python
 
A

andrewblundon

However, for one part of the program I'd like to be able to create a 3D
model based on the user input. The model would be very basic consisting
of a number of lines and objects. We have 3D models of each component
within our CAD system so it would be great if we could utilize those

[...]

Is this possible? Is Python the right language?





Is Blender the sort of thing you are looking for?



https://duckduckgo.com/html/?q=blender python

I've seen some information on Blender. Is it possible to have the entire program contained within a single exe (or exe and some other files) so that it can be passed around and used by others without having to install blender?
 
A

andrewblundon

Am 19.06.13 04:47, schrieb (e-mail address removed):








Have a look at vtk



http://www.vtk.org/



Using VTK you can import CAD models and visualize them, combine to

scenes and export. VTK has Python bindings. It is a real big library,

but focused on polygonal models, i.e. it will happily import STL and

OBJ, but not IGES and the like ith real curves. Then the question is how

you'd want to export your model. VTK can export to VRML and X3D, but if

you want to CREATE a real model by CSG of the exisiting parts, you would

need a true CAD system. There is not much useful free stuff out there,

you could try BRL-CAD or OpenCascade. The latter also has python

bindings. http://www.pythonocc.org/



Christian

I don't need to create and export the model. I just want to be able to view it within the application I'm creating (without any other programs).
 
O

Oscar Benjamin

I've seen some information on Blender. Is it possible to have the entire program contained within a single exe (or exe and some other files) so that it can be passed around and used by others without having to install blender?

I don't know if Blender would cause problems for that but it's not
hard to install Blender generally; apparently there is a portable
version that can be simply unzipped on the target computer.

More generally, though, there are some legal issues relating to
packaging standard MSVC-compiled Python with all of its dependencies
in a single .exe file for Windows. The particular problem is the
Microsoft C runtime library. py2exe has some information about this
here:
http://www.py2exe.org/index.cgi/Tutorial

Generally Python is not designed with the intention that applications
would be packaged into a standalone executable file although a number
of projects exist to make that possible. Is it so hard for your users
to install Python and Blender if you tell them which files to download
and install?


Oscar
 
A

andrewblundon

As I've said, I'm a fairly novice. I've compiled simple VB programs previously into exe files for use but nothing with pyton and nothing of this complexity. This application could potentially be distributed to hundreds of people throughout the world as our company is worldwide. Asking these people to install other software is really not realistic. I'd like to have it all contained in one project. I stated one exe but it could be a number of filespackaged into one "distribution" if that it's the right term.
 
A

andrewblundon

This sounds similar to what I might want. So you know of any online tutorials for this?
 
O

Oscar Benjamin

This sounds similar to what I might want. So you know of any online tutorials for this?

It's hard to tell what you're referring to since you haven't included
any quoted context in your message (like I have above). I'll assume
you're referring to what Fábio said.

I've already posted the link to the py2exe tutorial (I assume Fábio
used py2exe since nothing else was specified).

The legal issue I mentioned is precisely about the .dll files that
Fábio referred to. The reason that py2exe (and similar projects) do
not bundle these into the .exe is because it normally isn't legal to
distribute these files. From the tutorial:
'''
you need to check redist.txt within your Visual Studio installation to
see whether you have the legal right to redistribute this DLL. If you
do have these rights, then you have the option to bundle the C runtime
DLL with you application.
'''


Oscar
 
F

Fábio Santos

It's hard to tell what you're referring to since you haven't included
any quoted context in your message (like I have above). I'll assume
you're referring to what Fábio said.

I've already posted the link to the py2exe tutorial (I assume Fábio
used py2exe since nothing else was specified).

It's a blender game engine thing. (it may very well internally use py2exe).

Here's a resource on how you do it:

http://www.blender.org/forum/viewtopic.php?t=17838&sid=5fa212f30833199dab4950e70d311490

Blender's game engine can probably be used to create a 3D model
viewer, since the game engine is not specifically oriented towards
games. It's more of a rudimentary "interactive 3D framework", offering
simple visual programming capabilities, and an awesome 3D editor,
which is Blender itself.

The greatest advantage to it is that it is couped with a 3D program.
So you can create your physics bodies, entities, lights, etc., place
them wherever you want and run the simulation.

You can very likely import your CAD models into Blender using the many
importers it has. It can import .3DS, .OBJ, etc. files with ease,
provided you find (or write!) the plugins for them.
 
R

Rick Johnson

I'm looking at developing a program for work that can be
distributed to others (i.e. and exe file). The
application would open various dialogue boxes and ask the
user for input and eventually perform mathematical
calculations on the input.

Tkinter sucks for GUI (at least as it stands today) however
it IS part of the stdlib and you can get going fairly
quickly with it -- although Tkinter does not supply a native
3dcanvas widget so you'll have to use "togl", which is very
old and poorly written, but it works! ;-)

Alternatively, WxPython is a full featured GUI library which
has a glCanvas waiting for you. But like anything there is a
trade-off -- will take a bit more time to understand Wx than
Tkinter.
From what I've read Python would have no trouble with
this. However, for one part of the program I'd like to be
able to create a 3D model based on the user input. The
model would be very basic consisting of a number of lines
and objects.
[...]
Are there any capabilities to import existing
CAD geometry, arrange the components in particular 3D
coordinates in space and then view the results in some
sort of 3D viewer? Ideally the user would then be able to
zoom in and orbit around looking at the model. Is this
possible? Is Python the right language?

Sounds like "OpenGL" is what you need.

Others have mentioned Blender, however i would say that is a
bad idea. Sure, all the zoom and orbit code is written for
you but then your users are going to be overwhelmed by the
Blender interface. Blender is overkill for what you want!
Suggesting Blender for this problem is like suggesting you
rent a semi-truck to ship a toaster one block.

Adding lines and faces (or even geometric primitives) in
OpenGL is so easy you'd have to be a complete moron not to
understand it. There's a little bit of complication when
handling concave faces (or faces containing holes), but
nothing impossible about it. Importing data from outside
programs is pure Python (easy stuff).

PS: Be aware that you'll most likely want to use the latest
version of Python 2.x if you go the OpenGL route. You need
the following.

Python2.x + (Tkinter & Togl or WxPython) + OpenGL
 
A

andrewblundon

I'm looking at developing a program for work that can be
distributed to others (i.e. and exe file). The
application would open various dialogue boxes and ask the
user for input and eventually perform mathematical
calculations on the input.



Tkinter sucks for GUI (at least as it stands today) however

it IS part of the stdlib and you can get going fairly

quickly with it -- although Tkinter does not supply a native

3dcanvas widget so you'll have to use "togl", which is very

old and poorly written, but it works! ;-)



Alternatively, WxPython is a full featured GUI library which

has a glCanvas waiting for you. But like anything there is a

trade-off -- will take a bit more time to understand Wx than

Tkinter.


From what I've read Python would have no trouble with
this. However, for one part of the program I'd like to be
able to create a 3D model based on the user input. The
model would be very basic consisting of a number of lines
and objects.

Are there any capabilities to import existing
CAD geometry, arrange the components in particular 3D
coordinates in space and then view the results in some
sort of 3D viewer? Ideally the user would then be able to
zoom in and orbit around looking at the model. Is this
possible? Is Python the right language?



Sounds like "OpenGL" is what you need.



Others have mentioned Blender, however i would say that is a

bad idea. Sure, all the zoom and orbit code is written for

you but then your users are going to be overwhelmed by the

Blender interface. Blender is overkill for what you want!

Suggesting Blender for this problem is like suggesting you

rent a semi-truck to ship a toaster one block.



Adding lines and faces (or even geometric primitives) in

OpenGL is so easy you'd have to be a complete moron not to

understand it. There's a little bit of complication when

handling concave faces (or faces containing holes), but

nothing impossible about it. Importing data from outside

programs is pure Python (easy stuff).



PS: Be aware that you'll most likely want to use the latest

version of Python 2.x if you go the OpenGL route. You need

the following.



Python2.x + (Tkinter & Togl or WxPython) + OpenGL

Excellent.. Thank you for your response. I'll start looking at OpenGL. I've looked into Blender previously for simply animations and having an average user use that for any sort of interface would indeed be overwhelming. I simply need a viewer that you could zoom and orbit.

It would also be nice if you could import an existing 3D CAD geometry for viewing.

I think I need to start downloading Python with a few of the libraries and start playing around.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top