Basic Patterns

Building Blocks

CREATE BOX ORIGIN 0 0 0 SIZE 100 50 HEIGHT 75
CREATE CIRCLE CENTER 0 0 0 RADIUS 50 NORMAL 0 0 1
CREATE LINE FROM 0 0 0 TO 100 0 0

Common Patterns

Circular Patterns

// Create base hole
CREATE CIRCLE CENTER 40 0 0 RADIUS 5 NORMAL 0 0 1
CREATE PRISM SECTION [previous-circle] LENGTH 10

// Pattern around center
CREATE REVOLVE PROFILE [previous-hole] 
AXIS ORIGIN 0 0 0 DIRECTION 0 0 1 ANGLE 360

Linear Arrays

// Create base feature
CREATE RECTANGLE ORIGIN 0 0 0 SIZE 20 20
CREATE PRISM SECTION [previous-rectangle] LENGTH 10

// Create linear pattern
CREATE SWEEP PROFILE [previous-prism] 
PATH [CREATE LINE FROM 0 0 0 TO 200 0 0]

Organization Patterns

Folder Structure

// Create main assembly folder
CREATE FOLDER NAME "Main Assembly"

// Create component folders
CREATE FOLDER NAME "Base Components"
CREATE FOLDER NAME "Features"
CREATE FOLDER NAME "Patterns"

Component Building

// Base structure
CREATE BOX ORIGIN 0 0 0 SIZE 100 100 HEIGHT 50

// Features
CREATE CIRCLE CENTER 50 50 0 RADIUS 20 NORMAL 0 0 1
CREATE PRISM SECTION [previous-circle] LENGTH 50

// Combine
CREATE BOOLEAN CUT 
FIRST [base-box] 
SECOND [hole-prism]

Best Practices

1. Structure Your Code

  • Group related operations
  • Use clear naming
  • Add comments for complex operations

2. Build Parametrically

// Define key dimensions
CREATE BOX ORIGIN 0 0 0 
SIZE [width] [length] 
HEIGHT [height]

// Reference existing geometry
CREATE CIRCLE CENTER [width/2] [length/2] 0 
RADIUS [hole_diameter/2] 
NORMAL 0 0 1

3. Error Prevention

// Validate dimensions
if width < minimum_width:
    show error "Width too small"

// Check relationships
if hole_diameter > width:
    show error "Hole larger than part"

Advanced Patterns

Complex Geometry

// Create profile
CREATE WIRE EDGES 
[CREATE LINE FROM 0 0 0 TO 100 0 0] AND
[CREATE ARC CENTER 100 50 0 START 100 0 0 NORMAL 0 0 1 ANGLE 180] AND
[CREATE LINE FROM 100 100 0 TO 0 100 0] AND
[CREATE LINE FROM 0 100 0 TO 0 0 0]

// Create solid
CREATE PRISM SECTION [previous-wire] LENGTH 50

Reusable Components

// Define component
CREATE FOLDER NAME "Standard Holes"

// Create template
CREATE CIRCLE CENTER x y z RADIUS r NORMAL nx ny nz
CREATE PRISM SECTION [previous-circle] LENGTH l

// Save for reuse
SAVE AS "Through Hole Template"

Performance Tips

1. Optimize Operations

  • Combine similar operations
  • Reduce boolean operations
  • Use patterns instead of individual features

2. Memory Management

  • Clean up temporary geometry
  • Use folders for organization
  • Reference existing features when possible

When creating complex patterns, test with a small number of iterations first before scaling up.

Debugging Strategies

Common Issues

  1. Geometry Fails

    • Check input parameters
    • Verify relationships
    • Ensure valid operations
  2. Performance Problems

    • Reduce operation complexity
    • Use efficient patterns
    • Clean up unused features

Keep your scripts modular and well-commented. This makes debugging and modifications much easier later.

Examples

Parametric Flange

// Base parameters
SET flange_diameter = 100
SET hole_count = 6
SET hole_diameter = 8

// Create base
CREATE CIRCLE CENTER 0 0 0 
RADIUS [flange_diameter/2] 
NORMAL 0 0 1
CREATE PRISM SECTION [previous-circle] LENGTH 10

// Create hole pattern
CREATE CIRCLE CENTER [flange_diameter*0.4] 0 0 
RADIUS [hole_diameter/2] 
NORMAL 0 0 1
CREATE PRISM SECTION [previous-circle] LENGTH 10
CREATE REVOLVE PROFILE [previous-hole] 
AXIS ORIGIN 0 0 0 DIRECTION 0 0 1 ANGLE 360

Test your scripts with different parameters to ensure they work across a range of values.