VRML 3D scene from MATLAB command prompt
3 ビュー (過去 30 日間)
古いコメントを表示
Hello Everyone,
Is there a way to open a new VRML world, add a background to the scene, and add different 3D Transform nodes depending on an indexing parameter passed from a MATLAB just using a command prompt? To clarify, using the following command requires the file to exist upfront to create the VRML world. Is it possible to create even 'filename' if it does not exist?
>> myworld = vrworld('filename', 'new');
The following command requires the existence of the node 'node_name' in the 'filename' to further manipulate the node object. What if we want to add this node depending on an input (say if i==1 insert 'plane.wrl' to the VRML world else insert 'helicopter.wrl' which are located in some folder).
>> mynode = vrnode(vrworld_object, 'node_name')
Thanks for your time.
0 件のコメント
採用された回答
Jan Houska
2012 年 7 月 30 日
You can create a new VRML world from scratch like this:
w = vrworld(''); % create an empty world and open it
open(w);
% ... add any nodes if desired ...
save(w, 'myworld.wrl'); % save under a new name
close(w);
You can add nodes to an existing open world (either loaded from a file or created as above) like this:
t1 = vrnode(w, 'MyTransform', 'Transform'); % add a Transform on the root
t2 = vrnode(t1, 'children', 'AnotherTransform', 'Transform'); % add child to t1
See also the documentation for the "vrnode" function.
2 件のコメント
Jan Houska
2012 年 8 月 2 日
There is no other reference manual (that I know of) than the product documentation. But, if you carefully read the reference pages of the "vrworld" and "vrnode" objects, you will see that the functions allowing to build and edit virtual worlds are described there - including the two I have suggested above.
その他の回答 (1 件)
Cornelis
2013 年 6 月 20 日
Dear Jan,
my vrml editor does not seem to be working. I'm running MATLAB Version: 8.0.0.783 (R2012b) on a 64bit win7 machine and have got Simulink 3D Animation Version 6.2 (R2012b) installed.
I can use *.wrl files I have created on a different machine with different version but cannot edit them (or newly created .wrl files). Also when I try other routes to launch the editor (eg via the new apps tab) I get the same error message (see below).
Could you please point me in the right direction?
Many thanks!
kind regards
Cornelis
Subscripted assignment dimension mismatch.
Error in repmat (line 54) B(nelems) = A;
Error in vr.edit.retrieveIconData (line 2303) iconData(:,:,[1 2 3]) = alpha .* double(iconData) + (1-alpha).* repmat(reshape(vr.edit.IconsBackgroundColor,1,1,[]),16,16);
Error in vr.edit/createuitoolbar (line 859) uipushtool(toolbar, 'TooltipString', 'New File', ...
Error in vr.edit (line 125) createuitoolbar(obj);
Error in vredit (line 23) vr.edit(get(w, 'FileName'));
0 件のコメント
参考
カテゴリ
Robotics and Autonomous Systems
Simulink 3D Animation
Classic Virtual Reality World
Build Virtual Reality Worlds
Help Center および File Exchange で Build Virtual Reality Worlds についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!