SGcopypatternXYZ

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SG/Solids
Introduced first in SolidGeometry 4.9, Creation date: 2020-08-16, Last change: 2025-09-14

returns a cell list of xyz copies or a fused solid of SG

Description

was existing by Lauren de Smedt as SGpatternXYZ but forgotten and implemented from SGofCPLcommand

See Also: SGboxing , SGpatternRotz , SGcopyrotZ , SGarrangeSG , SGarrangeSGC , SGCaddSGn , SGCaddSG , SGstackn , SGcopyVL , SGsurfaces

Example Illustration

 missing image of SGcopypatternXYZ(SG,cp,dd,fuse)

Syntax

SG=SGcopypatternXYZ(SG,[cp,dd,fuse])

Input Parameter

SG: Solid Geometry
cp: number of copies in [x y z]
dd: distance between the copies
fuse: if true; SG is struct not cell; default is true

Output Parameter

SG: cell list of SG

Examples

Create copies at ten random positions
SGcopypatternXYZ(SGcylinder,[1 1 3],4)
SGcopypatternXYZ(SGcylinder,[1 1 3],4,true)




Copyright 2020-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 function, SGcopypatternXYZ, is designed to create multiple copies of a given solid geometry (SG) in a 3D space, based on specified parameters. It can return either a cell list of these copies or a fused solid.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the number of copies (cp), distance (dd), and fuse option from the input parameters using the function getfuncparams.
  2. Determine the number of copies in each direction (nx, ny, nz) based on the length of the cp vector. If cp has fewer than 3 elements, default values are used.
  3. Calculate the bounding box size of the solid geometry using BBofSG and sofBB, and add the specified distance (dd) to this size.
  4. Create a mesh grid of vectors (VL) for the positions of the copies using VLmeshgrid, based on the number of copies and the adjusted bounding box size.
  5. Generate the copies of the solid geometry at the specified positions using SGcopyVL, with the option to fuse them based on the 'fuse' parameter.
  6. If no output is requested, visualize the result using SGfigure and plot the copies with either SGplotcell or SGplotalpha, depending on whether the result is a cell or a fused structure.
Algorithm explaination created using ChatGPT on 2025-08-19 08:02. (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