Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Have you ever gotten annoyed by MS Word minimizing the resolution of your images? Did you ever feel the frustration of losing the fine details in your illustrations in just a few pixels? - Then you are in the right place! This python project aims to provide a possibility to render a CAD object as a vector graphic, namely a SVG.
Integreted features are:
.step
files or importing cadquery
-objectsgmsh
libraryAlthough the use case is very specific, there are still several features that might be nice to have:
Before installation, please make sure to have the right versions of gmsh, numpy, meshio and cadquery installed
pip install cadquery, meshio, gmsh, numpy==1.26.0
The package can then be installed using pip with the following command:
pip install cadvectorgraphics
A scalable vector graphic might not be the best choice for the use in MS office applications. A better option would be to use the Enhanced Meta File (EMF). However it's quite easy to convert an SVG to an EMF file using Inkscape. You can either open the SVG in Inkscape directly and save it as a new file with the suitable extension.
The other method is to use Inksckape from the command line.
cd [DIR_TO_MY_FILE]
inkscape "[FILENAME].svg" --export-filename="[FILENAME].emf" --export-dpi="[DPI]"
Of coarse you have to adjust DIR_TO_MY_FILE
, FILENAME
and DPI
according to your needs. You can find more information on that here. Do not forget to add the inkscape.exe
to your PATH before executing the command.
In the following, a small example script is provided.
from cadvectorgraphics import *
from cadquery import Workplane, exporters
# providing an initial model with cadquery
# the CAD-file can be obtained from any prefered CAD-system
box = Workplane().box( 10, 10, 10 ).edges( "|Z" ).fillet( 1 ).faces(">Z").workplane().cboreHole( 5, 7, 3 )
exporters.export( box, "model.step" )
# importing the file to a CAD-model representation
part = PartRepresentation( "model.step" )
part.color( 0, ( 100, 200, 100 ) )
# creating a mesh from the CAD-file
part.tessellateAll( size = MeshSize.GRAINY )
# creating a scene to assemble all necessary objects such as the view, the ligths and the model
scene = VirtualScene( part )
scene.setCameraPosition( position = ( 15, 15, 15 ) )
# adding a light source
# multiple lights can be added
# if none is added, the object will be displayed with the given base color
lightSource = LightSource( position = ( 20, 10, 0 ) )
lightSource.color = ( 150, 50, 255 )
scene.appendLightSource( light = lightSource )
# adding the scene with all components to a renderer
renderer: VirtualRenderer = VirtualRenderer( scene )
renderer.render()
# creating an image from the renderer result
image = Image( renderer )
# zooming into the geometry
image.zoom = ( 10, 10 )
# scaling all elements of the image
image.scale = ( 1, 1 )
# setting margins
image.margins = ( 5, 5 )
# creating line styles for special edges and curves
# if none is added, only the mesh is visible
visibleOutlineStyle = LineStyle( EdgeRepresentationType.VISIBLEOUTLINE )
visibleOutlineStyle.width = 0.25
visibleOutlineStyle.color = ( 0, 0, 0 )
image.addLineStyle( visibleOutlineStyle )
visibleSharpStyle = LineStyle( EdgeRepresentationType.VISIBLESHARPWIRE )
visibleSharpStyle.width = 0.25
visibleSharpStyle.color = ( 0, 0, 0 )
image.addLineStyle( visibleSharpStyle )
visibleSmoothStyle = LineStyle( EdgeRepresentationType.VISIBLESMOOTHWIRE )
visibleSmoothStyle.width = 0.1
visibleSmoothStyle.color = ( 0, 0, 0 )
visibleSmoothStyle.dash = ( 1, 0.2, 0.2, 0.2 )
image.addLineStyle( visibleSmoothStyle )
# creating style information for the coordinate system
coordStyle = CoordSystemStyle( size = 30 )
image.setCoordSystemStyle( coordStyle )
# export the image as svg
image.write()
This script has the following output then.
FAQs
A python package for generating beautiful SVG from CAD data
We found that cadvectorgraphics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.