Hey guys I am a level 1 coder knowing barely enough to be able to create the button on the ribbon for this command. I asked chat gpt3 to create a pyrevit script for me and it spit out a script that looks legit but doesn’t work. The prompt was to create a script that creates and displays a text note for every single text style in the project. I did this on one of my companies templates yesterday and it was a real bear manually doing this by hand.
This is what I’m looking to have pyrevit do within a legend.
# Import necessary modules
from pyrevit import revit, DB
from pyrevit import script
from pyrevit import forms
# Get current document
doc = __revit__.ActiveUIDocument.Document
# Get all text styles in the document
text_styles = DB.FilteredElementCollector(doc).OfClass(DB.TextNoteType).ToElements()
# Create a text note for each text style
for text_style in text_styles:
text_note = TextNote.Create(doc, view.Id, XYZ.Zero, text_style.Id, "Sample Text")
My question is about the second to last line, “TextNote.Create” how can I learn what this is supposed to be doing? Is this something I look in the Revit API docs for? And the last line… Is it trying to add labels? Just looking for tips on where to look for any documentation on where for instance it may have got “legend.AddLabel” on the last line.