michaelk

duplicate objects inserted into walls w/o duplicating the walls?

13 posts in this topic

Is it possible to duplicate a symbol (or a door.  or a window) inserted into a wall without duplicating the wall also? 

 

If I wasn't scripting it I would copy the symbol/door/window and then paste in place to get the symbol/door/window copied in the same location (or any location - I could always move it later I guess)

 

 

Thanks!

0

Share this post


Link to post
Share on other sites

So why not do the copy paste in the script. It seems to work. If you want the new object to be In Wall, just use a SetParent.

 

    DoMenuTextByName('Copy',0);
    DoMenuTextByName('Paste in Place',0);    

 

Just so you don't feel too bad, I just spent 45 minutes coming to this realization. ;-)

0

Share this post


Link to post
Share on other sites

O.o:)

 

… because I thought there MUST be another (better) way to do it!

0

Share this post


Link to post
Share on other sites

Turn off the wall insertion mode of the Selection tool & Alt drag

 

 

1

Share this post


Link to post
Share on other sites

Hi Pat,

   Don't make me laugh  (too late).  

 

   When I read Michael's second post this morning, I thought, "better" way?!?  What's wrong with Copy / Paste? I've been using it since 1990 and it's never let me down. And before you threw my name onto the Coliseum Floor, I thought maybe hDuplicate() would work, so I tried it on a single window in a wall. It seemed simpler, but it wasn't working. Nope, this wasn't better, and real work got in the way, so I shelved it. 

 

   After reading your second post (and laughing) I recreated the file and tried it again. The duplicate and the original windows seem to lock themselves to each other when hDuplicate() is used. I can't drag the duplicate window around after I create it. The new window doesn't cut the wall properly in Plan, though the OIP says it is a "Window In Wall". Lastly, I can't delete it. Select it, yes; delete it, no. If I delete the original window, then both delete – very odd. They seem joined at the hip. Perhaps this is a bug. I don't know if hDuplicate should work on Windows in Walls. Naively, I think it should. I'll send it in and see what comes back.

 

   So, after spending more than an hour pushing dead code around, I tried your approach — Copy / Paste (in Place). It works like a champ. The two windows act as separate entities, interactively and programatically. I'm giving your approach 2-thumbs-up.

 

   Michael, do what Pat says. He's usually right*. ;-)

 

Raymond

 

* When he's finished his morning coffee, he flies back from Columbia (Maryland).

He never has to launder his bed linens, he just creates new spreadsheets.

When asked to solve vector problems, he is never wrong, and his answers always follow the Right–Hand–Rule.

He IS the Most Interesting Man On The Forum!

1

Share this post


Link to post
Share on other sites
15 minutes ago, MullinRJ said:

 

   Michael, do what Pat says. He's usually right*. ;-)

 

 

Hey Raymond

 

I always do!

 

 

0

Share this post


Link to post
Share on other sites

I don't always Vectorscript, but when I don't that Python white space makes me cranky.  Code Responsibly my Friend.

1

Share this post


Link to post
Share on other sites
19 hours ago, bcd said:

Turn off the wall insertion mode of the Selection tool & Alt drag

Aha - didn't notice this was in the Vectorsript forum. my bad.

0

Share this post


Link to post
Share on other sites

@bcd Nothing to be sorry about. You actually hit on the answer.  With the Wall Insertion Mode off, the Duplicate works as Michael, Raymond and I wanted it to.

 

DOH!

 

Great solution.

 

Procedure Test;

Var	H1, H2: Handle;
	B1: Boolean;

Begin
	B1:=GetPref(581);
	SetPref(581, False);
	H1:=FSActLayer;
	H2:=CreateDuplicateObject(H1, ActLayer);
	HMove(H2,60",60");
	SetPref(581,B1);
End;

Run(Test);

 

0

Share this post


Link to post
Share on other sites

That's why I try to read everything on the board. You never know when an idea from somewhere totally different will make a huge difference to what you are doing.

 

 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now