Commits

German Larrain  committed 6b5f871

simulator.Simulation: in 'add_x' methods, surrounded with try/except the
creation of graphic objects (the "actors").

  • Participants
  • Parent commits fb557bb

Comments (0)

Files changed (1)

File ars/model/simulator/__init__.py

 		return self._space
 
 	def add_axes(self):
-		gAxes = self.graph_adapter.Axes()
+		try:
+			gAxes = self.graph_adapter.Axes()
+		except AttributeError:
+			gAxes = None
 		name = 'axes'
 		return self.add_object(SimulatedObject(name, actor=gAxes))
 
 		# 	of the box
 		self._floor_geom = coll.Plane(self._space, normal, dist)
 		# TODO: use normal parameter for orientation
-		gFloor = self.graph_adapter.Box(box_size, box_center)
-		gFloor.set_color(color)
+		try:
+			gFloor = self.graph_adapter.Box(box_size, box_center)
+			gFloor.set_color(color)
+		except AttributeError:
+			gFloor = None
 		name = "floor"
 		# TODO: why SimulatedObject? See 'add_trimesh_floor'
 		return self.add_object(SimulatedObject(name, actor=gFloor))
 		self._floor_geom = coll.Trimesh(self._space, vertices, faces)
 		self._floor_geom.set_position(center)
 
-		gFloor = self.graph_adapter.Trimesh(vertices, faces, center)
-		gFloor.set_color(color)
+		try:
+			gFloor = self.graph_adapter.Trimesh(vertices, faces, center)
+			gFloor.set_color(color)
+		except AttributeError:
+			gFloor = None
 		name = 'floor'
 		# TODO: why SimulatedBody? See 'add_floor'
 		return self.add_object(SimulatedBody(name, actor=gFloor))
 		body = phs.Sphere(self._world, self._space, radius, mass, density)
 		body.set_position(center)
 
-		g_sphere = self.graph_adapter.Sphere(radius, center)
+		try:
+			g_sphere = self.graph_adapter.Sphere(radius, center)
+		except AttributeError:
+			g_sphere = None
 		name = 'sphere'
 		return self.add_object(SimulatedBody(name, body, g_sphere))
 
 		body = phs.Box(self._world, self._space, size, mass, density)
 		body.set_position(center)
 
-		g_box = self.graph_adapter.Box(size, center)
+		try:
+			g_box = self.graph_adapter.Box(size, center)
+		except AttributeError:
+			g_box = None
 		name = 'box' + str(center)  # FIXME
 		return self.add_object(SimulatedBody(name, body, g_box))
 
 		body = phs.Cylinder(self._world, self._space, length, radius, mass, density)
 		body.set_position(center)
 
-		g_cylinder = self.graph_adapter.Cylinder(length, radius, center)
+		try:
+			g_cylinder = self.graph_adapter.Cylinder(length, radius, center)
+		except AttributeError:
+			g_cylinder = None
 		name = 'cylinder'
 		return self.add_object(SimulatedBody(name, body, g_cylinder))
 
 		body = phs.Capsule(self._world, self._space, length, radius, mass, density)
 		body.set_position(center)
 
-		g_capsule = self.graph_adapter.Capsule(length, radius, center)
+		try:
+			g_capsule = self.graph_adapter.Capsule(length, radius, center)
+		except AttributeError:
+			g_capsule = None
 		name = 'capsule'
 		return self.add_object(SimulatedBody(name, body, g_capsule))