Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48677 > unrolled thread

Beginner Question: 3D Models

Started byandrewblundon@gmail.com
First post2013-06-18 19:47 -0700
Last post2013-06-19 09:34 -0700
Articles 13 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-18 19:47 -0700
    Re: Beginner Question: 3D Models Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-19 03:20 +0000
      Re: Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-19 04:13 -0700
        Re: Beginner Question: 3D Models Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-06-19 12:52 +0100
          Re: Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-19 06:12 -0700
        Re: Beginner Question: 3D Models Fábio Santos <fabiosantosart@gmail.com> - 2013-06-19 13:07 +0100
          Re: Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-19 06:14 -0700
            Re: Beginner Question: 3D Models Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-06-19 14:57 +0100
            Re: Beginner Question: 3D Models Fábio Santos <fabiosantosart@gmail.com> - 2013-06-19 15:11 +0100
    Re: Beginner Question: 3D Models Christian Gollwitzer <auriocus@gmx.de> - 2013-06-19 08:00 +0200
      Re: Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-19 04:14 -0700
    Re: Beginner Question: 3D Models Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-19 07:17 -0700
      Re: Beginner Question: 3D Models andrewblundon@gmail.com - 2013-06-19 09:34 -0700

#48677 — Beginner Question: 3D Models

Fromandrewblundon@gmail.com
Date2013-06-18 19:47 -0700
SubjectBeginner Question: 3D Models
Message-ID<b90be6d8-14db-42f2-92f3-a6aaba9ee075@googlegroups.com>
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, CSS and 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 mathematical calculations 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 user would then be able to zoom in and orbit around looking at the model.

Is this possible?  Is Python the right language?

Thanks
AB

[toc] | [next] | [standalone]


#48679

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-06-19 03:20 +0000
Message-ID<51c12394$0$29973$c3e8da3$5496439d@news.astraweb.com>
In reply to#48677
On Tue, 18 Jun 2013 19:47:34 -0700, andrewblundon wrote:

> 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%20python


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#48705

Fromandrewblundon@gmail.com
Date2013-06-19 04:13 -0700
Message-ID<9ed3232e-d011-43b0-893f-4c3517c6d0a1@googlegroups.com>
In reply to#48679
On Wednesday, June 19, 2013 12:50:52 AM UTC-2:30, Steven D'Aprano wrote:
> On Tue, 18 Jun 2013 19:47:34 -0700, andrewblundon wrote:
> 
> 
> 
> > 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%20python
> 
> 
> 
> 
> 
> -- 
> 
> Steven

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?

[toc] | [prev] | [next] | [standalone]


#48707

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2013-06-19 12:52 +0100
Message-ID<mailman.3580.1371642758.3114.python-list@python.org>
In reply to#48705
On 19 June 2013 12:13,  <andrewblundon@gmail.com> wrote:
>
> 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

[toc] | [prev] | [next] | [standalone]


#48710

Fromandrewblundon@gmail.com
Date2013-06-19 06:12 -0700
Message-ID<c4e53dd0-c362-492f-b294-356fcbf11d37@googlegroups.com>
In reply to#48707
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 files packaged into one "distribution" if that it's the right term.

[toc] | [prev] | [next] | [standalone]


#48708

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-06-19 13:07 +0100
Message-ID<mailman.3581.1371643671.3114.python-list@python.org>
In reply to#48705

[Multipart message — attachments visible in raw view] — view raw

On 19 Jun 2013 12:56, "Oscar Benjamin" <oscar.j.benjamin@gmail.com> wrote:
>
> On 19 June 2013 12:13,  <andrewblundon@gmail.com> wrote:
> >
> > 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

I don't know about the legality of it, but I've used blender in the past to
make executable (exe) files with small games and distributed them without
problems. The exe files were standalone (except for a few DLLs which I
would place in the same folder) and it worked rather well.

[toc] | [prev] | [next] | [standalone]


#48711

Fromandrewblundon@gmail.com
Date2013-06-19 06:14 -0700
Message-ID<29523129-398e-41e0-adf8-ec3b93d757b0@googlegroups.com>
In reply to#48708
This sounds similar to what I might want. So you know of any online tutorials for this?

[toc] | [prev] | [next] | [standalone]


#48714

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2013-06-19 14:57 +0100
Message-ID<mailman.3582.1371650285.3114.python-list@python.org>
In reply to#48711
On 19 June 2013 14:14,  <andrewblundon@gmail.com> wrote:
> 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

[toc] | [prev] | [next] | [standalone]


#48716

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-06-19 15:11 +0100
Message-ID<mailman.3583.1371651122.3114.python-list@python.org>
In reply to#48711
On Wed, Jun 19, 2013 at 2:57 PM, Oscar Benjamin
<oscar.j.benjamin@gmail.com> wrote:
> On 19 June 2013 14:14,  <andrewblundon@gmail.com> wrote:
>> 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).

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.

--
Fábio Santos

[toc] | [prev] | [next] | [standalone]


#48687

FromChristian Gollwitzer <auriocus@gmx.de>
Date2013-06-19 08:00 +0200
Message-ID<kprh4r$qc3$1@dont-email.me>
In reply to#48677
Am 19.06.13 04:47, schrieb andrewblundon@gmail.com:
> 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.

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

[toc] | [prev] | [next] | [standalone]


#48706

Fromandrewblundon@gmail.com
Date2013-06-19 04:14 -0700
Message-ID<643baa17-b55f-40e6-990e-4f2450c96a88@googlegroups.com>
In reply to#48687
On Wednesday, June 19, 2013 3:30:41 AM UTC-2:30, Christian Gollwitzer wrote:
> Am 19.06.13 04:47, schrieb andrewblundon@gmail.com:
> 
> > 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.
> 
> 
> 
> 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).

[toc] | [prev] | [next] | [standalone]


#48717

FromRick Johnson <rantingrickjohnson@gmail.com>
Date2013-06-19 07:17 -0700
Message-ID<15810ca3-7237-41d1-bcc8-e61667ba3714@googlegroups.com>
In reply to#48677
On Tuesday, June 18, 2013 9:47:34 PM UTC-5, andrew...@gmail.com wrote:

> 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

[toc] | [prev] | [next] | [standalone]


#48726

Fromandrewblundon@gmail.com
Date2013-06-19 09:34 -0700
Message-ID<be3fc464-b2c0-412f-8a8f-ebaa06402b26@googlegroups.com>
In reply to#48717
On Wednesday, June 19, 2013 11:47:36 AM UTC-2:30, Rick Johnson wrote:
> On Tuesday, June 18, 2013 9:47:34 PM UTC-5, andrew...@gmail.com wrote:
> 
> 
> 
> > 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web