Nice snippet for vsCode to init script

Hello,
I want to share with you nice snippet for vsCode to init script.
For more information about snippets in vsCode and how to create one: link.

"pyRevit init": {
		"prefix": "pyrevit:init",
		"body": [
			"# -*- coding: utf-8 -*-",
			"\"\"\" ${1:description} \"\"\"",
			"__title__ = \"${2:title}\"",
			"__author__ = \"Your name\"",
			"",
			"# -------------------------------",
			"# ------------IMPORTS------------",
			"# -------------------------------",
			"",
			"# from Autodesk.Revit.DB import ...",
			"# from Autodesk.Revit.UI import ...",
			"",
			"# from pyrevit import forms, script",
			"",
			"# -------------------------------",
			"# -------------MAIN--------------",
			"# -------------------------------",
			"",
			"uidoc = __revit__.ActiveUIDocument  # type: ignore",
			"doc = uidoc.Document",
			"# selection = [doc.GetElement(x) for x in uidoc.Selection.GetElementIds()]",
			"",
			"--------------------------------",
			"-------------SCRIPT-------------",
			"--------------------------------",
			"",
			"$0",
			""
		],
		"description": "Init block for pyRevit script"
	}

Thanks for sharing,
There are quite a few snippets available from the repo:

1 Like