Exporting PCF Files from Revit 2018

Uncategorized
Assemblies in Revit 2018

Revit 2018.0 has the ability to generate Piping Component Files (PCF) files from fabrication level of detail piping models using a simple macro.   PCF files are used in the piping industry to automate a variety of process, such as stress analysis, generation of documentation (such as isometrics), and even to automate shop equipment.

The PCF creation engine in Revit 2018 is the same as what was historically in Autodesk Fabrication CADmep, and used by some users to generate isometrics.  As long as you are using Fabrication (ITM) based piping components in Revit, you can use a relatively simple macro to output the PCF file, which will include the pipe, fittings, valves, and hangers.  There are some limitations in our current output, for example, we’re not presently outputting fluid information or pipe wall thickness.

Here’s the scoop on how to create a PCF file from Revit.

Macro Creation

To create the macro, follow these steps:

  1. On the Manage tab > Macro panel > click Macro Manager.
  2. In the Macro Manager window:
    • Select the Application tab.
    • On the right side, under Module, click Create.
  3. In the Create a New Module window:
    • Enter the name MyPipingUtilities
    • Leave the Language as C#.
    • Click OK.
  4. In the Macro Manager window:
    • On the right side, under Module, click Macro
  5. In the Create a New Macro window:
    1. Enter the name ExportSelectionToPCF
    2. Click OK.
  6. The SharpDevelop macro editing environment will open.

You are now ready to write the associated code.

Writing the Code

There will be a pre-populated function block created as shown below.

  1. Between the curly braces, copy and paste the following code:
             Autodesk.Revit.DB.Fabrication.FabricationUtils.ExportToPCF(
                 this.ActiveUIDocument.Document, 
                 this.ActiveUIDocument.Selection.GetElementIds().ToList(), 
                 "C:\\temp\\somefile.pcf"); 

Your end result should look like the following:

That’s it! One line of code (well, four lines to improve readability).

  1. In the SharpDevelop menu.
    • Click Build > Build Solution
    • Click File > Exit
  2. Click Yes if prompted to save your changes.

The code will export the selected Pipe Fabrication Part elements to the filename indicated.  Feel free to refine this code to change the path or further modify to suit your workflow needs.

Testing the Functionality

Now, you can try it out!

  1. In a model with some Pipe Fabrication Parts.
    • Select the elements you want to output.
    • On the Manage tab > Macros panel > click Macro Manager
    • Select the Application tab
    • Expand (if necessary) the tree so you can select ExportSelectionToPCF under MyPipingUtilities.
    • Click Run.
  2. Verify that the file was created in the indicated location.

Sample Result

Once you have the PCF file generated, you can try it out in your targeted workflow.

I used the Plant 3D PCF to ISO feature to generate a single line isometric.

Here’s the original model in Revit.

Here’s the resulting isometric.

We would love to hear your feedback on this functionality, it will help us prioritize the refinement to achieve the workflows important to you.

See Part 2: Exporting PCF Files from Revit 2018 – Part 2 (Assemblies) to learn how to create a PCF file from Revit.



Martin Schmid

Martin Schmid joined Autodesk in 2005 as a project consultant for MEP customers, both for Revit MEP and AutoCAD MEP. Martin holds a BS in Architectural Engineering, and MS in Engineering from Kansas State University, and a Masters in Management of Technology from the University of Texas at San Antonio. He worked as an electrical designer, engineering coordinator, and application developer before joining Autodesk. Martin has co-authored books for Revit and AutoCAD MEP, and is a licensed engineer in the state of New Hampshire. Martin worked in the product globalization and customer success teams prior to joining the product management team, where he now guides direction related to the extended MEP product portfolio, including MEP functionality within Revit, CADmep, ESTmep, CAMduct, and AutoCAD Plant 3D. In his spare time, Martin enjoys reading, travelling, and attending his kids’ activities.

Try Revit free for 30 days

9 comments

  1. Avatar
    liviu simion

    Hi. Can the code be updated for each pipeline reference to be exported as separate PCF file? Very good job btw and very useful macro. Thanks for your support.

  2. Avatar
    ERIK LAMBRECHT

    I tried it and it does not work in 2022. I have same issue above, and can I request someone actually look into it or add this as a exporter to Revit.

  3. Avatar
    Nicolas Montecinos Silva

    Hi, My name is Nicolás. I`m new in programming on SharpDevelop, i have a doubt I`ve written the code as appears in the 1st part of the example (i´m going to do the 2nd part later )but it doesn´t work, the compiler says there is cero error, when ,i execute the macro everything seems to work fine, but it doesn´t create any PCF file in the specified directory, so, ¿How can i solve this problem?, Thanks.

  4. Avatar
    jinlee@plant3d.co.kr

    Hi Martin, This is great info. I have some questions. Looking at this site, https://knowledge.autodesk.com/support/revit-products/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to-export-valves-to-the-pcf-from-Revit.html There are steps decribed as below. 1. Before creating pcf file for valves, prepare mapping which allow transfer Revit MEP Families into MEP Fabrication Parts (valves, pipe/duct accessory) within Revit. 2. Exporting PCF Files from Revit 2018 3. Exporting PCF Files from Revit 2018 – Part 2 (Assemblies) Question 1. Do I have to do mapping for every family in CADMep? Question 2. I have to create spool drawings from Revit Piping Models. Can PCF files be used to create spool drawings in Plant 3D Iso (+spool option)? Question 3. For spool drawings, there are more fabrication and installation information to be added. Then, I have to use PCF to Pipe command to create 3D model and add those additional information (properties). Do you think it is possible?

  5. joshua.torrez

    Hello, I'm currently receiving the following error when I click "Build Solution" in SharpDevelop: Error CS1061: 'MyPipingUtilities.ThisDocument' does not contain a definition for 'ActiveUIDocument' and no extension method 'ActiveUIDocument' accepting a first argument of type 'MyPipingUtilities.ThisDocument' could be found (are you missing a using directive or an assembly reference?) Build failed. (00:00:00.4797229) What does this mean?

    1. Sylvia Knauer
      Sylvia Knauer

      Please make sure you have selected the Application tab as indicated in step 2.

  6. btaute

    Do you know if this macro still works with Revit 2019? It looks to run but no .pcf file is ever made.

    1. Sylvia Knauer
      Sylvia Knauer

      Yes, this macro should work just fine in 2019 using the MEP Fabrication Pipework category elements.

  7. Avatar
    Ricardo Cardial

    Congrats for this material. Excellent to attend workflows that still need isometric drawings

Add comment