PJ_NAME.lsp — Project Name Extraction & Panel Prefix Generation

Module: pj_name.lsp
Version: v3.60
Category: Project Management
Complexity: Medium
Size: 3.7 KB (91 lines)

Note

Project Naming Logic

This module extracts the project name from the current directory path and generates a panel name prefix by combining initial letters from words in the project name, excluding special characters.


Overview

Purpose

The pj_name function creates an abbreviated project identifier (panel prefix) from the full project directory name. This prefix is used as a default naming pattern for panels and drawings within the project.

Algorithm

  1. Extract Project Name from Directory

    ; Find last backslash in curdir
    ; Extract everything after it
    
  2. Generate Panel Prefix (pnlname)

    • Take first letter of project name

    • Add first letter after each space

    • Exclude special characters: [ ] { } * ^ % # @ / \ & “ ’ > < | ! ~ ( ) +`

    • Maximum 5 characters

  3. Fallback Logic

    • If less than 3 characters: Use all non-special characters

    • Truncate to 5 characters if longer


Examples

Example 1: Multi-Word Project

Input: C:\Project Files\ABC Manufacturing Plant\
Output:

  • pjname = “ABC Manufacturing Plant”

  • pnlname = “AMP” (A + M + P)

Example 2: Single Word Project

Input: C:\Project Files\Hospital\
Output:

  • pjname = “Hospital”

  • pnlname = “Hospi” (first 5 chars)

Example 3: Special Characters

Input: C:\Project Files\Smith & Jones (2024)\
Output:

  • pjname = “Smith & Jones (2024)”

  • pnlname = “SJ2” (S + J + 2, excluding & ( ))


Global Variables

Input:

  • curdir - Current project directory path

Output:

  • pjname - Full project name

  • pnlname - 5-character panel prefix

  • olddir - Saved copy of curdir


Character Filtering

Excluded Characters (Special):

[ ] { } * ^ % # ` @ / \ & " ' > < | ! ~ ( ) + space

Reason: These characters are invalid or problematic in AutoCAD block/layer names.


Document Metadata

Status: Comprehensive analysis
Last Updated: 2026-01-20


End of Document