Giter Club home page Giter Club logo

Comments (11)

mknippen avatar mknippen commented on July 18, 2024 6

+1 on this. Would love to be able to use this for laser cutting, but without line, it's really difficult.

from openscad.

doug-moen avatar doug-moen commented on July 18, 2024 1

Maybe try Rapcad? It's an (old) fork of OpenSCAD that includes a polyline primitive. I haven't tried it, but it looks like DXF export is now supported.

from openscad.

donbright avatar donbright commented on July 18, 2024

I believe that something like this may be possible with CGAL. Specifically, the "Nef Poylhedrons" used by CGAL can create 'open' line segments.

The following example from the CGAL documentation demonstrates the representation of an 'antenna' poking out of a cube.

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Nef_3/Chapter_main.html#Subsection_28.7.2

From what I understand, these '1 dimensional' shapes can be intersectioned, unioned, differenced, etc - they are just Nef Polyhedron objects like any other.

I am guessing if you started to implement this, the problem might be that OpenSCAD's guts are built around the idea of whole, closed shapes, not 2d lines. There might be some interesting bugs and crashes if you feed non-closed shapes through some of OpenSCAD's inner machinery.

A good part of OpenSCAD's inner workings use the CGAL conversion from CGAL's Nef Polyhedron to CGAL's 'Polyhedron3'. Conversion to STL for example. A Polyhedron3, however, has to be 'closed', aka "orientable 2-manifold objects with boundaries". I.e. no line segments poking around everywhere. If it's not closed, the conversion barfs. Or OpenSCAD barfs because it checks 'is_simple()' or some such before conversion to check if the Nef Polyhedron has any weird features that are not "orientable 2-manifoled objects with boundaries". The CGAL conversion process is described here:

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Nef_3/Chapter_main.html#Subsection_28.5.4

So, how do you do the conversion and just 'drop' your line segments? As far as I know, CGAL will not do this 'drop' for you. OpenSCAD would probably need to be smart enough to figure out how to 'drop' the line segments from the Nef Polyhedron3 before feeding them to these conversion routines (like STL). That could mean, for example, possibly iterating through the Nef Polyhedron and 'trimming' everything that looks like a line segment. I'm not sure how difficult that would be. . .

I don't think it's impossible, but I think it is a few dozen hours of work (at least for some slow person like me).


PS... I know you requested 2d, not 3d... but IMHO the same principles apply. CGAL's implementation of Nef Polyhedron is similar whether you are talking 3d or 2d and i think the solutions will be similar too.


note to self:

http://www.cadkas.de/downengcad4font2dxf.php

http://www.mrrace.com/CamBam_Fonts/

from openscad.

GilesBathgate avatar GilesBathgate commented on July 18, 2024

Its certainly possible to create unclosed lines with CGAL, I have a polyline() module in rapcad that does this. Its not very useful by itself but it can be combined with minkowski to do a glide like operation. ultimately print paths and lazer cutter paths can be represented by polylines, and of course they would be exportable to dxf when I implement that too.

from openscad.

nichtich avatar nichtich commented on July 18, 2024

Looks like polyline() can do 2d lines, I will have a look at repcad - is it just a better fork of openscad?

P.S: If OpenSCAD is based on GCAL, it should be listed at http://www.cgal.org/projects.html

from openscad.

bkorsedal avatar bkorsedal commented on July 18, 2024

I have a similar issue.

I want to build some shade structures in my front yard for a garden. I'm building them out of PVC piping. I want to bend and twist it all funky.

I want to CAD it up in OpenSCAD first, so I'm trying to create a function I like to call Bezier_Noodle. It's a pipe curved to match a quadratic bezier equation. Anyway, I'm trying to do it as a bunch of cylinder segments, but getting the rotation is difficult. It would be soooooooo much easier to do a polyline minkowski with a cylinder, but no lines in OpenSCAD.

What did you guys end up doing with your problems?

from openscad.

peteruithoven avatar peteruithoven commented on July 18, 2024

Just curious if there is any progress on this?

from openscad.

ksa-real avatar ksa-real commented on July 18, 2024

Note that this problem exists for 3d shapes as well. I recently created parametric bearing.
http://www.thingiverse.com/thing:396232
It would be a way easier to create polygon in a loop than trying to unite polygons. Also as (d+1)_length is not guaranteed to be the same as d_length+length, I had to use tolerance for sectors to match up. (which is not known etc). So I had to use hacks to implement this.

from openscad.

t-paul avatar t-paul commented on July 18, 2024

@ksa-real generating polygons / polyhedrons by calculating the points is possible in the dev-snapshots, for example like function circle(r) = [for (a=[0:360/$fn:360-360/$fn]) [r * sin(a), r * cos(a), 0]]; from https://gist.github.com/kintel/4645e2c91eb02e577688 which has more complex examples.

from openscad.

 avatar commented on July 18, 2024

OpenSCAD rocks, but the lack of a line() function is killing it for 2D usage. I have a beautiful 2D parametric design I want to cut on the laser but all my "lines" are really rectangles and come out in the DXF as double lines after they get merged with other such "lines". This is problematic because it means laser cutting the same line twice. When I try to migrate to a die for die cutting, this is a show stopper because the die manufacturer can't take the OpenSCAD DXF. I love OpenSCAD but this needs to be fixed!

from openscad.

nophead avatar nophead commented on July 18, 2024

The issue is that OpenSCAD models 2D objects not laser tool paths. If you were using the result to CNC route something you would pass the DXF that describes the object to a CAM program to get the tool path to make it. The CAM program would subtract the kerf.

Because the kerf with a laser is very small there seems to be a tradition of leaving out the CAM stage and just using the object's outlines as the tool path.

When you have a line the laser actually cuts a slot. If you modelled an object with a slot at kerf width and passed it through a laser CAM program it could reduce it to a single line down the middle. The problem is I don't think there are any CAM programs for lasers.

from openscad.

Related Issues (20)

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.