Features

Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Help  | 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: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3714 times and has 4 replies Next Thread
cungchoi
Newbie




Joined: Dec 19, 2014
Post Count: 3
Status: Offline
Reply to this Post  Reply with Quote 
Sample plugin does not start

I followed exactly the Plugin development guide and created VolumePlugin.jar in plugin folder.
However when I opened the main Sweethome3d, it stays the start up picture forever.
I tried changing JRE package (I have v6, v7 on my Win7) but no help.
Any ideas? thanks
[Dec 19, 2014 4:51:30 AM] 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: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sample plugin does not start

Check the console, there must be a stack trace that appears in it.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 19, 2014 12:07:58 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
cungchoi
Newbie




Joined: Dec 19, 2014
Post Count: 3
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sample plugin does not start

thank you, I think I did a wrong thing to run the Sweethome3d.exe instead of its Jar version. Will try again.
[Dec 22, 2014 3:23:48 AM] 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: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sample plugin does not start

Plug-ins can run from Sweethome3d.exe too, but in case of problems, you should rather use the Jar version to check the console.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 22, 2014 9:24:18 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
cungchoi
Newbie




Joined: Dec 19, 2014
Post Count: 3
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sample plugin does not start

Right, I think my exe file is not up to date. Fine now though.
BTW, I modified your plugin Compute Walls Surface for my purpose and just for it (being messy of course), still I post it here if anyone bother to test or use it.
don't know how to attach a file


//version 25 Dec 2014
//- added ability to approximate curved walls
//- added ability to work for multilevel building
//- corrected slope walls
//- filter openings substractions by Doors & windows only
//- approximate doors & windows positions to prefer more inclusions. CAUTION: may have side effects when a door or windows is in vicinity of more than one wall on any level

package com.eteks.calculateWalls;

import java.awt.geom.Point2D;
import java.lang.reflect.Method;
import java.util.ArrayList;

import com.eteks.sweethome3d.model.HomePieceOfFurniture;
import com.eteks.sweethome3d.model.Selectable;
import com.eteks.sweethome3d.model.Wall;
import com.eteks.sweethome3d.plugin.Plugin;
import com.eteks.sweethome3d.plugin.PluginAction;

import javax.swing.JOptionPane;


class CalculateWallsAction extends PluginAction {

private final Plugin plugin;

public CalculateWallsAction(ClassLoader loader, Plugin plugin){
putPropertyValue(Property.NAME, "Compute walls' area");
putPropertyValue(Property.MENU, "Tools");

this.plugin = plugin;
// Enables the action by default
setEnabled(true);
}

private void showInfo(float size) {
String message = "The walls' area currently is: "+size+" m\u00B2.";
if(size == 0)
{
message = "Please select at least one wall.";
}
JOptionPane.showMessageDialog(null, message);
}

private boolean inWall(Wall w, float x, float y)
{
//if(x >= Math.min(w.getXStart(), w.getXEnd()) && x <= Math.max(w.getXStart(), w.getXEnd()) && y >= Math.min(w.getYStart(), w.getYEnd()) && y <= Math.max(w.getYStart(), w.getYEnd()))
float cmpRate = 0;
//generalize- just one end near the wall surface, there are two cases:
//case 1: an arc wall
if(w.getArcExtent() != null)
{
float [] arcCircleCenter;
float arcCircleRadius;
try{
Method m = Wall.class.getDeclaredMethod("getArcCircleCenter");
//m.invoke(d);// throws java.lang.IllegalAccessException
m.setAccessible(true);// Abracadabra
arcCircleCenter = (float[]) m.invoke(w);// now its OK
arcCircleRadius = (float)Point2D.distance(w.getXStart(), w.getYStart(),
arcCircleCenter [0], arcCircleCenter [1]);
cmpRate =(float)Point2D.distance(x,y,arcCircleCenter [0], arcCircleCenter [1])/arcCircleRadius;
} catch (Exception e) {
e.printStackTrace();
}
}
else
{
float dist2Start = (float)Point2D.distance(x,y,w.getXStart(), w.getYStart());
cmpRate = (dist2Start + (float)Point2D.distance(x,y,w.getXEnd(), w.getYEnd()))/w.getLength();
}
if((cmpRate > 0.9)&&(cmpRate< 1.1)) return true;
return false;
}

@Override
public void execute() {
float size = 0;

ArrayList<Wall> walls = new ArrayList<Wall>();
for(Selectable sel : plugin.getHome().getSelectedItems())
{
if(sel instanceof Wall)
{
Wall wall = (Wall) sel;

//if(wall.getArcExtent() == null)
walls.add(wall);
size += (wall.getHeight() + ((wall.getHeightAtEnd()==null)? wall.getHeight():wall.getHeightAtEnd()) )*wall.getLength()/2.0;

//substracts openings
for(HomePieceOfFurniture furniture : plugin.getHome().getFurniture())
if(furniture.isDoorOrWindow()
&& wall.isAtLevel(furniture.getLevel())
&& inWall(wall, furniture.getX(), furniture.getY()))
size -= (furniture.getHeight()*furniture.getWidth());

}
}

size /= 10000;
showInfo(size);
}
}

[Dec 26, 2014 7:10:40 AM] 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-2017 eTeks - All rights reserved