Bitbybit Versions Save

Core algorithms of bitbybit dev platform, which helps programming geometry on the browser

v0.15.8

1 month ago
  • bitbybit.occt.operations.offset - The inputs now take optional face for guidance. Sometimes it is necessary to provide a face to guide the offset as various kinds of geometrical situations can prove hard for algorithm to guess the right solution.
  • bitbybit.occt.operations.offsetAdv - This algorithm now also takes optional face for guidance. It is an alternative method that have more customizations exposed through it's inputs.

Unit Tests And Refactoring We have been working on improving the quality of our core codebase by adding new unit tests and restructuring the code in the @bitbybit-dev/occt layer. Check out this blog post to learn more about that:

Testing 3D Geometry Algorithms in OCCT

v0.15.7

1 month ago
  • Removed optionality from shape properties in the input DTO classes.
  • bitbybit.occt.shapes.edge.constraintTanCirclesOnTwoCircles - Finds all of the circles that are tangential to two circles. Solution can contain one or more edges.
  • bitbybit.occt.shapes.edge.constraintTanCirclesOnCircleAndPnt - Finds all of the circles that are tangential to a circle and a single point. Solution can contain one or more edges.
  • bitbybit.occt.transforms.rotate - implementation changed to use better OCCT transformation approach. Previous rotation method had strange side effects for UV coordinates of faces. That caused problems in rendering.

v0.15.6

1 month ago

Constructing faces in between two or more circles is a common task in mechanical design. This release brings just that.

  • bitbybit.occt.shape.face.createFaceFromMultipleCircleTanWires - Creates a face from multiple circle wires. You can choose how circles will be connected. There three strategies 'allWithAll' will connect all circles with all circles, 'inOrder' will connect circles in order they are provided to the algorithm, 'inOrderClosed' will connect circles in order they are given and last circle with the first one.
  • bitbybit.occt.shape.face.createFaceFromMultipleCircleTanWireCollections - This is a powerful technique, which can express many difficult designs automatically. You can provide 2D array of circles and then choose how to connect them. There are three strategies 'allWithAll' will connect all circles with all circles within provided collections, 'inOrder' will connect circles in order they are provided to the algorithm in each of the nested array, 'inOrderClosed' will connect circles in order they are given in both directions to form a closed grid kind of connection. Last two strategies require lists to contain the same number of circles.

To make it easier to construct wires from circles, we have introduced new method to create a wire from two circles.

  • bitbybit.occt.shape.wire.createWireFromTwoCirclesTan - It constructs the wire from two circles. Default configuration outputs the wire that includes the outer tangential lines and outer arcs. Users can also choose to include the inner tangential lines and arcs, but such wires may contain self intersections.

v0.15.5

1 month ago

bitbybit core layer

  • bitbybit.babylon.material.pbrMetallicRoughness.create - exposed emissive color property
  • bitbybit.draw.drawAnyAsync - extended to support drawing vertices. Users can choose vertex colour and size. It is also possible to enable or disable the drawing of vertices on the shape.

There are many methods for creating and interacting with circular edges

  • bitbybit.occt.shape.edge.arcThroughTwoPointsAndTangent - creates an arc edge between two points given the tangent direction for first point.
  • bitbybit.occt.shape.edge.arcFromCircleAndTwoPoints - creates an arc edge between two points that are on the circle. Users need to provide the circle and two points.
  • bitbybit.occt.shape.edge.arcFromCircleAndTwoAngles - creates an arc edge between two alpha angles on the circle. Users need to provide a circle and two alpha angles.
  • bitbybit.occt.shape.edge.arcFromCirclePointAndAngle - creates an arc edge between the point and alpha angles on the circle. Users need to provide a circle, alpha angle and a point.
  • bitbybit.occt.shape.edge.getCircularEdgesAlongWire - gets all circular edges along the wire.
  • bitbybit.occt.shape.edge.getLinearEdgesAlongWire - gets all linear edges along the wire.
  • bitbybit.occt.shape.edge.getCircularEdgeCenterPoint - gets the center point on the circular edge, which can also be an arc.
  • bitbybit.occt.shape.edge.getCircularEdgeRadius - gets the radius of the circular edge, which can also be an arc.
  • bitbybit.occt.shape.edge.getCircularEdgePlaneDirection - gets the direction of the circular edge, which can also be an arc.

Creating edges from various constraints was not really a thing in bitbybit, but with these few methods it becomes possible to achieve some cool circular geometries

  • bitbybit.occt.shape.edge.constraintTanLinesFromTwoPtsToCircle - Creates tangential lines towards the circle from two given points. You can optimize the solutions to include the inner and outer parts of the circle.
  • bitbybit.occt.shape.edge.constraintTanLinesFromPtToCircle - Creates tangential lines towards the circle from one given point. You can optimize the solutions to include the inner and outer parts of the circle.
  • bitbybit.occt.shape.edge.constraintTanLinesOnTwoCircles - Creates tangential lines between the two circles You can optimize the solutions to include the inner and outer parts of the circle and keep the inner or outer solution lines.

Vertex is a native shape type in OCCT, which was not exposed in bitbybit till now. bitbybit.occt.shapes.vertex - new category for vertex type shapes of occt. Vertex is basically a point, but it does work as a shape of opencascade, it means you can combine it to composed shapes, apply transformations and do other cool things with it.

  • bitbybit.occt.shapes.vertex.vertexFromPoint - creates vertex shape from the regular bitbybit point represented by 3 numbers in the array.
    • bitbybit.occt.shapes.vertex.verticesFromPoints - creates vertex shapes from the regular bitbybit points array.
  • bitbybit.occt.shapes.vertex.getVerticesAsPoints - gets the vertices from any kind of shape as points. Shapes that are made out of edges have vertices.
  • bitbybit.occt.shapes.vertex.verticesToPoints - transforms vertices to regular bitbybit points represented by 3 numbers in the array
  • bitbybit.occt.shapes.vertex.vertexToPoint - transforms single vertex shape to bitbybit point represented by 3 numbers in the array
  • bitbybit.occt.shapes.vertex.getVertices - gets the vertices from any kind of shape as OCCT Vertex shapes.
  • bitbybit.occt.shapes.vertex.verticesCompoundFromPoints - creates single compound shape consisting of multiple vertices.

Higher level methods on wires will be useful in the future.

  • bitbybit.occt.shapes.wire.createZigZagBetweenTwoWires - creates a zig zag polyline wire between two wires. Each edge on the wires gets divided into given number of segments and those points are joined together into a polyline.

Due to exposed vertex type we now need to be able to get vertices of shapes when transforming shapes to meshes in order to render geometry correctly.

  • bitbybit.occt.shapeToMesh - improved to return vertices as points for visualization purposes

v0.15.4

1 month ago
  • new method to reverse wire by reversing all its edges and their order.
  • fixed a bug to reverse edge
  • static ortho camera setup

v0.15.3

1 month ago
  • bitbybit.occt.operations.distancesToShapeFromPoints - method to retrieve the distances from points to the shape. This method first checks the closest point on the shape and then measures the distance.
  • bitbybit.logic.randomBooleans - creates a random boolean list of predefined length. Threshold is provided to regulate the probability of creating true/false values.
  • bitbybit.logic.not - operation inverts boolean value
  • bitbybit.logic.notList - operation inverts boolean values in the list
  • bitbybit.logic.twoThresholdRandomGradient - creates a random boolean list of true and false values based on a list of numbers. All values between true threshold will be true, all values above false threshold will be false, and the rest will be distributed between true and false based on the number of levels in a gradient pattern. That means that the closer the number gets to the false threshold the bigger the chance will be to get random false value.
  • bitbybit.logic.thresholdBooleanList - creates a boolean list by checking if number is larger or smaller than the threshold
  • bitbybit.logic.thresholdGapsBooleanList - creates a boolean list based on a list of numbers and a gap thresholds. Gap thresholds are pairs of min and max values that mark gap boundaries. If the given number falls into this gap, it will be considered true, if it does not fall in any of the gaps, it will be considered false.
  • bitbybit.point.distancesToPoints - finds the distances between the start point and multiple end points
  • bitbybit.occt.shapes.face.subdivideToNormals - is now fixed for reversed face situations. When trying to retrieve the normal of the face, we now check if the face is reversed from its original surface and if it is, we need to reverse the normal, otherwise it points to the direction of original surface and not the face.

v0.15.2

2 months ago
  • bitbybit.occt.fillets.filletEdgesList - useful method that does not require indexes of edges, instead users can provide edges themselves in a list and they will get rounded. In many situations that is more straightforward than checking indexes.
  • bitbybit.occt.fillets.filletEdgesListOneRadius - fillet multiple edges provided in a list by a single radius.
  • bitbybit.occt.fillets.filletEdgeVariableRadius - fillet single edge with variable radius. Users need to provide parameter U list on the edge that goes from 0 to 1 and then for each parameter provide radius in the array.
  • bitbybit.occt.fillets.filletEdgesVariableRadius - fillet multiple edges with multiple variable radius definitions. Users need to provide parameter U lists for each edge that go from 0 to 1 and then for each parameter list item provide radius lists for each edge. This will apply varying fillet definitions on all provided edges.
  • bitbybit.occt.fillets.filletEdgesSameVariableRadius - fillet multiple edges with single variable radius definition. Users need to provide the same parameter U list that goes from 0 to 1 and then for each parameter item provide radius in the array. This will apply the same variable fillet definition to all the edges.
  • bitbybit.occt.fillets.chamferEdgesList - useful method that does not require indexes of edges, instead users can provide edges themselves in a list and they will get chamfered. In many situations that is more straightforward than checking indexes.
  • bitbybit.occt.fillets.chamferEdgeDistAngle - chamfer an edge by providing face, distance for edge on the face and an angle of chamfer. Previously we could do only 45 degree fillets.
  • bitbybit.occt.fillets.chamferEdgesDistAngle - chamfers multiple edges along multiple faces by a single distance and angle definition. This is useful when you want to apply non 45 degree chamfer on the edges of the table for example.
  • bitbybit.occt.fillets.chamferEdgesDistsAngles - chamfers multiple edges along multiple faces by multiple distance and angle definitions.
  • bitbybit.occt.fillets.chamferEdgeTwoDistances - chamfer an edge by providing two distances. You will need to provide face, distance1 for the edge offset on the face and the distance 2 of chamfer on the opposing face for the same edge.
  • bitbybit.occt.fillets.chamferEdgesTwoDistances - chamfer multiple edges by using a single two distance definition.
  • bitbybit.occt.fillets.chamferEdgesTwoDistancesLists - chamfer multiple edges by using multiple two distance definitions.
  • bitbybit.occt.operations.makeThickSolidSimple - fixed face orientations on positively offsetted shapes. Faces seemed ok, but after applying fillets they were inversed due to reversed wires.

v0.15.1

2 months ago

v0.15.0

2 months ago
  • Fillet 3D wire improved and fixed. While API is not broken, the output of the shape can potentially break some scripts. The previously constructed wire was switching directions. This is now addressed - algorithm keeps the original direction. Providing indexes and radius lists did not work correctly. Now the algorithm is synchronised to work as if fillet 2D algorithm. For the same corner indexes the same corners are filleted both in 2d and 3d versions.

v0.14.5

2 months ago
  • bitbybit.occt.shapeFix.fixEdgeOrientationsAlongWire takes in the wire and rebuilds it in such a way as to make all edges point the same direction along the wire. In OCCT it is possible to create geometry in ways that make edges point in various directions. While many types of geometry work fine with such boundaries, it is sometimes very important to have good directions of all edges. Especially in CNC machining.
  • bitbybit.occt.shapes.edge.edgesToPoints takes in any shape that contains edges and returns nested lists of points that represent the edges. Edges are oriented along wire in this method by using BRepTools_WireExplorer. To generate points this method uses tangential deflection, so you can control many parameters such as angular, curvature deflections, etc.
  • bitbybit.occt.shapes.edge.getEdgesAlongWire will take in the wire and return a list of edges in good orientation
  • bitbybit.occt.shapes.wire.wiresToPoints takes in any shape that contains wires and returns nested lists of points that represent the wires. Points are generated along the wire in a uniform way. This is based on the edgesToPoints method so all the same parameters for tangential deflection can be controlled.
  • bitbybit.jscad.text.createVectorText is exposed. This outputs lists of 2D points for each character.
  • bitbybit.jscad.path.createPathsFromPoints implemented to take in collections of 2D points and transform those to 2D JSCAD paths. If 3D points are given to this method, the Z coordinate in the last array element is ignored and a 2D path will be built anyway. This method can be used to convert 2D points of JSCAD text to paths.

JSCAD IO output was mirroring shapes when saving geometry to STL and DXF. That was fixed now, this might break some things of course, but not the code.

As always, here is the project that shows these new algorithms in action. These projects take in OCCT wires, transform those to points automatically and create JSCAD paths. Then there's also an example of how vector based text paths are created. All those paths are merged and saved to DXF.

This is mainly addressing laser cutting or cnc milling applications.

https://bitbybit.dev/projects/public/KWsLJ19TnOgtS81ztELV/project-occt-wires-to-jscad-to-dxf-by-author-bitbybit