Hi, all.
We are trying to write a script for a tool that runs in drafting views, which basically toggles the work plane on and off (the same as going to Systems tab > Work Plane panel > Show button), and also sets the spacing of the workplane to 0.2". We got the script below, which is simple enough but somehow won’t work:
# Import necessary libraries
from pyrevit import revit, DB
# Get the current document
doc = revit.doc
# Get the active view
active_view = doc.ActiveView
# Check if the work plane is visible
if active_view.ShowActiveWorkPlane:
# If the work plane is visible, hide it
active_view.HideActiveWorkPlane()
else:
# If the work plane is hidden, show it and set the spacing to 0.2"
active_view.ShowActiveWorkPlane()
# TODO: set spacing to 0.2"
We get errors saying there’s no “scketchPlane” in the view, and other similar errors, depending on how we change the script. We’ve been going to the API docs to review methods, and it seems we are in the right track…
Could we get a hand on this script? If we get the toggling to work, could we also have it set the spacing to 0.2"? I looked around the API docs for something like that but couldn’t find methods that seem to do that…
Thanks in advance,
Edgar

