Coder Social home page Coder Social logo

aleutgeb / steptoxsection Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 5.89 MB

The program STEPToXSection is a command line utility to export the contour of a planar cross section of solids contained in STEP files. It supports surface offsetting of the input geometry and in-plane curve offsetting. The in-plane base contour can also result from the orthogonal projection of geometries (silhouette) onto the plane within a specified maximum plane distance.

License: GNU Lesser General Public License v2.1

CMake 6.28% C++ 93.72%
step contour ply xyz opencascade cross-section contour-extraction offset offsetting cam

steptoxsection's Introduction

STEPToXSection

Description

The program STEPToXSection is a command line utility to export the contour of a planar cross section of solids contained in STEP files. It supports surface offsetting of the input geometry and in-plane curve offsetting. The in-plane base contour can also result from the orthogonal projection of geometries (silhouette) onto the plane within a specified maximum plane distance. The contour is a list of line segments. The supported output file formats are ply (edges, polygons, or triangles) and xyz. In the case of xyz, two consecutive vertices belong to the same edge. A popular viewer for the different file types is MeshLab (https://www.meshlab.net). STEPToXSection is based on OpenCASCADE (https://www.opencascade.com). The program uses cxxops (https://github.com/jarro2783/cxxopts) for parsing the command line.

Requirements

Usage

Listing the contents (solids) of a STEP file: STEPToXSection -c -i <step file>

Computing the planar cross section contour of the overall file content (solids):

STEPToXSection -i <step file> -o <output file> -d <deflection> -p <plane>

The parameter <deflection> controls the resolution of the approximation with line segments.

Computing the planar cross section contour of selected solids of the file:

STEPToXSection -i <step file> -o <output file> -d <deflection> -p <plane> -s <solid1>,<solid2>,<...>

In order to change the default output format ply (edges) the command line argument -f xyzhas to be specified.

Following the help text from the command line:

STEPToXSection.exe
Extracts a contour of the planar cross section of solids contained in STEP files. The programm supports surface offsetting of the input geometry and in-plane curve offsetting. The in-plane base contour can also result from the orthogonal projection of geometries (silhouette) onto the plane within a specified maximum plane distance.
Usage:
  STEPToXSection [OPTION...]

  -i, --in arg              Input file
  -o, --out arg             Output file
  -f, --format arg          Output file format (xyz, ply_edges, ply_polygons,
                            or ply_triangles) (default: ply_edges)
  -c, --content             List content (solids)
  -s, --select arg          Select solids by name or index (comma seperated
                            list, index starts with 1)
  -d, --deflection arg      Chordal tolerance used during discretization
  -p, --plane arg           Single plane (a,b,c,d) or parallel planes
                            (a,b,c,d_start,d_end,d_count), in which a*x + b*y + c*z +
                            d = 0
  -1, --surface_offset arg  Single offset (value) or range offset
                            (start,end,count) for surface offsetting of input geometry
  -2, --curve_offset arg    Single offset (value) or range offset
                            (start,end,count) for in-plane curve offsetting
  -n, --projection arg      Orthogonal projection of geometries with
                            specified maximum plane distance, in which the silhouette
                            of the projected geometries represents the
                            in-plane base contour
  -h, --help                Print usage

Examples

Examples spheres.stp and bone_pocket.stp are from the examples directory.

Examples Spheres

Solids
Image Solids-Spheres
Planar cross section
STEPToXSection.exe -i spheres.stp -o out.ply -f ply_edges -d 0.01 -p 1.0,0.0,0.0,0.0
Image Cross-Section-Spheres
Planar cross sections
STEPToXSection.exe -i spheres.stp -o out.ply -f ply_edges -d 0.01 -p 1.0,0.0,0.0,-4.0,4.0,6
Image Cross-Sections-Spheres
Positive in-plane offset curves
STEPToXSection.exe -i spheres.stp -o out.ply -f ply_edges -d 0.01 -p 1.0,0.0,0.0,0.0 -2 0.0,10.0,10
Image Positive-Offset-Curves-Spheres
Negative in-plane offset curves
STEPToXSection.exe -i spheres.stp -o out.ply -f ply_edges -d 0.01 -p 1.0,0.0,0.0,0.0 -2 0.0,-4.9,5
Image Negative-Offset-Curves-Spheres

Example Bone Pocket

Solid
Image Solid-Bone-Pocket
Planar cross section
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,0.0
Image Cross-Section-Bone-Pocket
Planar cross sections
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,-4.0,4.0,5
Image Cross-Sections-Bone-Pocket
Positive in-plane offset curves
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,0.0 -2 0.0,4.0,5
Image Positive-Offset-Curves-Bone-Pocket
Negative in-plane offset curves
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,0.0 -2 0.0,-2.0,3
Image Negative-Offset-Curves-Bone-Pocket
Silhouette of projected geometry within plane distance
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,0.0 -n 3.0
Image Silhouette-Projected-Geometry-Bone-Pocket
Silhouettes of projected geometry within plane distance
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,2.5,0.0,6 -n 1.0
Image Silhouettes-Projected-Geometry-Bone-Pocket
Planar cross-sections using positive surface offset
STEPToXSection.exe -i Bone_Pocket.stp -o out.ply -f ply_edges -d 0.01 -p 0.0,0.0,1.0,2.5,0.0,6 -1 1.5
Image Cross-Sections-Positive-Surface-Offset

Remarks

This code has been tested with an OpenCASCADE 7.5.0 prebuilt binary (opencascade-7.5.0-vc14-64.exe) on Windows, as well as OpenCASCADE system packages on openSUSE Linux. With changes in the configuration section in the CMakeLists.txt file the build should also work with other OpenCASCADE versions.

steptoxsection's People

Contributors

aleutgeb avatar jmairboeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

steptoxsection's Issues

Slice solid from offset surfaces

Hello,
Is it possible with your lib to slice the input solid with a 3d base surface (not a plane), and get the resulting surface of solid (and contour)? And then repeat with another surface, offset from the base one ?
Thank you

merge with STEPToMesh (and STEPToPoints?)

For easier deployment (especially when linking statically) and to reduce code duplication and maintenance efforts between the STEP processing tools, it could make sense to merge them into a single project, producing a single binary which can be invoked in several modes, e.g. similar to how the command line clients of git or svn work.

Listing the contents of a STEP file (i.e. -c) could then be a dedicated mode because it is shared between all other processing modes.

The code for reading a STEP file, for parts selection and maybe specifying the working unit (see aleutgeb/STEPToMesh#4) could be shared.

Issues with polygon results of multi-slicing

Hello,

when calling your 'multiple slicing' on the 'bone' test case (with Polygon output type), the final results (in the output .ply file) does not look good: the triangles shared a same vertex/node, leading to triangles edges crossing the 'bone" slice boundary (see image).
I expected to have a kind of delaunay triangulation inside the slice boundary.

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.