-
-
Notifications
You must be signed in to change notification settings - Fork 913
Description
Feature Request: Add Plugin Slot for Top/Bottom Surface Pattern Generation
Summary
Add a new plugin slot (e.g., Slot 202: SKIN_GENERATE) to enable custom top/bottom surface patterns via plugins, similar to how Slot 200 (INFILL_GENERATE) works for body infill patterns.
Problem Statement
Currently, the CuraEngine plugin system only supports custom infill patterns for body infill through Slot 200 (INFILL_GENERATE). Top and bottom surface patterns (top_bottom_pattern, roofing_pattern) are hardcoded to three options: "lines", "concentric", and "zigzag".
This limitation prevents plugin developers from:
- Creating decorative surface patterns (Hilbert curves, Archimedean spirals, geometric tiles)
- Implementing space-filling curves for top/bottom surfaces
- Offering users more aesthetic and functional surface pattern options
Current Workaround
Users must set infill_density: 100% and top_layers: 0 to force the top surface to use custom infill patterns. This is inefficient and prevents proper infill/surface separation.
Proposed Solution
Add a new plugin slot for surface pattern generation:
Slot 202: SKIN_GENERATE
- Purpose: Generate custom patterns for top/bottom surfaces
- gRPC Service:
SkinGenerateService(similar to existing proto file atskin/v0/skin.proto) - Settings Integration: Apply to
top_bottom_pattern,roofing_pattern,top_bottom_pattern_0,bottom_pattern_initial_layer
Implementation Approach
-
Define new slot ID in
slot_id.proto:SKIN_GENERATE = 202; // Generate skin (top/bottom surface) patterns -
Route surface pattern requests to plugins when custom patterns are registered via
extend_category() -
Allow plugins to return empty responses to fall back to built-in patterns (same as Slot 200 behavior)
Use Cases
1. Decorative Top Surfaces
- Print Hilbert curves, Archimedean spirals, or geometric patterns on top surfaces
- Create visually appealing prints without post-processing
- Enable artistic/customized prints
2. Functional Surface Patterns
- Space-filling curves for better surface strength
- Custom patterns optimized for specific materials
- Pattern variations for different print requirements
3. Plugin Ecosystem Growth
- Enables community-developed surface pattern plugins
- Consistent with existing plugin architecture (Slot 200)
- Reuses proven gRPC infrastructure
Technical Details
Existing Infrastructure
- Proto file already exists:
skin/v0/skin.protodefinesSkinModifyService - Pattern registration via Python:
definition.extend_category(pattern_key, pattern_label) - gRPC slot system: Well-established pattern with Slot 200
Required Changes
- Add
SKIN_GENERATE = 202to slot_id enum - Create
SkinGenerateServiceproto definition (or extend existingskin.proto) - Route
top_bottom_patternsetting to plugin when custom pattern registered - Handle empty responses as fallback to built-in patterns
Backward Compatibility
- No breaking changes - existing hardcoded patterns continue to work
- Plugins opt-in by registering custom patterns
- Falls back gracefully if plugin doesn't support pattern
Example Plugin Implementation
A plugin could register patterns like:
for pattern_key in ["top_bottom_pattern", "roofing_pattern"]:
for definition in container.findDefinitions(key=pattern_key):
for pattern in self.getSpaceFillingPatterns():
definition.extend_category(
pattern[0],
pattern[1],
plugin_id=self.getPluginId(),
plugin_version=self.getVersion()
)Pattern examples:
- Hilbert Curve
- Archimedean Chords
- Octagram Spiral
- Flower of Life (tiled geometric)
- Custom user-defined patterns
Benefits
- User Experience: More creative control over print aesthetics
- Plugin Ecosystem: Enables new plugin development opportunities
- Consistency: Aligns with existing Slot 200 architecture
- Flexibility: Community can experiment with surface patterns without forking CuraEngine
Related Work
- Slot 200 (INFILL_GENERATE) demonstrates successful plugin-based pattern generation
- Proto file
skin/v0/skin.protoexists but not connected to any slot - Community interest in decorative surface patterns (PrusaSlicer, SuperSlicer have similar features)
Alternatives Considered
- Modify CuraEngine source directly - Requires forking and doesn't benefit community
- Use 100% infill workaround - Inefficient and loses infill/surface separation
- Post-process G-code - Complex, error-prone, loses CuraEngine optimizations
References
- Current plugin system: Slot 200 (INFILL_GENERATE)
- Existing proto:
cura/plugins/slots/skin/v0/skin.proto - Slot ID definitions:
cura/plugins/v0/slot_id.proto - Example plugin: CuraEngineTiledInfill (demonstrates pattern plugin architecture)