PySLM Python Library for Selective Laser Melting and Additive Manufacturing

Overview

PySLM Python Library for Selective Laser Melting and Additive Manufacturing

Documentation Status Chat on Gitter https://static.pepy.tech/personalized-badge/pythonslm?period=total&units=international_system&left_color=black&right_color=orange&left_text=Downloads

PySLM is a Python library for supporting development of input files used in Additive Manufacturing or 3D Printing, in particular Selective Laser Melting (SLM), Direct Metal Laser Sintering (DMLS) platforms typically used in both academia and industry. The core capabilities aim to include slicing, hatching and support generation and providing an interface to the binary build file formats available for platforms. The library is built of core classes which may provide the basic functionality to generate the scan vectors used on systems and also be used as building blocks to prototype and develop new algorithms.

This library provides design tools for use in Additive Manufacturing including the slicing, hatching, support generation and related analysis tools (e.g. overhang analysis, build-time estimation).

PySLM is built-upon python libraries Trimesh and based on some custom modifications to the PyClipper libraries, which are leveraged to provide the slicing and manipulation of polygons, such as offsetting and clipping of lines. Additional functionality will be added to provide basic capabilities.

The aims is this library provides especially for an academic environment, a useful set of tools for prototyping and used in-conjunction with simulation and analytic studies.

Current Features

PySLM is building up a core feature set aiming to provide the basic blocks for primarily generating the scan paths and additional design features used for AM and 3D printing systems typically (SLM/SLS/SLA) systems which consolidate material using a single/multi point exposure by generating a series of scan vectors in a region.

Support Structure Generation

  • [TODO] A prototype for support structure generation

Slicing:

  • Slicing of triangular meshes supported via the Trimesh library.
  • Simplification of 2D layer boundaries
  • Bitmap slicing for SLA, DLP, Inkjet Systems

Hatching: The following operations are provided as a convenience to aid developing the scan strategies:

  • Offsetting of contours and boundaries
  • Trimming of lines and hatch vectors (sequentially ordered)

The following scan strategies have been implemented as reference on platforms:

  • Standard 'Alternating' hatching
  • Stripe Scan Strategy
  • Island or Checkerboard Scan Strategy

Visualisation:

The laser scan vectors can be visualised using Matplotlib. The order of the scan vectors can be shown to aid development of the scan strategies, but additional information such length, laser parameter information associated with each scan vector can be shown.

  • Scan vector plots (including underlying BuildStyle information and properties)
  • Exposure point visualisation
  • Exposure (effective heat) map generation
  • Overhang visualisation

Analysis: * Build time estimation tools (based on scan strategy and geometry) * Iterators (Scan Vector and Exposure Point) for Simulation

Export to Machine Files:

Currently the capability to enable translation to commercial machine build platforms is being providing through a supporting library called libSLM . This is a c++ library to enable efficient import and export across various commercial machine build files. Work is underway to support the following file formats. If you would like to support implementing a custom format, please raise a request.

  • Renishaw MTT (.mtt),
  • DMG Mori Realizer (.rea),
  • EOS SLI formats (.sli) - WIP,
  • SLM Solutions (.slm).

For further information, see the latest release notes.

Installation

Installation is currently supported on Windows, Mac OS X and Linux environments. The pre-requisites for using PySLM can be installed via PyPi and/or Anaconda distribution.

conda install -c conda-forge shapely, Rtree, networkx, scikit-image, cython
conda install trimesh

Installation of PySLM can then be performed using pre-built python packages using the PyPi repository. Additionally to interface with commercial systems, the user can choose to install libSLM. Note, the user should contact the author to request machine build file translators, as this cannot be installed currently without having the machine build file translators available.

pip install libSLM
pip install PythonSLM

Alternatively, PySLM may be compiled directly from source. Currently the prerequisites are the cython package and a compliant c++ build environment.

git clone https://github.com/drlukeparry/pyslm.git && cd ./pyslm
python setup.py install

Usage

A basic example below, shows how relatively straightforward it is to generate a single layer from a STL mesh which generates a the hatch infill using a Stripe Scan Strategy typically employed on some commercial systems to limit the maximum scan vector length generated in a region.

import pyslm
import pyslm.visualise
from pyslm import hatching as hatching

# Imports the part and sets the geometry to  an STL file (frameGuide.stl)
solidPart = pyslm.Part('myFrameGuide')
solidPart.setGeometry('../models/frameGuide.stl')

# Set te slice layer position
z = 23.

# Create a StripeHatcher object for performing any hatching operations
myHatcher = hatching.StripeHatcher()
myHatcher.stripeWidth = 5.0

# Set the base hatching parameters which are generated within Hatcher
myHatcher.hatchAngle = 10 # [°]
myHatcher.volumeOffsetHatch = 0.08 # [mm]
myHatcher.spotCompensation = 0.06 # [mm]
myHatcher.numInnerContours = 2
myHatcher.numOuterContours = 1

# Slice the object
geomSlice = solidPart.getVectorSlice(z)

#Perform the hatching operations
layer = myHatcher.hatch(geomSlice)

# Plot the layer geometries
pyslm.visualise.plot(layer, plot3D=False, plotOrderLine=True) # plotArrows=True)

For further guidance please look at documented examples are provided in examples .

Comments
  • Using the pyslm.hatching.*Hatcher with shapely object as input

    Using the pyslm.hatching.*Hatcher with shapely object as input

    Hi, i'm trying to use some of the pySLM methods to do some basic hatching for robot tool path generation (there are not so many hatching implementation out there).

    The idea is to create a shapely.Polygon oder shapely.LineString from a set of arbitrary points (x,y). Then i like to feed this polygon into one of the Hatchers from pySLM.

    The examples use getVectorSlice() for generating input for the .hatch() method.

    Can i generate the input for hatching from shapely Objects? Or would it be possible to generate input directly based on some list of points that describe a polygon?

    The whole point is to generate paths for some laser cladding application, where the surface boundaries are extracted from some CAD document via FreeCAD.

    documentation question 
    opened by jkur 5
  • Facing error while running the code

    Facing error while running the code

    zsh: command not found: import zsh: command not found: import zsh: command not found: import from: can't read /var/mail/pyslm zsh: number expected zsh: number expected

    Found when I ruined example after installing PythonSLM % pip install PythonSLM Requirement already satisfied: PythonSLM in /opt/anaconda3/lib/python3.9/site-packages (0.4.2) Requirement already satisfied: triangle in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (20200424) Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (1.20.3) Requirement already satisfied: setuptools in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (58.0.4) Requirement already satisfied: shapely in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (1.8.0) Requirement already satisfied: trimesh in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (3.9.35) Requirement already satisfied: cython in /opt/anaconda3/lib/python3.9/site-packages (from PythonSLM) (0.29.24)

    Please help me out

    opened by adi18997 4
  • Debug Output in Release Version

    Debug Output in Release Version

    Hello,

    While testing a fresh install of the library, there seems to be a lot of what equates to debug output (ignore the "Processing Layers"; that's just tqdm): image

    Is this intentional, or is there a good reason for this? I'd think output like this isn't useful to the end user and would be better off deleted or optionally enabled. It's messing with my tqdm progress bars and I wanted to double-check if there is a specific reason why this is still around in the library, particularly on the master branch. Note that I built from source to achieve this result; I have no idea if the PyPi version would exhibit this behavior.

    enhancement 
    opened by aacitelli 4
  • Error when try to replay the example: no module named'pyslm.visualise'

    Error when try to replay the example: no module named'pyslm.visualise'

    import pyslm import pyslm.visualise Traceback (most recent call last): File "<pyshell#5>", line 1, in import pyslm.visualise ModuleNotFoundError: No module named 'pyslm.visualise'

    Can you please help?

    bug 
    opened by TomyTiger 3
  • Hatches being output in unexpected order

    Hatches being output in unexpected order

    Here's a short video to demonstrate: Animation

    I want the vectors to be output strictly top-right to bottom-left (the direction of the hatch angle, or 90deg from it - you get the gist). However, I'm seeing that some vectors entirely below the hole are being output before some vectors to the right of the hole. I want vectors directly parallel, across from each other across the hole, to be burned one right after another, so you get a nice, linear progression down and to the left (in this example).

    Any idea what's going on here? Am I right to assume this could be remedied by LinearSort (which I've submitted a separate issue for, as I think it's flawed)?

    Thank you!

    bug 
    opened by aacitelli 3
  • Add jump vector display

    Add jump vector display

    It is often useful to be able to view jump vectors; this PR adds a keyword argument, plotJumps, to the plot() function, which causes it to plot all the jump vectors in a dark gray color (to avoid conflicts with the usual heatmap).

    Example Output: image

    If you'd like me to open a PR to a different branch or for me to change anything, let me know.

    enhancement 
    opened by aacitelli 3
  • Issues with visualize.plot()

    Issues with visualize.plot()

    I was able to successfully install pyslm and run the basic example code. However, I am not getting any output from pyslm.visualise.plot(layer, plot3D=False, plotOrderLine=True)

    Running on windows Python 3.7.9 PythonSLM 0.5.0. Any suggestions on how to address this would be appreciated.

    question 
    opened by aksvaidya 2
  • Unexpected Slicing and Hatching result

    Unexpected Slicing and Hatching result

    Hey,

    For some models i got an unexpected result after using the slicing and hatching algorithm. I used a slightly modified version of your "example_3d_multithread.py" script as a template to visualise the unexpected results for you:

    expected Result: GoodResult

    unexpected Result: BadResult

    As you can see some areas are closed incorrectly in some layers within the model. I dont know exactly how to fix this problem and if this is an issue with the model itself (model should be watertight), the slicing algorithm or the hatching algorithm. Maybe you have some ideas. You can find the used source code and the *.stl file below.

    ScriptAndModel.zip

    """
    A simple example showing how to use PySLM for generating slices across a 3D model.
    THhs example takes advantage of the multi-processing module to run across multiple threads.
    """
    import pyslm
    import pyslm.visualise
    from pyslm import hatching as hatching
    import numpy as np
    import time
    
    from multiprocessing import Manager
    from multiprocessing.pool import Pool
    from multiprocessing import set_start_method
    
    def calculateLayer(input):
        # Typically the hatch angle is globally rotated per layer by usually 66.7 degrees per layer
        d = input[0]
        zid= input[1]
    
        layerThickness = d['layerThickness']
        solidPart = d['part']
    
        # Create a StripeHatcher object for performing any hatching operations
        myHatcher = hatching.Hatcher()
    
        # Set the base hatching parameters which are generated within Hatcher
        myHatcher.hatchAngle            = 45 + zid * 66.7
        myHatcher.volumeOffsetHatch     = 0.07
        myHatcher.spotCompensation      = 0.1
        myHatcher.numInnerContours      = 0
        myHatcher.numOuterContours      = 1
        myHatcher.hatchDistance         = 0.12
        myHatcher.hatchSortMethod       = hatching.AlternateSort()
    
        # Slice the boundary
        geomSlice = solidPart.getVectorSlice(zid*layerThickness)
    
        # Hatch the boundary using myHatcher
        layer = myHatcher.hatch(geomSlice)
    
        if layer:
            # The layer height is set in integer increment of microns to ensure no rounding error during manufacturing
            layer.z = int(zid*layerThickness * 1000)
            layer.layerId = int(zid)
    
            return layer
        else:
            return None
    
    def main():
        set_start_method("spawn")
    
        # Imports the part and sets the geometry to  an STL file (frameGuide.stl)
        solidPart = pyslm.Part('bridge')
        solidPart.setGeometry('bridge_slm_cad.stl')
    
        solidPart.origin[0]     = 0.0
        solidPart.origin[1]     = 0.0
        solidPart.scaleFactor   = 1.0
        solidPart.rotation      = [0.0, 0.0, 0.0]
        solidPart.dropToPlatform()
        print(solidPart.boundingBox)
    
        # Set the layer thickness
        layerThickness = 0.03 # [mm]
    
        #Perform the hatching operations
        print('Hatching Started')
    
        layers = []
    
        p = Pool(processes=4)
    
        d = Manager().dict()
        d['part'] = solidPart
        d['layerThickness'] = layerThickness
    
        # Rather than give the z position, we give a z index to calculate the z from.
        numLayers = solidPart.boundingBox[5] / layerThickness
        z = np.arange(0, numLayers).tolist()
    
        # The layer id and manager shared dict are zipped into a list of tuple pairs
        processList = list(zip([d] * len(z), z))
    
        startTime = time.time()
    
        # uncomment to test the time processing in single process
        #for pc in processList:
        #   calculateLayer(pc)
    
        layers = p.map(calculateLayer, processList)
    
        print('Multiprocessing time {:.1f} s'.format(time.time()-startTime))
        p.close()
    
        print('Completed Hatching')
        
        return layers
    
    
    if __name__ == '__main__':
        layers = main()
        
        for k in range(164, 171, 1):
            pyslm.visualise.plotSequential(layers[k])
    

    For some other models i also have something like this for example:

    • defective small contours and a incorrectly closed area BadResult_02
    bug 
    opened by MarcelHeu 2
  • LinearSort erroring out

    LinearSort erroring out

    Hopefully this screenshot of my debugger demonstrates the error well enough: image

    The error comes from this line of sorting.py: https://github.com/drlukeparry/pyslm/blob/90a999f131eab20253f8396bc0e4250e11143832/pyslm/hatching/sorting.py#L108

    I've added a few comments in there just to try and figure stuff out, but I haven't changed any actual code from what's on the main branch.

    The error is complaining that I'm taking the dot product of a 2-long array (essentially a vector representative of the hatch angle) and a X-long array of midpoints, where X is the number of vectors. My knowledge of linear algebra and numpy is sketchy at best, but isn't this expecting two same-length arrays for the dot product? Is a dot product the proper way to handle this?

    Again, apologies for not knowing the linear algebra terminology and numpy, so I speak intuitively. I think the way to do this would be to basically extend each midpoint by the hatch angle to the x-axis, then sort the lines based on the x-value of their intersection point with the x-axis. How would you accomplish this via numpy?

    I am running this with a pretty standard setup. I don't anticipate a specific test case will help much, as I think the error is apparent. I unfortunately just don't have enough background knowledge to fix it.

    opened by aacitelli 2
  • Error Installing PythonSLM from PyPi

    Error Installing PythonSLM from PyPi

    I have a bit of an interesting environment. I am trying to bundle all the requirements for pyslm into a portable Python installation, as I'm essentially building a UI that wraps around my organization's infrastructure for interfacing with PySLM. I was able to get an embeddable version of Python working with pip by following this guide. I was then able to install 90% of the project dependencies to this embeddable version.

    However, pip is running into the following error when it gets to the triangle package:

    ERROR: Command errored out with exit status 1:
       command: 'C:\Users\Kal\Documents\cdme-scangen-ui\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Kal\\AppData\\Local\\Temp\\pip-install-4oqlhgdx\\triangle_6607d6f5e9b84b9b9d04622fc8215807\\setup.py'"'"'; __file__='"'"'C:\\Users\\Kal\\AppData\\Local\\Temp\\pip-install-4oqlhgdx\\triangle_6607d6f5e9b84b9b9d04622fc8215807\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Kal\AppData\Local\Temp\pip-wheel-020a81mv'
           cwd: C:\Users\Kal\AppData\Local\Temp\pip-install-4oqlhgdx\triangle_6607d6f5e9b84b9b9d04622fc8215807\
      Complete output (115 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.9
      creating build\lib.win-amd64-3.9\triangle
      copying triangle\core1_run.py -> build\lib.win-amd64-3.9\triangle
      copying triangle\data.py -> build\lib.win-amd64-3.9\triangle
      copying triangle\plot.py -> build\lib.win-amd64-3.9\triangle
      copying triangle\tri.py -> build\lib.win-amd64-3.9\triangle
      copying triangle\version.py -> build\lib.win-amd64-3.9\triangle
      copying triangle\__init__.py -> build\lib.win-amd64-3.9\triangle
      creating build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\A.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\bbox.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.2.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.3.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.4.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\diamond_02_00009.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\diamond_02_00009.1.v.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\diamond_02_00009.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\dots.1.v.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\dots.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.2.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.2.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex3.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex3.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\ell.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\face.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\greenland.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\la.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.q.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.r.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\square_circle_hole.1.node -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\A.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\bbox.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.2.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.3.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.4.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\diamond_02_00009.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.2.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.2.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex3.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\ell.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\face.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\greenland.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\la.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.q.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\spiral.r.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\square_circle_hole.1.ele -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\A.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\A.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.2.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.3.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.4.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\box.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.2.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.2.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex2.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex3.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\double_hex3.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\face.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\face.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\la.1.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\la.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\square_circle_hole.poly -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\bbox.1.area -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\diamond_02_00009.1.v.edge -> build\lib.win-amd64-3.9\triangle\data
      copying triangle\data\dots.1.v.edge -> build\lib.win-amd64-3.9\triangle\data
      running build_ext
      building 'triangle.core' extension
      creating build\temp.win-amd64-3.9
      creating build\temp.win-amd64-3.9\Release
      creating build\temp.win-amd64-3.9\Release\c
      creating build\temp.win-amd64-3.9\Release\triangle
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DVOID=void -DREAL=double -DNO_TIMER=1 -DTRILIBRARY=1 -DANSI_DECLARATORS=1 -Ic -IC:\Users\Kal\Documents\cdme-scangen-ui\python\include -IC:\Users\Kal\Documents\cdme-scangen-ui\python\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcc/triangle.c /Fobuild\temp.win-amd64-3.9\Release\c/triangle.obj
      triangle.c
      c/triangle.c(3685): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3691): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3698): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3705): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3714): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3721): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3728): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3734): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3739): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3744): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3780): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3785): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3792): warning C4311: 'type cast': pointer truncation from 'subseg *' to 'unsigned long'
      c/triangle.c(3801): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3808): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3815): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3822): warning C4311: 'type cast': pointer truncation from 'triangle *' to 'unsigned long'
      c/triangle.c(3831): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(3838): warning C4311: 'type cast': pointer truncation from 'vertex' to 'unsigned long'
      c/triangle.c(6966): warning C4244: '=': conversion from 'double' to 'int', possible loss of data
      c/triangle.c(12465): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DVOID=void -DREAL=double -DNO_TIMER=1 -DTRILIBRARY=1 -DANSI_DECLARATORS=1 -Ic -IC:\Users\Kal\Documents\cdme-scangen-ui\python\include -IC:\Users\Kal\Documents\cdme-scangen-ui\python\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tctriangle/core.c /Fobuild\temp.win-amd64-3.9\Release\triangle/core.obj
      core.c
      triangle/core.c(4): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      ----------------------------------------
      ERROR: Failed building wheel for triangle
    

    I've looked up the fatal part of the error (cannot find Python.h) and, while I can't find anything specifically related to my circumstance (most of it is in context to actually using Visual Studio), it seems related to my installation of the Visual C++ Build Tools, which I understand are a requirement for many of the tools.

    The error appears both when I'm trying to install prerequisites for a version of pyslm built from source (our organization has a custom version with minor differences that shouldn't be relevant) and when simply trying to use the PythonSLM version from PyPi. This process works correctly when I am not using the embeddable version - that is, I've gotten the library working in general, just not when I'm trying to package it with a UI application built in Electron that essentially launches the Python script as a child process. Do you have any ideas for how I may go about fixing this?

    opened by aacitelli 2
  • Numba usage?

    Numba usage?

    I'm unsure if it's already implemented, but have you considered implementing parts of the library in Numba? It's is a library works in conjunction with Numpy that essentially implements JIT compilation in Python, speeding up loops and simple functions. The downside is that you have to write code in a style similar to C, but you can essentially selectively enable the library to only run on certain code blocks, which is done pretty simply via decorators.

    enhancement 
    opened by aacitelli 2
  • ClipperException: The path is invalid for clipping

    ClipperException: The path is invalid for clipping

    Hello,

    numpyArray.txt I am using pyslm version = '0.4.2'

    If i try to hatch a sliced contour (numpy array is attached within the *.txt file) with the following hatching settings i always got an ClipperException error:

    Traceback (most recent call last):
    
      File "C:\Users\MarcelHeuser\AppData\Local\Temp\ipykernel_6728\2481062967.py", line 18, in <cell line: 18>
        layer = myHatcher.hatch([npArray])
    
      File "C:\Developer\venvTEST\lib\site-packages\pyslm\hatching\hatching.py", line 929, in hatch
        clippedPaths = self.clipLines(paths, hatches)
    
      File "C:\Developer\venvTEST\lib\site-packages\pyslm\hatching\hatching.py", line 432, in clipLines
        pc.AddPath(BaseHatcher.scaleToClipper(boundary), pyclipper.PT_CLIP, True)
    
      File "external\pyclipper\pyclipper.pyx", line 616, in pyclipper.Pyclipper.AddPath
    
    ClipperException: The path is invalid for clipping
    

    I have extracted this contour from a sliced geometry. You can use the code below to reproduce the error.

    import numpy as np
    from pyslm import hatching as hatching
    
    # load numpy array
    npArray = np.load("numpyArray.txt")
    
    # generate Hatcher
    myHatcher = hatching.Hatcher()
    
    # Set the base hatching parameters
    myHatcher.hatchAngle        = 66.7
    myHatcher.volumeOffsetHatch = 0.08
    myHatcher.spotCompensation  = 0.025
    myHatcher.numInnerContours  = 0
    myHatcher.numOuterContours  = 1
    myHatcher.hatchDistance     = 0.12
    myHatcher.hatchingEnabled   = True
    myHatcher.hatchSortMethod   = hatching.AlternateSort()
    
    # Hatch the geomSlice
    layer = myHatcher.hatch([npArray])
    

    Do you know what could be the reason for the error?

    Best regards, Marcel

    bug 
    opened by MarcelHeu 3
Owner
Dr Luke Parry
Interest in Additive Manufacturing: Topics of interest include Simulation, Methodologies and Design Tools. Research Fellow @ University of Nottingham
Dr Luke Parry
Generalized hybrid model for mode-locked laser diodes with an extended passive cavity

GenHybridMLLmodel Generalized hybrid model for mode-locked laser diodes with an extended passive cavity This hybrid simulation strategy combines a tra

Stijn Cuyvers 3 Sep 21, 2022
Simulation of self-focusing of laser beams in condensed media

What is it? Program for scientific research, which allows to simulate the phenomenon of self-focusing of different laser beams (including Gaussian, ri

Evgeny Vasilyev 13 Dec 24, 2022
NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring

NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring Uncensored version of the following image can be found at https://i.

notAI.tech 1.1k Dec 29, 2022
PyTorch code for SENTRY: Selective Entropy Optimization via Committee Consistency for Unsupervised DA

PyTorch Code for SENTRY: Selective Entropy Optimization via Committee Consistency for Unsupervised Domain Adaptation Viraj Prabhu, Shivam Khare, Deeks

Viraj Prabhu 46 Dec 24, 2022
Unofficial PyTorch implementation of Neural Additive Models (NAM) by Agarwal, et al.

nam-pytorch Unofficial PyTorch implementation of Neural Additive Models (NAM) by Agarwal, et al. [abs, pdf] Installation You can access nam-pytorch vi

Rishabh Anand 11 Mar 14, 2022
Selective Wavelet Attention Learning for Single Image Deraining

SWAL Code for Paper "Selective Wavelet Attention Learning for Single Image Deraining" Prerequisites Python 3 PyTorch Models We provide the models trai

Bobo 9 Jun 17, 2022
Unofficial PyTorch implementation of Fastformer based on paper "Fastformer: Additive Attention Can Be All You Need"."

Fastformer-PyTorch Unofficial PyTorch implementation of Fastformer based on paper Fastformer: Additive Attention Can Be All You Need. Usage : import t

Hong-Jia Chen 126 Dec 6, 2022
An implementation of Fastformer: Additive Attention Can Be All You Need in TensorFlow

Fast Transformer This repo implements Fastformer: Additive Attention Can Be All You Need by Wu et al. in TensorFlow. Fast Transformer is a Transformer

Rishit Dagli 139 Dec 28, 2022
Unofficial Tensorflow-Keras implementation of Fastformer based on paper [Fastformer: Additive Attention Can Be All You Need](https://arxiv.org/abs/2108.09084).

Fastformer-Keras Unofficial Tensorflow-Keras implementation of Fastformer based on paper Fastformer: Additive Attention Can Be All You Need. Tensorflo

Yam Peleg 10 Jan 30, 2022
Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders

Modeling Category-Selective Cortical Regions with Topographic Variational Autoencoders

null 1 Oct 11, 2021
Official implementation for the paper: "Multi-label Classification with Partial Annotations using Class-aware Selective Loss"

Multi-label Classification with Partial Annotations using Class-aware Selective Loss Paper | Pretrained models Official PyTorch Implementation Emanuel

null 99 Dec 27, 2022
Torch-based tool for quantizing high-dimensional vectors using additive codebooks

Trainable multi-codebook quantization This repository implements a utility for use with PyTorch, and ideally GPUs, for training an efficient quantizer

Daniel Povey 41 Jan 7, 2023
A python library for face detection and features extraction based on mediapipe library

FaceAnalyzer A python library for face detection and features extraction based on mediapipe library Introduction FaceAnalyzer is a library based on me

Saifeddine ALOUI 14 Dec 30, 2022
Python wrappers to the C++ library SymEngine, a fast C++ symbolic manipulation library.

SymEngine Python Wrappers Python wrappers to the C++ library SymEngine, a fast C++ symbolic manipulation library. Installation Pip See License section

null 136 Dec 28, 2022
Fast image augmentation library and easy to use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about library: https://www.mdpi.com/2078-2489/11/2/125

Albumentations Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to inc

null 11.4k Jan 9, 2023
Bayesian optimisation library developped by Huawei Noah's Ark Library

Bayesian Optimisation Research This directory contains official implementations for Bayesian optimisation works developped by Huawei R&D, Noah's Ark L

HUAWEI Noah's Ark Lab 395 Dec 30, 2022
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 23.6k Dec 31, 2022
Python Library for learning (Structure and Parameter) and inference (Statistical and Causal) in Bayesian Networks.

pgmpy pgmpy is a python library for working with Probabilistic Graphical Models. Documentation and list of algorithms supported is at our official sit

pgmpy 2.2k Jan 3, 2023