Print at Dec 11, 2018 8:44:41 PM View all posts in this thread on one page
Posted by Phineas at Jan 1, 2015 8:34:58 PM
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

Posted by Puybaret at Jan 2, 2015 6:34:39 PM
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