From 9a7e68edcfadedf40be1121fb9f4b474829229a6 Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Mon, 24 Jul 2017 22:28:24 +0900 Subject: [PATCH] fix eus2stl, check if the body has glvertices, see https://github.com/jsk-ros-pkg/jsk_model_tools/pull/208#issuecomment-316715445 --- irteus/irtstl.l | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/irteus/irtstl.l b/irteus/irtstl.l index 55dc11a13..5453d9b1d 100644 --- a/irteus/irtstl.l +++ b/irteus/irtstl.l @@ -213,7 +213,21 @@ (defun eus2stl (fname _faceset &key (scale 0.001)) (send _faceset :worldpos) (with-open-file (f fname :direction :output) - (let ((faces (send (body-to-faces _faceset) :faces))) + (let ((faces)) + (cond ((find-method _faceset :bodies) + (setq faces + (mapcan #'(lambda (x) + ;(print (list x (boundp 'gl::glbody) (classp gl::glbody) (derivedp x gl::glbody))) + (cond ((find-method x :glvertices) + (send (body-to-faces (send x :glvertices)) :faces)) + ((cdr (assoc 'user::glvertices (send x :slots))) + (send (cdr (assoc 'user::glvertices (send x :slots))) :faces)) + (t + (send (body-to-faces x) :faces)) + )) + (send _faceset :bodies)))) + (t + (setq faces (send (body-to-faces _faceset) :faces)))) (write-stl-header f (length faces)) (dolist (_face faces) (write-stl-face f _face :scale scale))))