Group Objects

Organize your designs with groups and child imports for better structure and reusability.

What are Groups?

Groups in STL.Show allow you to organize related objects together, create hierarchical designs, and reference other objects in your JSCAD code. This enables modular design, better organization, and the ability to build complex assemblies from reusable components.

Organization

Group related objects together for better structure

Reusability

Reference objects across multiple designs

Hierarchy

Create complex assemblies with nested components

Creating Groups

Groups are created in the STL.Show interface and can contain multiple objects, including other groups.

Creating a Group

Steps

  1. 1. Select the objects you want to group
  2. 2. Right-click and choose "Group Objects"
  3. 3. Enter a name for the group
  4. 4. The group appears in the object browser
  5. 5. Objects can be added/removed from the group

Group Properties

  • Name - Unique identifier for the group
  • Description - Optional description
  • Visibility - Show/hide entire group
  • Transform - Move/rotate/scale entire group
  • Export - Export group as separate file

Managing Groups

Group Operations

  • Rename - Change group name
  • Duplicate - Copy entire group
  • Delete - Remove group and contents
  • Ungroup - Remove group, keep objects
  • Nest - Create groups within groups

Object Operations

  • Add Objects - Drag objects into group
  • Remove Objects - Drag objects out of group
  • Reorder - Change object order in group
  • Select All - Select all objects in group
  • Transform - Transform all objects together

Child Imports

Child imports allow you to reference other objects in your JSCAD code, creating dynamic relationships between different parts of your design.

What are Child Imports?

Child imports let you reference other objects (STL files, JSCAD code, or groups) directly in your JSCAD code. This creates a parent-child relationship where changes to the child object automatically update the parent.

Benefits

  • Modular Design - Build complex assemblies
  • Automatic Updates - Changes propagate automatically
  • Reusability - Use same part in multiple designs
  • Version Control - Track changes across objects

Use Cases

  • Assemblies - Combine multiple parts
  • Templates - Reuse common components
  • Iterations - Build on previous designs
  • Collaboration - Share components with team

Creating Child Imports

Step 1: Add Child Import

// In your JSCAD code object
// Add this at the top of your file
const childImports = {
  'base-plate': 'base-plate-group',
  'fasteners': 'fasteners-group'
}

Step 2: Use in Main Function

function main(params) {
  // Access child objects
  const basePlate = childImports['base-plate']
  const fasteners = childImports['fasteners']
  
  // Use in your design
  return union(
    basePlate,
    translate([0, 0, 10], fasteners)
  )
}

Note: Child imports are automatically updated when the referenced objects change.

Child Import Syntax

Object References

const childImports = {
  // Reference by object name
  'my-part': 'my-part-object',
  
  // Reference by group name
  'assembly': 'assembly-group',
  
  // Reference by file name
  'template': 'template-file.stl'
}

Usage Patterns

function main(params) {
  // Direct use
  const part = childImports['my-part']
  
  // With transformations
  const transformed = translate([10, 0, 0], part)
  
  // Multiple parts
  const assembly = union(
    childImports['part1'],
    childImports['part2'],
    childImports['part3']
  )
  
  return assembly
}

Advanced Group Features

Advanced techniques for working with groups and child imports.

Nested Groups

Create hierarchical structures by nesting groups within groups.

Structure Example

// Main Assembly
├── Base Group
│   ├── Base Plate
│   └── Mounting Holes
├── Motor Group
│   ├── Motor Housing
│   ├── Shaft
│   └── Bearings
└── Electronics Group
    ├── Circuit Board
    ├── Connectors
    └── Heat Sink

Benefits

  • Organization - Logical grouping of components
  • Selective Visibility - Show/hide entire subsystems
  • Transform Control - Move entire assemblies
  • Export Options - Export specific subsystems

Conditional Child Imports

Use parameters to conditionally include different child objects.

function getParameterDefinitions() {
  return [
    {name: 'version', type: 'choice', values: ['basic', 'pro'], 
     captions: ['Basic Version', 'Pro Version'], initial: 'basic', caption: 'Version'}
  ]
}

function main(params) {
  const childImports = {
    'basic-parts': 'basic-parts-group',
    'pro-parts': 'pro-parts-group'
  }
  
  if (params.version === 'basic') {
    return childImports['basic-parts']
  } else {
    return union(
      childImports['basic-parts'],
      childImports['pro-parts']
    )
  }
}

Tip: Use conditional imports to create different versions of your design.

Group Transformations

Apply transformations to entire groups and their child imports.

In JSCAD Code

function main(params) {
  const childImports = {
    'assembly': 'main-assembly-group'
  }
  
  // Transform entire assembly
  return translate([0, 0, params.height], 
    rotate([0, 0, params.rotation], 
      childImports['assembly']
    )
  )
}

In Interface

  • Select Group - Click on group in browser
  • Transform Controls - Use 3D transform gizmo
  • Numeric Input - Enter exact values
  • Copy Transform - Apply to other groups
  • Reset Transform - Return to original position

Complete Example: Modular Robot

A comprehensive example showing how to use groups and child imports to create a modular robot design.

// Main robot assembly
const childImports = {
  'base': 'robot-base-group',
  'body': 'robot-body-group', 
  'arms': 'robot-arms-group',
  'head': 'robot-head-group',
  'wheels': 'robot-wheels-group'
}

function getParameterDefinitions() {
  return [
    {name: 'includeArms', type: 'checkbox', checked: true, caption: 'Include Arms'},
    {name: 'includeHead', type: 'checkbox', checked: true, caption: 'Include Head'},
    {name: 'wheelType', type: 'choice', values: ['small', 'large'], 
     captions: ['Small Wheels', 'Large Wheels'], initial: 'small', caption: 'Wheel Type'},
    {name: 'bodyHeight', type: 'number', initial: 20, min: 10, max: 50, caption: 'Body Height'}
  ]
}

function main(params) {
  // Start with base
  let robot = childImports['base']
  
  // Add body with height parameter
  const body = translate([0, 0, params.bodyHeight], childImports['body'])
  robot = union(robot, body)
  
  // Conditionally add arms
  if (params.includeArms) {
    const leftArm = translate([-15, 0, params.bodyHeight + 10], childImports['arms'])
    const rightArm = translate([15, 0, params.bodyHeight + 10], childImports['arms'])
    robot = union(robot, leftArm, rightArm)
  }
  
  // Conditionally add head
  if (params.includeHead) {
    const head = translate([0, 0, params.bodyHeight + 25], childImports['head'])
    robot = union(robot, head)
  }
  
  // Add wheels based on type
  const wheelGroup = params.wheelType === 'small' ? 
    childImports['wheels'] : 
    scale([1.5, 1.5, 1.5], childImports['wheels'])
  
  const leftWheels = translate([-10, 0, 0], wheelGroup)
  const rightWheels = translate([10, 0, 0], wheelGroup)
  robot = union(robot, leftWheels, rightWheels)
  
  return robot
}
1

Create component groups

2

Define child imports

3

Add conditional logic

4

Assemble with transforms

Best Practices

Guidelines for effective use of groups and child imports.

Group Organization

  • • Use descriptive, hierarchical names
  • • Group related components together
  • • Keep groups at reasonable sizes
  • • Use consistent naming conventions

Child Import Management

  • • Reference objects by clear names
  • • Handle missing imports gracefully
  • • Use conditional imports for variants
  • • Document import dependencies

Performance Considerations

  • • Avoid deeply nested groups
  • • Limit number of child imports
  • • Use groups for organization, not just decoration
  • • Consider export requirements

Collaboration

  • • Share common component groups
  • • Document group purposes and contents
  • • Use consistent group structures
  • • Version control group changes

Ready to Organize Your Designs?

Now that you understand groups and child imports, explore these advanced topics: