FrymasterVB/CMDPROC.BAS.md

121 lines
3.6 KiB
Markdown
Raw Permalink Normal View History

2025-01-08 17:02:29 -06:00
# CMNDPROC.BAS Documentation
## Overview
CMNDPROC.BAS is a Visual Basic module that handles command processing for a CAD/drawing file management system. It manages file operations, printing, and communication between different parts of the system.
## Global Variables
### File Location Variables
- `Place$`, `Lpt$`, `PrinterGroup$`, `Tray$`, `Limits$` - Arrays storing printer and location info
- `NetWPath$` - Network path for shared files
- `EngrDrive$` - Engineering drawings drive path
- `IEDrive$` - Industrial Engineering drive path
- `temppath$` - Temporary file path
### Message/Queue Files
- `COMPLETE$` - Complete queue file
- `INCOME$` - Incoming queue file
- `Reply$` - Reply queue file
- `MessageFileName$` - Message file name
- `MessageLogName$` - Log file name
## Key Subroutines
### StartSystem()
Main processing loop that:
- Monitors incoming command queue
- Processes commands
- Generates replies
- Handles file operations
### AddHeaders()
Adds print headers to PostScript files including:
- Job information
- Page setup
- User details
### PrintPSFile()
Handles printing PostScript files:
- Adds headers
- Sends to printer queue
- Monitors print completion
### File Operations
- `MoveIN()` - Moves files into system
- `MoveOUT()` - Moves files out to users
- `CopyIt()` - Copies drawing files
- `DeleteIt()` - Deletes files
- `SaveRev()` - Saves drawing revisions
### Support Functions
- `LoadPrinters()` - Loads printer configurations
- `LoadPlot()` - Loads plotter settings
- `LoadSubDirs()` - Loads subdirectory mappings
- `Messages()` - Logs messages
- `PrintLog()` - Prints to log file
## Command Types
- P - Print drawing
- R - Reference drawing
- O - Check out drawing
- I - Check in drawing
- B - Move back drawing
- Y - Copy drawing
- E - Move to IE
- W - Print wiring diagram
- T - Print text file
## File Types Handled
- AutoCAD (.DWG)
- Pro/E (.PLT, .DRW, etc)
- PDF files
- PostScript files
- Text/INI files
- Altium files
- SolidWorks files
- Menu folders
## Error Handling
- Error codes returned in replies
- Logging of errors
- Retry mechanisms for file operations
- File locking detection
## Configuration Files
- PRINTER.CFG - Printer definitions
- PLOT.CFG - Plotter settings
- SUBS.CFG - Subdirectory mappings
- ExternalUsers.txt - External user mappings
## Communication
- Uses file-based queues for commands
- Reply messages for status
- Watchdog timer monitoring
- Process synchronization
CMNDPROC.BAS is the main module that contains the core business logic and processing functionality, while Cmdproc-1.frm through Cmdproc-6.frm are the form modules that provide the user interface components:
1. CMNDPROC.BAS:
- Contains all the core functions for file operations, command processing, and system management
- Handles the actual processing of commands and file operations
- Manages communication between components
- Contains global variables and configuration settings
2. Form Relationships:
- Cmdproc-1.frm: Main interface form that displays status, logs, and controls
- Cmdproc-2.frm: Handles printer and plotter configuration interface
- Cmdproc-3.frm: Manages file viewing and selection interface
- Cmdproc-4.frm: Provides command entry and monitoring interface
- Cmdproc-5.frm: Shows system status and diagnostic information
- Cmdproc-6.frm: Contains settings and configuration interface
The forms access the functions and variables in CMNDPROC.BAS to:
- Display status information
- Trigger command processing
- Show operation results
- Configure system settings
- Monitor system state
CMNDPROC.BAS acts as the central processing module while the forms provide the UI layer for user interaction with the system.