Hi Guys,
I was looking for a solution on joining multiple walls
for example
- block wall
- plaster wall either side
- paint wall either side
- skirting wall either side
total of 7 layers of walls , its getting very time consuming for joining each wall to each other .
Any idea on how do i go ahead with a solution through dynamo.
My first approach was with selecting all walls
then get wall curves
get all lines parallel to each other
group lines by distance
then join.
logic seems easy but couldnât get results
Do you mean something like this?
Just select the walls you need to join (you can also use Category > All Elements of Category):
With this Python script:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
walls = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
for x in walls:
for y in walls:
try:
JoinGeometryUtils.JoinGeometry(doc,x,y)
except:
pass
TransactionManager.Instance.TransactionTaskDone()
OUT = walls
3 Likes
yes something like this but ,
but should work for multiple layers
What do you mean with multiple layers? Can you post some images to better explain? Like a before/after
@lucamanzoni
Thanks a lot
Your script worked for this case as well,
only problem is , it joins all the walls with all the walls, creating a lot of warnings,
can the script be modified for only intersecting walls join
Which warnings do you get? I donât get any warning
if you check warnings from the inquiry tab in revit,
you can see , elements join but do not intersect.
In my case each wall is joined with all other all in the project.
Warnings are huge.
Ok, you are right. I guess it will take a bit of time to find a solution, maybe someone else has an idea
YUP,
i am trying to filters walls
reducing the wall elements to minimize the warnings as of now
@Preetesh_Magdum1,
Please limit yourself to a single topic per issue.
I gave an example of how I would tackle the problem there, and will reiterate here in more detail since I just closed your other topic for you.
Get all walls
Get the walls direction.
Normalize them.
Rotate them 180 degrees as needed so they are contained in quadrant 1 or 2 (no negative Y values).
Group each wall by these vectors.
Get the geometry for each wall.
Get the distance from each wall geometry to each other wall geometry.
If the distance was 0, then join the walls as shown above, otherwise do nothing.
If you also need to join the perpendicular walls, skip the vector bits.
Another option would be to just let the warnings occur, then use a second graph to select all join warning combinations (archilab has nodes that can help here), and unjoin them.
Also, consider using parts in the future as that would save you a lot of headache.
1 Like
Please do post here if you find the solution.
Thank you
Thank you @jacob.small
I am still working on the approach,
thank you,
I improved the script, so that it works only when geometries are intersecting. In this way the result is clean and there are no warnings.
The only problem is that adiacent walls, like those in your case, are not recognized as intersecting, so they wonât be joined.
Here the script:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
walls = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
inter = []
for x in walls:
for y in walls:
filterIntersect = ElementIntersectsElementFilter(x)
if x is not y:
if filterIntersect.PassesFilter(y):
inter.append(y)
try:
JoinGeometryUtils.JoinGeometry(doc,x,y)
except:
pass
TransactionManager.Instance.TransactionTaskDone()
OUT = inter
PS. As @jacob.small suggested, why donât you simply use parts or compound walls?
3 Likes
thank you @lucamanzoni
I am yet trying for a solution.
please do share if you find a solution.
thank you,
I think this will work. The logic of the script is:
- If the 2 elements intersect, join them
- If not, check the distance between the location lines. If it is equal to the sum of the wallâs thicknesses, divided by two, then it means they are adjacent: join them.
- If both conditions are false, pass.
Output are the joined walls.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
walls = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
joined = []
for x in walls:
for y in walls:
filterIntersect = ElementIntersectsElementFilter(x)
if x is not y:
if filterIntersect.PassesFilter(y):
joined.append(y)
try:
JoinGeometryUtils.JoinGeometry(doc,x,y)
except:
pass
else:
point = x.Location.Curve.Origin.ToPoint()
curve = y.Location.Curve.ToProtoType()
distance = curve.DistanceTo(point)
thickF = (x.Width + y.Width)/2
thickM = UnitUtils.ConvertFromInternalUnits(thickF,DisplayUnitType.DUT_MILLIMETERS)
if distance == thickM:
joined.append(y)
try:
JoinGeometryUtils.JoinGeometry(doc,x,y)
except:
pass
TransactionManager.Instance.TransactionTaskDone()
OUT = joined
3 Likes
Hello! Thanks for your effort. The definition seems to work only for intersecting walls while ignoring adjacent pairs. I couldnât find the cause in the script.
Thanks for sharing your knowledge.This is the only one that solve my issue butim getting this warningr on python node :
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File ââ, line 47, in
NameError: name âDisplayUnitTypeâ is not defined