yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #00648
[svn] r1523 - trunk/gui/py
Author: eudoxos
Date: 2008-09-23 09:51:55 +0200 (Tue, 23 Sep 2008)
New Revision: 1523
Modified:
trunk/gui/py/utils.py
trunk/gui/py/yadeControl.cpp
Log:
1. Omega().bodies.append can take list of bodies now (instead of just one body), returning list of added id's
2. utils.facet can take both tuples and lists for vertex coordinates
Modified: trunk/gui/py/utils.py
===================================================================
--- trunk/gui/py/utils.py 2008-09-22 15:14:44 UTC (rev 1522)
+++ trunk/gui/py/utils.py 2008-09-23 07:51:55 UTC (rev 1523)
@@ -45,7 +45,7 @@
b=Body()
b.shape=GeometricalModel('Facet',{'diffuseColor':color,'wire':wire,'visible':True})
b.mold=InteractingGeometry('InteractingFacet',{'diffuseColor':color})
- center=inscribedCircleCenter(vertices[0],vertices[1],vertices[2])
+ center=inscribedCircleCenter(list(vertices[0]),list(vertices[1]),list(vertices[2]))
vertices=map(lambda a,b:map(lambda x,y:x-y,a,b),vertices,[center,center,center])
vStr='['+' '.join(['{%g %g %g}'%(v[0],v[1],v[2]) for v in vertices])+']'
b.shape.setRaw('vertices',vStr)
Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp 2008-09-22 15:14:44 UTC (rev 1522)
+++ trunk/gui/py/yadeControl.cpp 2008-09-23 07:51:55 UTC (rev 1523)
@@ -283,6 +283,7 @@
else return pyBody(proxee->operator[](id));
}
body_id_t insert(pyBody b){return proxee->insert(b.proxee);}
+ python::list insertList(python::list bb){python::list ret; for(int i=0; i<len(bb); i++){ret.append(insert(python::extract<pyBody>(bb[i])()));} return ret;}
long length(){return proxee->size();}
void clear(){proxee->clear();}
};
@@ -543,6 +544,7 @@
.def("__getitem__",&pyBodyContainer::pyGetitem)
.def("__len__",&pyBodyContainer::length)
.def("append",&pyBodyContainer::insert)
+ .def("append",&pyBodyContainer::insertList)
.def("clear", &pyBodyContainer::clear);
boost::python::class_<pyInteractionContainer>("InteractionContainer",python::init<pyInteractionContainer&>())
.def("__iter__",&pyInteractionContainer::pyIter)