Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding
Announcements
We are currently migrating data within this board to improve the community. During this process, posting, replying, editing and other features are temporarily disabled. We sincerely apologize for any inconvenience caused and appreciate your understanding. Thank you for your patience and support.

Drawing Sheet Automation

Flies-Eyes
Advisor Advisor
405 Views
4 Replies
Message 1 of 5

Drawing Sheet Automation

Flies-Eyes
Advisor
Advisor

I have been searching online seeking tutorials or videos demonstrating how Revit can automate multiple drawings from the model. 

I was expecting to find many examples of innovative scripts or macros that would demonstrate these processes, however I cannot find any evidence to indicate this is possible with Revit.

 

If anybody has found a video demonstrating drawing automation or know whether this is simply not currently possible, at least I can put this topic to rest.  

Reply
Reply
0 Likes
406 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Autodesk
Autodesk

Automating drawing creation in Revit is definitely possible and a powerful way to boost productivity. It involves a combination of techniques, from simple scripting to more advanced add-in development. Let's explore the options and I'll point you to resources that demonstrate these techniques.

Methods for Drawing Sheet Automation in Revit:

  1. Revit API (Add-in Development): This is the most flexible and powerful approach. Using the Revit API (C# or Python), you can programmatically create views, place them on sheets, set parameters, and even control annotations. This is ideal for complex, customized workflows.

  2. Dynamo: Dynamo is a visual programming tool that integrates with Revit. It allows you to create scripts (graphs) to automate tasks, including drawing creation. Dynamo is great for less complex automations where you don't want to dive into full add-in development.

  3. Built-in Revit Features (Less Automated): Revit itself has some features that assist in drawing creation, like view templates and the ability to duplicate views. While not fully automated, these can streamline parts of the process.

Example Scenario (Revit API - C#):

Let's outline a simplified C# example using the Revit API to create sheets and place views on them. This is a basic illustration, but it can be extended for more complex scenarios.

C#
 
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Collections.Generic;
using System.Linq;

public class CreateDrawings
{
    public void Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        Document doc = commandData.Application.ActiveUIDocument.Document;

        // 1. Get or create a Title Block family
        FamilySymbol titleBlock = GetTitleBlock(doc, "YourTitleBlockName"); // Replace with your title block name

        // 2. Define view information (e.g., view names, view types, levels)
        List<ViewInfo> viewInfos = GetViewInformation(); // Function to define your views

        // 3. Create sheets and place views
        using (Transaction t = new Transaction(doc, "Create Drawings"))
        {
            t.Start();

            foreach (ViewInfo viewInfo in viewInfos)
            {
                // Create a new sheet
                ViewSheet newSheet = ViewSheet.Create(doc, titleBlock.Id);
                newSheet.Name = viewInfo.SheetName;
                newSheet.SheetNumber = viewInfo.SheetNumber;

                // Get the view to place (assuming it exists)
                View viewToPlace = doc.GetElement(viewInfo.ViewId) as View;

                if (viewToPlace != null)
                {
                    // Place the view on the sheet (adjust location as needed)
                    XYZ viewLocation = new XYZ(2, 2, 0); // Example location
                    Viewport.Create(doc, newSheet.Id, viewToPlace.Id, viewLocation);
                }
            }

            t.Commit();
        }
    }

    // Helper functions (implementation omitted for brevity - you'll need to define these)
    private FamilySymbol GetTitleBlock(Document doc, string titleBlockName) { /* ... */ }
    private List<ViewInfo> GetViewInformation() { /* ... */ }

    // Inner class to hold view information
    public class ViewInfo
    {
        public string SheetName { get; set; }
        public string SheetNumber { get; set; }
        public ElementId ViewId { get; set; }
    }
}

Key Concepts and Improvements:

  • Transaction: All Revit API modifications must be within a transaction.
  • Title Block: You need to get a title block family to create sheets.
  • View Information: The ViewInfo class (or a similar structure) is essential to organize the data for each sheet and the views to be placed. You'll need to populate this with your specific view names, sheet numbers, and view IDs.
  • View Placement: The Viewport.Create method places the view on the sheet at a specified location.
  • Error Handling: Production-ready code should include robust error handling (e.g., checking if views exist, handling exceptions).

Dynamo Approach:

Dynamo offers a more visual way to achieve similar automation. You would use nodes to:

  1. Select views.
  2. Create sheets (potentially with title block selection).
  3. Place views on sheets.
  4. Set sheet parameters (number, name, etc.).

Dynamo is generally easier to learn for basic automation tasks, while the Revit API provides more flexibility for complex scenarios.

Video Demonstration and Resources:

Searching YouTube for "Revit drawing automation" or "Revit API sheet creation" will yield numerous tutorials and demonstrations. Look for videos covering both the Revit API and Dynamo approaches.

Recommendation:

  • Start with Dynamo: If you're new to automation, Dynamo is a great starting point. You can quickly create simple scripts to automate basic drawing creation tasks.
  • Move to the Revit API: For more complex and customized workflows, learning the Revit API (C# or Python) is essential. This will give you complete control over the drawing creation process.

    

I hope this helps you get started with drawing sheet automation in Revit!

     

Let us know if you have more questions.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Reply
Reply
Message 3 of 5

sales7NF7D
Advocate
Advocate

Interesting, I will to looking into this further.  Would there be a way of running several scripts concurrently (ie multi threading) to speed up the process for very large drawing sets. 

Reply
Reply
0 Likes
Message 4 of 5

jeremy_tammik
Autodesk
Autodesk

Nope, not really. The Revit API is single threaded only. Non-Revit-API functionality can be multi-threaded, but the actual sheet creation requires Revit API calls and therefore cannot.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Reply
Reply
0 Likes
Message 5 of 5

TripleM-Dev.net
Advisor
Advisor

if you don't need to access the geometry on a sheet (for determining the position of a viewport) the creation of sheets and viewports on them is fast.

 

Depending on the views (cropped I assume), optimize the calculations without retrieving coordinates on the sheet/titleblock

Like, knowing how big the titleblock is / position of the sheet etc...

Reply
Reply
0 Likes