Prev: Stand alone application (gui) crashes with unexpected java error
Next: How to find position of specific vector value
From: Peugas on 14 Mar 2010 13:36 Hi, I'm creating a GUI to control a 3D model. I already have the .wrl file and the GUI figure but I'm having a hard time trying to load my 3D model to Axes. Does anyone have a clue? I tried this: axes(handles.imagemvr); axis off world = vrworld('./World_files/wrl/World.wrl'); open(world); image(world); but nothing cause world is not an image...
From: Saurabh Mahapatra on 14 Mar 2010 14:06
Hi there, Since R2009a, we have functionality in Simulink 3D Animation that lets you add VRML 3D worlds inside MATLAB GUIs and animate them. Here is an example code that accomplishes the same for a VRML file: industrial_robot.wrl % Set the viewer preference vrsetpref('DefaultViewer', 'internalv5') %% Obtain vrworld and construct canvas w = vrworld('industrial_robot'); open(w); %Create the MATLAB GUI with two views of the robot c1 = vr.canvas(w, gcf, [20 10 250 400]); set(c1,'Units','normalized') % c1.Viewpoint='Left_View'; Please note the animation is automatic if you used Simulink with the VR Sink block and added this code on top of that. But if you use MATLAB, then you would have to access the appropriate VRML nodes in order to animate them. There is a video/demo that shows how to do that for a wind farm: http://www.mathworks.com/matlabcentral/fileexchange/26273-animate-a-wind-farm-with-matlab Thanks, Saurabh |