Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 2
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4443 times and has 1 reply Next Thread
kupiecu
Newbie



Polska
Joined: Nov 29, 2013
Post Count: 3
Status: Offline
Reply to this Post  Reply with Quote 
Plugins don't save a file on disc

sorry, my english level is low.'

I write plugin. It write walls, rooms and furniture to OBJ file. It's work but only when I debbuging this plugin. When I run it normally the plugin don't save file on my disc. ( when debug the file is saving ).
I have no idea, any sugesstions? Mayby samethink like permissons or samethin in manifest file? I don't now. Please help.



import java.io.IOException;
import com.eteks.sweethome3d.j3d.HomePieceOfFurniture3D;
import com.eteks.sweethome3d.j3d.OBJWriter;
import com.eteks.sweethome3d.j3d.Room3D;
import com.eteks.sweethome3d.j3d.Wall3D;
import com.eteks.sweethome3d.model.Home;
import com.eteks.sweethome3d.model.Room;
import com.eteks.sweethome3d.model.Wall;
import com.eteks.sweethome3d.plugin.Plugin;
import com.eteks.sweethome3d.plugin.PluginAction;
import javax.swing.JOptionPane;

public class Wtyczka extends Plugin {

@Override
public PluginAction[] getActions() {

return new PluginAction[] { new VolumeAction() };
}

public class VolumeAction extends PluginAction {



public VolumeAction() {
putPropertyValue(Property.NAME, "Upload project on your android device");
putPropertyValue(Property.MENU, "ToucHHome");
// Enables the action by default
setEnabled(true);
}

public void execute() {

OBJWriterTest ogien = new OBJWriterTest(); // obuekt stworzyc
try {
ogien.testOBJWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



}



public class OBJWriterTest {


public void testOBJWriter() throws IOException {
Home home = getHome();
// 1. Open the OBJ file "Test.obj"
OBJWriter writer = new OBJWriter("dragsy.obj", "Test", -1);
// assertTrue("trots.obj not created", new File("trots.obj").exists());

//write walls
int i =0;
for (Wall wall : home.getWalls()) {
// Create a not alive new wall to be able to explore its coordinates without setting capabilities
Wall3D wallNode = new Wall3D(wall, home, true, true);
writer.writeNode(wallNode, "wall_" + ++i);
}
// Write 3D rooms
i = 0;
for (Room room : home.getRooms()) {
Room3D roomNode = new Room3D(room, home, false, true, true);
writer.writeNode(roomNode, "room_" + ++i);
}

//Write 3D furniture
for (HomePieceOfFurniture piece : home.getFurniture()) {
// if (piece.isVisible() && objFile.equals("." + File.separator + "My_Home" + File.separator + piece.getName() + ".obj")) {
if (piece.isVisible()){
// Create a not alive new piece to be able to explore its coordinates without setting capabilities
// I set as home = null
HomePieceOfFurniture3D pieceNode = new HomePieceOfFurniture3D(piece, home, true, true);
writer.writeNode(pieceNode);
}
}

// 3. Close file
writer.close();
}
}
}
}

[Nov 29, 2013, 1:35:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugins don't save a file on disc

Writing files in a plug-in doesn't work if you run Sweet Home 3D under Java Web Start.
If this doesn't apply to your case, you should try to save the file dragsy.obj in a directory where you're sure you have the rights to write.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 29, 2013, 2:47:38 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved