Hi, here’s a possibility.
It’s definitely still improvable. I’ve taken into account common connections (no chamfers).
Here’s the script and family.
Code Python + script + family
Python 1: Determine the longest vertical edges
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
lines=IN[0]
#Found the lines with vector Z
a=[l for l in lines if l.Direction.Normalized().Z!=0]
#Found the lines biggest
b=[l for l in a if l.Length == max([l.Length for l in a])]
OUT = b
Python 2 :Keep the edges where the chamfers must be applied
import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import XYZ,Outline,FilteredElementCollector,BoundingBoxIntersectsFilter,Wall
doc = DocumentManager.Instance.CurrentDBDocument
pts=IN[0]
rep=[]
for p in pts:
#Create outline to intersect element
p1=p.ToRevitType()
pb=XYZ(p1.X-0.01/0.3048,p1.Y-0.01/0.3048,p1.Z)
pe=XYZ(p1.X+0.01/0.3048,p1.Y+0.01/0.3048,p1.Z)
ol=Outline(pb,pe)
filter=BoundingBoxIntersectsFilter(ol)
le=FilteredElementCollector(doc).OfClass(Wall).WherePasses(filter).ToElements()
rep.append(len(le)<=1)
OUT = rep
Python 3 : Cut the walls with the chamfers and mask them
import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import SolidSolidCutUtils,ElementId
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Transactions import TransactionManager
sc=UnwrapElement(IN[0])
w=UnwrapElement(IN[1])
l=List[ElementId]()
doc=sc[0].Document
actv=doc.ActiveView
TransactionManager.Instance.EnsureInTransaction(doc)
for s in sc:
SolidSolidCutUtils.AddCutBetweenSolids(doc,w,s)
doc.Regenerate()
l.Add(s.Id)
actv.HideElements(l)
TransactionManager.Instance.TransactionTaskDone()
OUT = 0
Script:
essai avec chanfrein sur arete.dyn (64.2 KB)
Family:
chanfrein.rfa (404 KB)
edit: Please take into account Mr. Sovitek’s remarks regarding python versions.
Sincerely,
christian.stan