SGCpack

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Modeling function
Introduced first in SolidGeometry 1.1, Creation date: 2013-07-16, Last change: 2025-09-14

packs several solids side by side

Description

Arranges several individual solids side by side to prepare a joint 3D print job

See Also: SGClayout

Example Illustration

 missing image of SGCpack(SG,B,n)

Syntax

SG=SGCpack(SG,B,[n])

Input Parameter

SG: solid geometry collector, could be empty
B: solid (VL,FL)
n: number of added parts

Output Parameter

SG: solid geometry collector

Examples

Generate 10 Boxes in a row for 3D print
A=SGbox ([10 10 20]); B=SGbox ([10 10 10]);
C=SGCpack ([],A,3); C=SGCpack (C,B,2);
SGplot (C), show
SGCpack([],SGsample(17),5)




Copyright 2013-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm is designed to arrange multiple solid geometries side by side, preparing them for a joint 3D print job. The function SGCpack takes in a solid geometry collector, a solid, and an optional number of parts to add.

Input Parameters

Output

Algorithm Steps

  1. Check if B is not a cell array. If it is not, proceed with the following steps:
  2. Initialize maxs as [150, 30, 150] and sx as 1.
  3. Calculate the bounding box of B using BBofVL.
  4. Determine the number of parts n to add, defaulting to 1 if not specified.
  5. For each part to be added (from 1 to n):
  6. If B is a cell array, iterate over each element and recursively call SGCpack for each solid.
  7. If no output is expected, plot the solid geometry using SGplot and display the bounding list.
Algorithm explaination created using ChatGPT on 2025-08-19 07:48. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21