From f480209e4023f9cf2f2bd65fe17ab06a2cfdf7b3 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 843c2ae40..17f402440 100644 --- a/irteus/irtstl.l +++ b/irteus/irtstl.l @@ -214,7 +214,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))))