Example #1
0
#         return 'New name'

# def test():
#     FORM.exEvent.Raise()

# handler = execute_rebar_set()
# exEvent = ExternalEvent.Create(handler)

# but_cancel.AddFunction(FORM.Close)
# but_create.AddFunction(test)
# FORM.Create(exEvent)
# coding: utf8
"""Выносим вид на лист"""
from Autodesk.Revit.DB import JoinGeometryUtils, Transaction

doc = __revit__.ActiveUIDocument.Document
echo(doc)

selection = [
    doc.GetElement(elId)
    for elId in __revit__.ActiveUIDocument.Selection.GetElementIds()
]

with Transaction(doc, "test") as t:
    t.Start()
    el1 = JoinGeometryUtils.GetJoinedElements(doc, selection[0])
    echo(el1)
    # el2 = selection[1]
    # JoinGeometryUtils.SwitchJoinOrder(doc, el1, el2)
    t.Commit()
Example #2
0
def UnjoinElement(element):
    from Autodesk.Revit.DB import JoinGeometryUtils
    joined = JoinGeometryUtils.GetJoinedElements(doc, element)
    for e in joined:
        secondElement = doc.GetElement(e)
        JoinGeometryUtils.UnjoinGeometry(doc, element, secondElement)
				els_sol_fil_flat = flatten_List(elems_solid_filter)
				for els in els_sol_fil_flat:
					if els.Id.ToString() == i1.Id.ToString():
						pass
					else:
						if JoinGeometryUtils.AreElementsJoined(doc,els,i1):
							pass
						else:
							results += join(els,i1)
	TransactionManager.Instance.ForceCloseTransaction()
	#endregion
else:
	results = 0
	#region разделение геометрии
	items1 = flatten_List(elements)
	TransactionManager.Instance.EnsureInTransaction(doc)
	for i in items1:
		test = JoinGeometryUtils.GetJoinedElements(doc, i)
		if test:
			for t in test:
				JoinGeometryUtils.UnjoinGeometry(doc,i,doc.GetElement(t))
				results += 1
	TransactionManager.Instance.ForceCloseTransaction()
	#endregion
#endregion
t = time.stop()
if IN[1]:
	OUT = "Join elements = " + str(results), "Minutes, Seconds, Milliseconds = ", [t.Minutes, t.Seconds, t.Milliseconds]
else:
	OUT = "Unjoin elements = " + str(results), "Minutes, Seconds, Milliseconds = ", [t.Minutes, t.Seconds, t.Milliseconds]
Example #4
0
            for e in elementId:
                lines.append(doc.GetElement(e))
        elif 'Wall is slightly off axis' in text or 'Curve-Based Family is slightly off axis' in text:
            for e in elementId:
                walls.append(doc.GetElement(e))
        allLines.append(lines)
        allWalls.append(walls)

i = 0
for line in allLines:
    t = Transaction(doc, 'Correct Lines')
    t.Start()
    for l in line:
        #if l.Category.Name == '<Sketch>':
        off_line = l.GeometryCurve
        joined = JoinGeometryUtils.GetJoinedElements(doc, l)
        for j in joined:
            print(j)
        sketchPlane = l.SketchPlane
        correct_line = Warnings.CorrectLineXY(off_line, 0.08)
        print(correct_line)
        try:
            try:
                l.SetSketchPlaneAndCurve(sketchPlane, correct_line)
            except:
                l.SetGeometryCurve(correct_line, True)
        except:
            print('Curve Set Error')
        '''
            if joined:
                for j in joined: