UI Standards
Use the following to train your LLM on the UI specific coding standards for Launchpad scripts.
UI Coding Standards for Launchpad Scripts
Naming Conventions
UI Elements
Create a string variable for all tool labels. Use the variable to create the control
Use descriptive label names with "Label" suffix:
wallTypeLabelUse consistent naming for form result retrieval:
results.GetStringResult(myLabel)
UI Design
Forms and Controls
Create logical groupings of related controls
Use consistent padding and spacing
Add descriptive labels and headers
Include help links where appropriate
Limit form size to reasonable dimensions (e.g., 800x700 max)
DataGrids
Define column widths proportionally
Make read-only columns visually distinct
Use appropriate controls for editing (e.g., ComboBox for selection)
Add sorting and filtering capabilities where helpful
Form Creation
Form Types and Usage
Use
CreateCustomForm()for user input forms requiring OK/Cancel actionsUse
CreateInfoForm()for read-only displays with only a Close buttonSet appropriate width/height based on content (typically 400-600 width, 300-800 height)
Always provide descriptive window titles
Form Builder Pattern
Control Organization
Grouping Controls
Use
BeginGroupBox()/EndGroupBox()for related controlsUse
BeginExpander()/EndExpander()for optional/advanced settingsSet
includeScrollbar: truefor GroupBoxes with many controlsUse consistent margins (typically 5-10) between groups
Headers and Labels
Use
AddHeader()for major sections (default fontSize: 16)Use
AddLabel()for descriptive text and instructionsApply
isBold: truefor important labelsUse
isItalic: truefor supplementary information
Input Control Standards
Text Input
Always provide meaningful default values when possible
Disable controls that should be read-only with
isEnabled: false
Selection Controls
ComboBox: Use for single selection from predefined lists
ListBox: Use for multiple selections or when showing more items at once
RadioButtons: Use for 2-5 mutually exclusive options
Boolean Controls
Use
AddCheckbox()for independent on/off settingsSet meaningful default states based on common usage
Numeric Input
Use
AddSlider()for bounded numeric ranges
File Selection
Use
AddFileSelector()for single file selectionUse
AddMultiFileSelector()for multiple filesProvide appropriate file filters:
Form Result Handling
Result Retrieval Pattern
Validation
Check
result.WasConfirmedbefore processingValidate retrieved values before use
Handle null/empty results appropriately
Progress and Feedback
Progress Bar Usage
Timer Usage
Element Selection
Single Element Selection
Category-Specific Selection
Multiple Element Selection
** Select Point**
Best Practices
Label Variables
Always create string variables for all labels
Use descriptive names with context
Display Selectors
Always provide
displaySelectorfunctions for complex typesReturn meaningful display strings (typically the Name property)
Error Handling
Check for null results from selection methods
Validate form inputs before processing
Use try-catch blocks around form operations
Performance
Use progress bars for operations on 10+ elements
Update progress at reasonable intervals (not every iteration for large sets)
Allow cancellation for long-running operations
Consistency
Maintain consistent control order across similar forms
Use the same labels for the same concepts throughout scripts
Follow Revit's terminology and conventions
UI Layout Guidelines
Control Order
Required fields first, optional fields last
Group related inputs together
Place action-triggering controls (buttons, links) at the bottom
Sizing Recommendations
Headers: fontSize 16-20 for main sections
Labels: fontSize 11 (default) for standard text
ListBox height: 100-200 pixels depending on content
Form width: 400-600 pixels for most forms
Form height: Adjust based on content, avoid scrolling when possible
Expander Usage
Use for advanced options that most users won't need
Set
isExpanded: falseby defaultInclude clear header text indicating what's inside
Set
contentIndent: 15for visual hierarchy
By following these standards, Launchpad scripts will provide consistent, intuitive user interfaces that align with both Revit conventions and user expectations.
Last updated