|
med python binding
#26925
05/02/04 22:35
05/02/04 22:35
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i started to do a python binding for med.
med_python.zip ~ 50kb
it's still very incomplete and a bit buggy (don't try to close med while the python window is open! ). currently only the vertex and triangle commands are wrapped but some things can already be done with it. ...
the latest python and wxpython release has to be installed on your pc.
-> http://www.python.org
-> http://wxpython.sourceforge.net
|
|
|
Re: med python binding
[Re: Cellulaer]
#26931
05/04/04 05:23
05/04/04 05:23
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i think you will need the med which comes with 6.2!
python is very easy to learn:
http://www.ibiblio.org/obp/thinkCSpy/
http://www.python.org/doc/2.3.3/tut/tut.html
here is an example of the latest plugin i did for testing:
Code:
import __main__,math,string,med
def fatman_plugin(_p_):
dlg=__main__.wx.TextEntryDialog(__main__.frame,
"this plugin adds the scaled normal to each selected vertex.\n\nnormal scale factor:",
"fatman","10")
if dlg.ShowModal()==__main__.wx.ID_OK:
values=string.split(dlg.GetValue())
fatman(float(values[0]))
dlg.Destroy()
__main__.frame.Close()
def fatman(normalscale):
med.startmodelediting()
num_vertices=med.vertex_getvertexcount()
for i in range(0,num_vertices):
med.vertex_selectvertex(i)
if med.vertex_isselected():
pos1,pos2=med.vertex_getvertexpos()
normal=med.vertex_getnormal()
pos=(pos2[0]+(normal[0]*normalscale),
pos2[1]+(normal[1]*normalscale),
pos2[2]+(normal[2]*normalscale))
med.vertex_setvertexpos(pos)
med.donemodelediting()
__main__.register_plugin("fatman",fatman_plugin) #plugin_name,plugin_function
the problem is that i am a pretty poor c/c++ programmer and i am not sure if i did everything right with the binding.
|
|
|
Re: med python binding
[Re: FeiHongJr]
#26934
06/20/05 12:43
06/20/05 12:43
|
Joined: Jan 2004
Posts: 585 Alexandria, VA
Alkai
Developer
|
Developer
Joined: Jan 2004
Posts: 585
Alexandria, VA
|
What is possible with a python plugin? What can be done with it?
If you gaze long into an abyss, the abyss will gaze back into you.
3.0 GHz Pentium 4 w/HT
1 Gig 400mhz DDR SDRAM
128mb NVidia GeForce FX 5200
|
|
|
|