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 4223 times and has 1 reply Next Thread
Phineas
Newbie




Joined: Jan 1, 2015
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Question about cloning wall

Hi, thanks for reading. First, let me say thanks for the great software. It is really great.

My question is this:

In the first example, when I clone two walls, it clones them without joining them.


Iterator< Wall > iter = getHome().getWalls().iterator();
while( iter.hasNext() ){
Wall wall = ( Wall )iter.next();
if( wall.getLevel() == level )
{
selectedItemList.add( wall );
Wall cloned =Wall.clone(); clonedItemList.add(wall); getHome().addWall( cloned );
}
}



If I clone them like this next example, they join but only show in the 3d view, and not in the 2d plan view pane.


Iterator< Wall > iter = getHome().getWalls().iterator();
while( iter.hasNext() ){
Wall wall = ( Wall )iter.next();
if( wall.getLevel() == level )
{
selectedItemList.add( wall );
Wall cloned = Wall.clone();
clonedItemList.add(wall);
}
}

clonedItemList.get( 0 ).setXEnd(clonedItemList.get( 1 ).getXStart() );
clonedItemList.get( 0 ).setYEnd(clonedItemList.get( 1 ).getYStart() );
clonedItemList.get( 0 ).setWallAtEnd( clonedItemList.get( 1 ) );
clonedItemList.get( 1 ).setWallAtStart( clonedItemList.get( 0 ) );
getHome().addWall( clonedItemList.get( 0 ) );
getHome().addWall( clonedItemList.get( 1 ) );



Why would the second example not display in the 2d plan?

I am trying to programmatically clone the walls and leave them joined.

Thanks for your time,
John
[Jan 1, 2015, 8:34:58 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: Question about cloning wall

Why would the second example not display in the 2d plan?
Difficult to say. Maybe you mix up walls ends. Are you sure that wall 1 is at the end of wall 0?
In case you missed it, you could also try the static method List<Wall> clone(List<Wall> walls) in the Wall class.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Jan 2, 2015, 6:34:39 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