plotruler4SG

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.2, Creation date: 2022-06-01, Last change: 2025-09-15

creates dimensions on the outside of a geometric body



See Also: plotruler4SG , plotrulerline , SGruler

Example Illustration

 missing image of plotruler4SG(SG)

Syntax

h=plotruler4SG([SG])

Input Parameter

SG: Solid geometry for displaying scales

Output Parameter

h: handles to ruler

Examples


SGfigure(-30,30); SGplotalpha(SGbox); plotruler4SG;
SGfigure(-30,30); SGplotalpha(SGsample(17)); plotruler4SG(SGsample(17));




Copyright 2022-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, plotruler4SG, is designed to create dimension lines (rulers) on the outside of a geometric body. It is part of the SolidGeometry library and was introduced in version 5.2.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by retrieving the solid geometry object SG from the input parameters. If SG is not provided, it defaults to the current geometry in the active axes.
  2. It sets a ruler ratio rr to 0.05, which might be used for scaling or positioning the rulers.
  3. The function sofBB is called with SG to obtain several parameters: s, ss, cp, and bb. These likely represent size, scale, center point, and bounding box of the geometry.
  4. Coordinates for the start and end of the rulers are calculated using the bounding box bb and scale ss.
  5. An empty array h is initialized to store handles to the ruler lines.
  6. Three ruler lines are plotted using the plotrulerline function, which takes start and end points as arguments. These lines are added to the h array.
  7. Unique x, y, and z coordinates are extracted from the vertex list SG.VL.
  8. The z-coordinates are rounded and filtered to ensure a minimum distance del of 2.0 between them. This is done using a loop that accumulates distances and selects points that meet the criteria.
  9. The filtered z-coordinates are used to create a set of points PL for additional ruler lines.
  10. Additional ruler lines are plotted between consecutive points in PL and added to the h array.
  11. The axis limits are adjusted using the BBgrow function to ensure all rulers are visible, with a growth factor of 2.2.
Algorithm explaination created using ChatGPT on 2025-08-19 08:21. (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