Table of Contents

Organize Foundation Types

The Organize Foundation Types tool standardizes naming conventions and type marks for structural foundation elements. It processes pier and footing family types to ensure consistent naming patterns and eliminates duplicate types by merging instances.

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/OrganizeFoundationTypesCommand.cs:12-57


Overview

This tool automates the tedious process of organizing foundation type names and type marks in Revit models. It:

  1. Renames types using standardized dimension-based naming (e.g., 3'-0"x3'-0" (P-1))
  2. Assigns type marks with prefixes specific to each foundation category
  3. Merges duplicate types that have identical dimensions, consolidating instances

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:12-14


Supported Foundation Categories

The tool processes four categories of foundation elements:

Category Family Name Revit Category Type Mark Prefix Sort Criteria
Foundation Piers Foundation Pier Structural Columns P Section area (b x h)
Round Piers Foundation Pier - Round Structural Columns RP Diameter (d)
Rectangular Footings Footing-Rectangular Structural Foundation F Width, Length, Thickness
Pile Caps Pile Cap-Rectangular Structural Foundation CAP Width, Length, Thickness

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:39-42


Features

Type Mark Generation

Type marks are generated with predictable formats that support efficient scheduling and tagging:

Pier/Round Pier Format: {PREFIX}-{counter}

  • Examples: P-1, P-2, RP-1, RP-2

Footing/Pile Cap Format: {PREFIX}-{widthFeet}.{counter}

  • Examples: F-3.0, F-3.1, CAP-4.0, CAP-4.1

The generator automatically finds the next available mark, filling gaps in sequences when possible.

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/TypeMarkGenerator.cs:22-64

Type Naming Conventions

After processing, types are renamed to include dimensions and type mark:

Foundation Type Naming Pattern Example
Foundation Pier {b}x{h} ({mark}) 2'-6"x2'-6" (P-1)
Round Pier {d} DIA. ({mark}) 2'-0" DIA. (RP-1)
Footing / Pile Cap {width}x{length}x{thickness} ({mark}) 3'-0"x3'-0"x1'-0" (F-3.0)

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:127-129,197-198,276

Duplicate Type Merging

When multiple types share identical dimensions, the tool:

  1. Identifies duplicate types based on dimension parameters
  2. Moves all instances from duplicate types to the primary type
  3. Deletes the now-empty duplicate types

This reduces model clutter and ensures consistent type usage.

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:96-107,170-179,243-254

Overwrite Protection

On execution, users are prompted whether to overwrite existing type marks:

  • Yes: All type marks are regenerated, ensuring consistent sequential numbering
  • No: Existing type marks are preserved; only types without marks receive new ones

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/OrganizeFoundationTypesCommand.cs:26-29


Architecture

Component Structure

OrganizeFoundationTypes/
  Features/
    OrganizeFoundationTypesCommand.cs  -- Revit external command entry point
    FoundationTypeOrganizer.cs         -- Core processing logic
    TypeMarkGenerator.cs               -- Type mark generation (pure logic, testable)
  OrganizeFoundationTypesToolModule.cs -- DI module registration
  manifest.yml                         -- Ribbon and command configuration

Class Responsibilities

Class Responsibility
OrganizeFoundationTypesCommand Entry point; prompts user, invokes organizer, displays results
FoundationTypeOrganizer Collects types, processes each category, merges duplicates
TypeMarkGenerator Pure static logic for generating unique type marks

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/OrganizeFoundationTypesCommand.cs:16, src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:15, src/Tools/Structural/OrganizeFoundationTypes/Features/TypeMarkGenerator.cs:11

Transaction Strategy

The organizer runs multiple transactions to isolate changes by category:

  1. DB Tools - Organize Foundation Pier Types (rectangular piers)
  2. DB Tools - Organize Round Pier Types (round piers)
  3. DB Tools - Organize Footing Types (footings and pile caps)

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:48-62

Dependencies

  • DBTools.Core - Base infrastructure, transactions, logging, alerts
  • ricaun.Revit.UI.Tasks - Async UI task handling

Source: src/Tools/Structural/OrganizeFoundationTypes/DBTools.Structural.OrganizeFoundationTypes.csproj:35-44


Manifest Configuration

id: DBTools.Structural.OrganizeFoundationTypes
assembly: DBTools
moduleType: DBTools.Structural.OrganizeFoundationTypes.OrganizeFoundationTypesToolModule
order: 0
tool:
  ribbonTools:
    - internalName: DBTools.OrganizeFoundationTypes
      commandType: DBTools.Structural.OrganizeFoundationTypes.OrganizeFoundationTypesCommand
      availabilityType: DBTools.App.Tools.Availability.DbtDocumentAvailability
      runProfile: InlineUi
      displayText: "Organize Foundation\nTypes"
      iconBaseKey: organize_types
      tooltip: "Organize foundation types for tagging"
      controlKind: SplitButtonItem
      splitGroup: foundation_tags
      order: 2

Source: src/Tools/Structural/OrganizeFoundationTypes/manifest.yml:1-16

Ribbon Placement

The tool appears in the Foundation Tags split button group alongside:

Order Tool Description
0 Update Combined Foundation Tags Updates tag instances
1 Move Combined Foundation Tags Repositions tags
2 Organize Foundation Types This tool

Source: src/Tools/Structural/FoundationTags/manifest.yml:20-39, src/Tools/Structural/OrganizeFoundationTypes/manifest.yml:14-16

Availability

  • Availability Class: DbtDocumentAvailability
  • Requirement: An open Revit document (no active view requirement)

Settings

This tool has no configurable settings. All behavior is determined by the dimension parameters of the foundation types in the model.


Parameter Requirements

The tool reads specific parameters from each family type:

Foundation Pier (Foundation Pier)

Parameter Type Description
b Length Pier width dimension
h Length Pier depth dimension
Type Mark Text Assigned type mark

Round Pier (Foundation Pier - Round)

Parameter Type Description
d Length Pier diameter
Type Mark Text Assigned type mark

Footing / Pile Cap

Parameter Type Description
Width Length Footing width
Length Length Footing length
Foundation Thickness Length Footing depth
Type Mark Text Assigned type mark

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:92-93,167,238-240


Processing Logic

Pier Types (Rectangular)

  1. Collect all FamilySymbol instances from OST_StructuralColumns where family name is Foundation Pier
  2. Sort by section area (ascending)
  3. For each type:
    • Check for duplicate (same b and h values)
    • If duplicate found: merge instances to existing type, mark for deletion
    • Otherwise: assign type mark (respecting overwrite setting), rename type
  4. Delete merged duplicate types

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:79-151

Round Pier Types

  1. Collect all FamilySymbol instances from OST_StructuralColumns where family name is Foundation Pier - Round
  2. Sort by diameter (ascending)
  3. For each type:
    • Check for duplicate (same d value)
    • If duplicate found: merge instances, mark for deletion
    • Otherwise: assign type mark, rename with {d} DIA. ({mark}) format
  4. Delete merged duplicate types

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:154-218

Footing and Pile Cap Types

  1. Collect all FamilySymbol instances from OST_StructuralFoundation where family name matches
  2. Sort by Width, then Length, then Foundation Thickness (ascending)
  3. For each type:
    • Check for duplicate (same Width, Length, and Foundation Thickness)
    • If duplicate found: merge instances, mark for deletion
    • Otherwise: assign footing-format type mark, rename with dimensions
  4. Delete merged duplicate types (best-effort, silently continues on failure)

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:221-293


Error Handling

  • Individual type processing failures are logged at DEBUG level and skipped
  • Type deletion failures are logged at WARNING or ERROR level
  • Footing type deletions use best-effort (silently continue if deletion fails, as type may be in use elsewhere)
  • The command displays a summary dialog showing counts of renamed and merged types

Source: src/Tools/Structural/OrganizeFoundationTypes/Features/FoundationTypeOrganizer.cs:132-136,146-150,203-205,214-217,279-282,289-291


Testing

Unit tests for the TypeMarkGenerator class verify:

  • Sequential mark generation (P-1, P-2, P-3...)
  • Gap filling in mark sequences
  • Width-based footing mark format (F-3.0, F-3.1...)
  • Null/invalid input handling
  • Multiple prefix independence

Source: src/Tools/Structural/OrganizeFoundationTypes/Tests/TypeMarkGeneratorTests.cs:1-346


Integration with Foundation Tags

This tool is designed to work with the Combined Foundation Tags workflow:

  1. Run Organize Foundation Types to standardize type names and marks
  2. Use Update Combined Foundation Tags to update tag values
  3. Use Move Combined Foundation Tags to position tags

The tools share a common warning system - if a warning is active on the structural.foundation_tags settings pack, all three tools are disabled until the warning is cleared.

Source: src/Tools/Structural/FoundationTags/manifest.yml:12-18