Gary,
I take it you mean "com.sun.j3d.loaders.vrml97.VrmlLoader.load()" and not
"com.sun.j3d.loaders.vrml97.load()". If this is the case, did you try
load("Models/"+fileName);
?
Rick
>Hello,
>
> I guess this question crosses both forums. I am using the vrml-java3d
>Working Group's loader and am having trouble with
> com.sun.j3d.loaders.vrml97.load(String pathname). It
>works fine if I give it a relative path name to the file. However, I am using
>the
>java.awt.FileDialog to grab files from a subdirectory called "Models".
>I use Filedialog.getFile() which returns the file itself, without the "Models/"
>in
>front of it. I pass this to load() which tries to be helpful and prepends the
>path
>name of my working directory (up to but not including "Models/"). So, I get:
>
> D:\blah-blah-blah\file.wrl
>
>instead of
>
> D:\blah-blah-blah\Models\file.wrl
>
> I tried setting basepath by calling
> com.sun.j3d.loaders.Loader.setBasePath() with the
>name of the directory (including "Models/") returned from
>FileDialog.getDirectory(), but the load() method appears
>to ignore it even though getBasePath() reflects the
>desired basepath! If I give it the absolute path to the
>file, it insists on prepending the basepath anyway. The
>source code supplied with the VRML97 loader
>(stamped "VrmlLoader.java 1.13 98/11/05 20:33:08")
>appears to apply basepath correctly...
>
>
> private void LoadFile( String basepath, String geomfile )
> {
> try
> {
> // Load a geometry file.
> VrmlLoader modelLoader = new VrmlLoader();
> System.out.println( "Basepath="
> + modelLoader.getBasePath() ); // prints "Basepath=null"
> System.out.println( "Loading \"" + basepath
> + geomfile + " ..." ); // looks correct
> modelLoader.setBasePath( basepath );
> System.out.println( "Basepath="
> + modelLoader.getBasePath() ); // looks correct
> Scene scene = modelLoader.load( geomfile ); // uses wrong basepath
> System.out.println( "File loaded." );
> if( scene != null )
> {
> BranchGroup sceneGroup = scene.getSceneGroup();
> modelTransformGroup.addChild( sceneGroup );
> }
> }
> catch( FileNotFoundException e )
> {
> System.out.println( geomfile + ": " + e.getMessage() );
> }
>
>
> I am using VRML97 BETA2 "REV C" on NT 4.0 SP4 w/
>jdk1.2 and j3d1.1.
>
>Wa hoppin? Thanks,
>-Gary
>
>
>=====================================================================
>To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
>Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/