Blender3D

Status
Not open for further replies.

Marks256

New Member
Has anyone taken the time to learn Blender 3D? It is a great program (from what i can tell), but i don't know if i should take the time to learn it. I would have to learn Python, and don't know if it is worth it...


edit: Here is a wikipedia article about it; https://en.wikipedia.org/wiki/Blender3d
 
I heard that python was pretty good to know for Linux, too, yes?

Thanks for the link, by the way. I will probably use it this summer and try to learn it.
 
How can we suggest if something is worth learning if you don't tell us why you would even want to learn it in the first place?
 
How can we suggest if something is worth learning if you don't tell us why you would even want to learn it in the first place?

For no reason. Just basically so i can say that i know it. I am sure something will come up in the future that requires a 3d animation, or a 3d image.
 
I prefer POV-Ray, and use Rhino if I need to model something. I used to just script images though...

**broken link removed**

Self-explanatory...
 
Ugh. Uploading a bitmap for viewing the the worst thing that is humanly possible! I couldn't view the large images (bitmaps take forever to load...), but the preview looked neat.
 
Sceadwian said:
How can we suggest if something is worth learning if you don't tell us why you would even want to learn it in the first place?

true, but python is just one of those things that is just to damb useful. Those that don't like the coding style of python seem to be more at home with perl.

It is actually a pleasure to code in python
it is very easy to knock together a pretty functional script in next to no time, then come back to flesh it out.

We got a new power analyser a few months back and while it is second to none on a hardware front there is no software provided to get the data off it (aint writing down 100harmonics worth of data for 6channels!!!)

within 30min I had something talking to the PM6000 (via RS232, they did provide the command-set) would of been quicker but there was a false bit of info in the manual (they said that the end of message marker was: \r, however it was actually \r\n, ie they assumed whatever you were using ie hyperterminal would send the carrage return.. BAD!)

withing another 10min had something getting all the data. In the process of beefing it out to provide a GUI.


Also wrote a GUI app to interface to a controllerboard we have built with an FPGA and a FTDI chip. Using the FTDI dll I can access the chip and with the pre-defined messages sent can control the board with python via USB (got a funky plotting function atm, plots using matplotlib in the GTK gui).
 
Marks256 said:
Python can do GUIs????????????????????????? (linux i presume...)
python can do GUI's and hte best bit is... as long as you provide the 3rd party libs for windows it is fully cross-platform!!!

I like GTK (mainly cause I am a GNOME user in the linux world and it is nice to code in) BUT since I use GIMP in linux and windows I already have the GTK runtimes installed on every machine I infect

Python itself comes with TCL/TK todo rudementy GUI's with (look nasty!), you can get WXpython for Linux,Windows,OSX,Solaris that provides hooks to the native toolkit (so a prog written with wxpython will use GTK in windows, aero in OSX, fisher-price in XP with no extra changes)

There is also pyQT which looks native in windows and uses QT in linux



it is really easy todo, I




Here is a couple of screen-shots for a program I wrote to access that controller-board. This is an older-version (this one was using RS232, moved onto USB now , and a few other things changed). the other shot shows my virtual oscilloscope I wrote (the client side and helped on the VHDL side). It shows a 7phase test screen which gets replaced upon capture

Also here is the code for a quick plotting GUI (3rd piccy).
This one was actually testing:
plotting and plot-replacement in Python+GTK+matplotlib

have fun


Code:
#!/usr/bin/env python
"""
show how to add a matplotlib FigureCanvasGTK or FigureCanvasGTKAgg widget and
a toolbar to a gtk.Window
"""
import math
import gobject

from pylab import *
rcParams['numerix'] = 'numpy'

import matplotlib
matplotlib.use('GTK')
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar



try: 
    import pygtk 
    pygtk.require("2.0") 
except: 
    pass 
try: 
    import gtk 
    import gtk.glade 
except: 
    sys.exit(1)


TIME = range(360)
VOLT1 = [math.sin(math.radians(x+0)) for x in TIME]
VOLT2 = [math.sin(math.radians(x+120)) for x in TIME]
VOLT3 = [math.sin(math.radians(x+240)) for x in TIME]

PLOT_DATA = [VOLT1,VOLT2,VOLT3]

###################################################################
class appGui: 
    def __init__(self):
        self.gladefile = 'graph-gui.glade'
        self.windowname = 'graph-it'
        self.wTree = gtk.glade.XML(self.gladefile, self.windowname) 
        dic = {"on_quit_clicked" : self.QuitClicked,##callback dictionary
        "on_plot_clicked" : self.Plot,
        "on_window_destroy" : (gtk.main_quit)}
        self.wTree.signal_autoconnect(dic)

        #self.figure = Figure(figsize=(6,4), dpi=100)
               #self.axis = self.figure.add_subplot(111)

        def test_timeout(self):
            print "testing"
            return True

        gobject.timeout_add(1000,test_timeout,self)




    def QuitClicked(self,widget):
        gtk.main_quit()
    
    def Plot(self,widget):
        try: 
            self.canvas.destroy()
            self.toolbar.destroy()
        except:pass 
            
        self.figure = Figure(figsize=(6,4), dpi=100)
        self.axis = self.figure.add_subplot(111)
        self.axis.grid(True) 
        self.axis.set_ylabel('Volts (V)')
        self.axis.set_xlabel('Time (s)')
        self.axis.set_title('Test Graph')
        
        for x in ['signal1','signal2','signal3']:
            tmp = self.wTree.get_widget(x).get_active()
            if tmp == -1: continue
            self.axis.plot(TIME,PLOT_DATA[tmp])
  
        #self.axis.plot(TIME,VOLT1,'r')
        #self.axis.plot(TIME,VOLT2,'y')
        #self.axis.plot(TIME,VOLT3,'b')
     
            self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea
            self.canvas.show()
            self.graphview = self.wTree.get_widget("vbox1")
            self.graphview.pack_start(self.canvas, True, True)
        self.toolbar = NavigationToolbar(self.canvas,self.wTree.get_widget('graph-it'))
        self.graphview.pack_start(self.toolbar, False, False)







if __name__ == '__main__':
    app=appGui()
    gtk.main()

This code had the GUI built from GLADE to layout the GUI and then a few lines in python to call that GLADE file and attach callbacks to functions really simple. The GUI could of been built line by line (container here, button there) but whats the point?
 

Attachments

  • main.png
    19.1 KB · Views: 265
  • plot.png
    35.5 KB · Views: 273
  • plot2.png
    21.9 KB · Views: 267
Last edited:
Looks good. After i learn VB.NET, i am going to learn Python. After that, maybe ANSI C? I dunno...

So basically, with the right libraries, anything can be coded? Are there quite a few libs out for python?
 
yup, if you want something done, there is bound to be a module for it for python
vanilla-python comes with a vast amount of libs by itself and you can do alot with it

The modules I use to extend the capability

win32lib (this exposes all of the windows API to python so you can use activeX scripting to control excel for instance)
pyserial (to access the serial port really simply - same API across platforms)
numpy (python is a scripted language and manipulating large amounts of numbers is slow, numpy is matrix manipulations coded in C with Python hooks)
pyGTK cause I like the GTK toolkit, esp in windows
Matplotlib plotting capability akin to matlab in python
 
Here is a perl/tk program to compare.
It's much simpler but you can look over the syntax to see if you like it.
Code:
#!/usr/bin/perl -w
use Tk;
use strict;

my $box;
my $dataout;
my $datain;
my $from='ascii';
my $to='bin';
my $mw = new MainWindow;
my $tin =$mw->Text(-background =>'white')->pack();
my $fromradio;
my $toradio;
my $fromascii=$mw->Radiobutton(-command=>\&notsameto ,-variable=>\$fromradio,-value=>1,-text=>'ascii');
my $fromhex=$mw->Radiobutton(-command=>\&notsameto,-variable=>\$fromradio,-value=>2,-text=>'hex');
my $frombin=$mw->Radiobutton(-command=>\&notsameto,-variable=>\$fromradio,-value=>3,-text=>'bin');
my $toascii=$mw->Radiobutton(-state=>'disabled',-variable=>\$toradio,-value=>1,-text=>'ascii');
my $tohex=$mw->Radiobutton(-state=>'disabled',-variable=>\$toradio,-value=>2,-text=>'hex');
my $tobin=$mw->Radiobutton(-state=>'disabled',-variable=>\$toradio,-value=>3,-text=>'bin');

$fromascii->pack(-side=>'left');
$frombin->pack(-side=>'left');
$fromhex->pack(-side=>'left');
$toascii->pack(-side=>'right');
$tobin->pack(-side=>'right');
$tohex->pack(-side=>'right');

$tin->delete('1.0','end');
$tin->insert('end','test');


my $response = $mw -> Button(-text=>"Convert",-command => \&convert)->pack();

MainLoop;

sub notsameto{
if($fromradio==1){
	$toascii->configure(-state=>'disabled');
	$tobin->configure(-state=>'normal');
	$tohex->configure(-state=>'normal');
	return;
	}
if($fromradio==2){
	$tohex->configure(-state=>'disabled');
	$tobin->configure(-state=>'normal');
	$toascii->configure(-state=>'normal');
	return;
	}
if($fromradio==3){
	$tobin->configure(-state=>'disabled');
	$tohex->configure(-state=>'normal');
	$toascii->configure(-state=>'normal');
	return;
	}
}


sub b2ascii
{
my $l=length $_[0];
my $a=+pack "B$l",$_[0];
return $a;
}

sub a2hex
{
    (my $str = shift) =~ s/(.|\n)/sprintf("%02lx", ord $1)/eg;
    return $str;
}
sub h2ascii
{
    (my $str = shift) =~ s/([a-fA-F0-9]{2})/chr(hex $1)/eg;
    return $str;
}

sub a2bin
{
        my $l=(length $_[0])*8;
        my $a=+unpack "B$l",$_[0];
        return $a;
}

sub convert(){
if(!$toradio){return;}
$datain=$tin->get('1.0','end');
$tin->delete('1.0','end');
if ($fromradio==1){
    if ($toradio==3){$dataout=a2bin($datain);}
    if ($toradio==2){$dataout=a2hex($datain);}
    }
if($fromradio==2){
if($datain!~/[a-fA-F0-9]/)
    {
	$box = $mw->DialogBox( -buttons => ["OK"])->pack();
    return;
	}
	if($toradio==1){$dataout=h2ascii($datain);}
    if($toradio==3){$dataout=a2bin(h2ascii($datain));}
    }
if($fromradio==3){
    if ($datain!~/01/)
	{
	$box = $mw->DialogBox( -buttons => ["OK"])->pack();
    return;
	}
    if($toradio==1){$dataout=b2ascii($datain);}
    if($toradio==2){$dataout=a2hex(b2ascii($datain));}
    }
$tin->insert('end',$dataout);
return;
}

It converts ascii to hex or bin and back .
It's fun to play with .
You can convert ascii to hex and then since the hex is also ascii keep converting it again and again and then convert it all the way back to the original text.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…