Question about cloning wall

This topic has been viewed 5674 times and has 1 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
Phineas
Posts: 1
Joined: Thu Jan 01, 2015 8:13 pm

Question about cloning wall

Post by Phineas »

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.

Code: Select all

	    
            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.

Code: Select all

	    
            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
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Question about cloning wall

Post by Puybaret »

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 creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest