SGwriteSTLplot

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Import/Export
Introduced first in SolidGeometry 5.1, Creation date: 2021-05-06, Last change: 2025-09-15

just a combination of SGwriteSTL and SGTplotalpha

Description

For many mechanisms, there are 4 different ways to assemble the final mechanism from 4 links, but only one of these 4 ways will produce the desired motion. This requires a picture of the correct assembly.

See Also: SGwriteSTL , SGTplotalpha , gcasnapshot

Example Illustration

 missing image of SGwriteSTLplot(SG,sname)

Syntax

fnames=SGwriteSTLplot(SG,[sname])

Input Parameter

SG: Solid Geometry to write as STL
sname: filename for STL file and PNG file

Output Parameter

fnames: filename of STL file

Examples


SGwriteSTLplot(SGbox,'test')
fourBarposesyntheses(Posesample(26),[1 3 ],[20],'','','isrot, break coll CPLW CPL0, extend CPLM, break length CPL0 < 120'); PS=ans;




Copyright 2021-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, SGwriteSTLplot, is designed to create an STL file from a given solid geometry and generate a corresponding plot image. It combines functionalities from SGwriteSTL and SGTplotalpha.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the filename parameter sname using getfuncparams. If not provided, it defaults to an empty string.
  2. Call SGwriteSTL with the solid geometry SG and the filename sname to create the STL file. Store the result in fname.
  3. Set up a figure with a specific view using SGfigure(-30,30).
  4. Plot the solid geometry with transparency using SGTplotalpha(SG).
  5. Add a title to the plot with the filename and the current date using title(fname) and titleappend(datestr(now)).
  6. Refresh the plot display with drawnowvid and bring the figure window to the front with shg.
  7. Capture a snapshot of the current axes and save it to the desktop directory with the filename sname using gcasnapshot(gca,desktopdir(sname)). Store the result in iname.
  8. Return a cell array fnames containing the filenames of the STL and PNG files.
Algorithm explaination created using ChatGPT on 2025-08-19 00:37. (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