Dynamo icon indicating copy to clipboard operation
Dynamo copied to clipboard

Crash report from Dynamo 3.2.1.5366

Open esmarezan opened this issue 1 year ago • 2 comments

Dynamo Version

3.2.1.5366

Host

No response

Operating System

Microsoft Windows NT 10.0.22631.0

What did you do?

I wrote a basic python script tgo run but everytime I try to run some scripts. Program crashes

What did you expect to see?

To be able to run the scripts import clr clr.AddReference("RevitServices") clr.AddReference("RevitAPI") clr.AddReference("RevitAPIUI") from RevitServices.Persistence import DocumentManager from Autodesk.Revit.DB import FilteredElementCollector, FamilyInstance, FamilySymbol, XYZ, Transaction import csv

Revit document

doc = DocumentManager.Instance.CurrentDBDocument

Giriş verileri

file_path = IN[0] # CSV dosya yolu family_type_id = IN[1] # Family Type ID

CSV dosyasını okuyup son satırdaki x, y, z verilerini alıyoruz

with open(file_path, 'r') as csvfile: reader = csv.reader(csvfile) rows = list(reader)

# Eğer dosya boşsa veya yeterli veri yoksa hata vermeden çık
if len(rows) < 2:  # 1 satır başlık satırı olduğu varsayılıyor
    OUT = "CSV dosyasında yeterli veri yok."
else:
    last_row = rows[-1]
    
    # Veri kontrolü yapalım
    if len(last_row) < 4:  # Zaman, x, y, z sütunlarının mevcut olup olmadığını kontrol eder
        OUT = "Son satırda eksik veri var."
    else:
        timestamp = last_row[0]  # Zaman verisi
        x, y, z = map(float, last_row[1:4])  # X, Y, Z koordinatları

        # Yeni XYZ konum noktası
        point = XYZ(x, y, z)

        # Mevcut tüm küp componentlerini (aynı family türünden olanları) buluyoruz
        family_instances = FilteredElementCollector(doc).OfClass(FamilyInstance).OfCategoryId(doc.GetElement(family_type_id).Category.Id).ToElements()

        # Önceki küpleri silme işlemi
        t = Transaction(doc, "Delete Previous Cube")
        t.Start()
        for instance in family_instances:
            doc.Delete(instance.Id)
        t.Commit()

        # Yeni küpü belirtilen noktaya yerleştiriyoruz
        symbol = doc.GetElement(family_type_id)
        if not symbol.IsActive:
            t = Transaction(doc, "Activate Family Symbol")
            t.Start()
            symbol.Activate()
            t.Commit()

        # Yeni bir Transaction başlatarak küp componenti ekleme
        t = Transaction(doc, "Place Cube at New Location")
        t.Start()
        new_instance = doc.Create.NewFamilyInstance(point, symbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural)
        t.Commit()

        # Çıktı olarak yeni instance döndürülür
        OUT = new_instance

What did you see instead?

Infinite running dynamo script

What packages or external references (if any) were used?

No response

Stack Trace

No response

Details

CLR: 8.0.0

esmarezan avatar Nov 06 '24 08:11 esmarezan

Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.

github-actions[bot] avatar Nov 06 '24 08:11 github-actions[bot]

tracked internally DYN-7741

avidit avatar Nov 06 '24 12:11 avidit