Jump to content
Sign in to follow this  
Oachl Kini

Join Walls

Recommended Posts

Hi!

I'm trying to build an easy house in my script, but I can't get the joinWalls-command to work. Here's my code:

 

vs.Wall(0,0,0,10)
w1=vs.LNewObj()
ww=vs.WallWidth(w1)
vs.HMove(w1,ww/2,0)
vs.Wall(0,10,10,10)
w2=vs.LNewObj()
vs.HMove(w2,0,-ww/2)
vs.JoinWalls(w1,w2,(ww/2,10-ww/2),(ww/2,10-ww/2),2,0,1)

 

First I had to move the walls so the edges fit. Now I can join the walls using Alt+W, but I just can't get the function to do it....Any help?

 

Ok.. now it works.. Just used

vs.JoinWalls(w1,w2,(ww/2,3),(3,10-ww/2),2,0,1)

Thought I tried that one before....

 

Now my problem is that I can't join the last wall to the first... :(

Edited by Oachl Kini

Share this post


Link to post

Hi

Hm, I think your main problem is, you overwrite the handle (w1 = vs.LNewObj()) of your first wall. So you don't have it anymore, to join your last wall. You somehow have to copy the handle of the first Wall. 

 

I made a Script with a more flexible (which would be more flexible with more walls) script, that would work for me. 

It first loops the input points and draw the walls. Simultaneously it put the walls and points in another list-variable (named walls) with all values needed to joint them anytime later (point and handle). 

Second it loops through that wall-list-values and do the join job. Always the last point from actual(i) wall  with first point next(i+1) second wall, and so on.

i is the "loop counter". Loops and list variables are extremly powerfull instruments for scripts. 

 

Maybe it looks more complicated in your eyes like your original script.

wv = [[0,0],[0,10],[10,10],[10,0],[0,0]]
walls=[]
for i in range(len(wv)-1):
    p1=wv[i][0],wv[i][1];p2=wv[i+1][0],wv[i+1][1]
    vs.Wall(p1,p2)
    w=vs.LNewObj()
    walls.append([w,p1,p2])
    if i == len(wv)-2: #append first wall again to have a join object for the last wall
        walls.append([walls[0][0],walls[0][1],walls[0][2]])

vs.AlrtDialog(str(walls)) #Debug for errors, delete if it works
for i in range(len(walls)-1):
    w1 = walls[i][0]
    w2 = walls[i+1][0]
    p1 = walls[i][2] #second point from actual (i) wall
    p2 = walls[i+1][1] # fist point from next (i+1) wall
    
    vs.JoinWalls(w1,w2,p1,p2,2,0,1)

 

Edited by DomC
  • Like 1

Share this post


Link to post

Thanks, Dom!

Looks nice and a lot better than my code, though mine wasn't supposed to - it was just a first test. :-)

So, it definitely works, but now my code also works just fine. It didn't on friday... Sometimes I sooo love programming...................

Share this post


Link to post

Thanks for feedback

 

Quote

you overwrite the handle (w1 = vs.LNewObj()) of your first wall

That comment certainly was wrong ..., sorry :-)

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...