the Write.SCAD file

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

the Write.SCAD file

jon_bondy
I have been working with Carsten to get his OpenSCAD-in-AngelCAD feature
working.  We stumbled across this:

I use Write.SCAD, which apparently includes lines like this:

import(file = "Letters.dxf", layer = "undef", origin = [0, 0], scale =
1, convexity = 1, $fn = 100, $fa = 12, $fs = 2, timestamp = 1606225466);

In other words it requests import of a DXF layer called "undef" from
Letters.dxf, but no such layer exists in that file.

You cannot just skip that file, because you cannot linear_extrude
nothing....

So how is it supposed to work?  I mean it does work, but how or why?

The main question could perhaps be "what does OpenSCAD do when asked to
extract a non-existing DXF layer 'undef' as part of a linear_extrude?".
I would have thought it would stop processing, but apparently it does not.

Thoughts or comments?

Jon


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the Write.SCAD file

cacb
On 24.11.2020 22:36, jon wrote:
> I have been working with Carsten to get his OpenSCAD-in-AngelCAD feature
> working.  We stumbled across this:
>
> I use Write.SCAD, which apparently includes lines like this:
>
> import(file = "Letters.dxf", layer = "undef", origin = [0, 0], scale =
> 1, convexity = 1, $fn = 100, $fa = 12, $fs = 2, timestamp = 1606225466);

To be precise, that line is taken from the csg-file that is generated by
openscad if you do

$ openscad somefile.scad --o=somefile.csg

...and somefile.scad "uses" write.scad like this:

use <write.scad>

It is write.scad that does import of "Letters.dxf", obviously containing
one letter in each DXF layer. However, sometimes write.scad tries to
import an "undef" layer (no such layer exist) as child of a linear_extrude.

I guess this is a bug in write.scad, but how does OpenSCAD manage to
process such things without even complaining?

I realise OpenSCAD does not process via the csg file, but surely it must
process the same tree internally.

Carsten Arnholm



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the Write.SCAD file

doug.moen
What happens if you feed somefile.csg back into OpenSCAD? Can OpenSCAD itself process the CSG file that it generates?

On Tue, Nov 24, 2020, at 5:42 PM, Carsten Arnholm wrote:

> On 24.11.2020 22:36, jon wrote:
> > I have been working with Carsten to get his OpenSCAD-in-AngelCAD feature
> > working.  We stumbled across this:
> >
> > I use Write.SCAD, which apparently includes lines like this:
> >
> > import(file = "Letters.dxf", layer = "undef", origin = [0, 0], scale =
> > 1, convexity = 1, $fn = 100, $fa = 12, $fs = 2, timestamp = 1606225466);
>
> To be precise, that line is taken from the csg-file that is generated by
> openscad if you do
>
> $ openscad somefile.scad --o=somefile.csg
>
> ...and somefile.scad "uses" write.scad like this:
>
> use <write.scad>
>
> It is write.scad that does import of "Letters.dxf", obviously containing
> one letter in each DXF layer. However, sometimes write.scad tries to
> import an "undef" layer (no such layer exist) as child of a linear_extrude.
>
> I guess this is a bug in write.scad, but how does OpenSCAD manage to
> process such things without even complaining?
>
> I realise OpenSCAD does not process via the csg file, but surely it must
> process the same tree internally.
>
> Carsten Arnholm
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the Write.SCAD file

MichaelAtOz'


write()
...
for (r = [0:len(word)]){   // count off each character

Needs a -1

import() fails silently like most things.


> -----Original Message-----
> From: Discuss [mailto:[hidden email]] On Behalf Of Doug Moen
> Sent: Wed, 25 Nov 2020 10:05
> To: OpenSCAD Discuss
> Subject: Re: [OpenSCAD] the Write.SCAD file
>
> What happens if you feed somefile.csg back into OpenSCAD? Can OpenSCAD itself process the
> CSG file that it generates?
>
> On Tue, Nov 24, 2020, at 5:42 PM, Carsten Arnholm wrote:
> > On 24.11.2020 22:36, jon wrote:
> > > I have been working with Carsten to get his OpenSCAD-in-AngelCAD feature
> > > working.  We stumbled across this:
> > >
> > > I use Write.SCAD, which apparently includes lines like this:
> > >
> > > import(file = "Letters.dxf", layer = "undef", origin = [0, 0], scale =
> > > 1, convexity = 1, $fn = 100, $fa = 12, $fs = 2, timestamp = 1606225466);
> >
> > To be precise, that line is taken from the csg-file that is generated by
> > openscad if you do
> >
> > $ openscad somefile.scad --o=somefile.csg
> >
> > ...and somefile.scad "uses" write.scad like this:
> >
> > use <write.scad>
> >
> > It is write.scad that does import of "Letters.dxf", obviously containing
> > one letter in each DXF layer. However, sometimes write.scad tries to
> > import an "undef" layer (no such layer exist) as child of a linear_extrude.
> >
> > I guess this is a bug in write.scad, but how does OpenSCAD manage to
> > process such things without even complaining?
> >
> > I realise OpenSCAD does not process via the csg file, but surely it must
> > process the same tree internally.
> >
> > Carsten Arnholm
> >
> >
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


--
This email has been checked for viruses by AVG.
https://www.avg.com


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: the Write.SCAD file

cacb
In reply to this post by doug.moen
On 25.11.2020 00:05, Doug Moen wrote:
> What happens if you feed somefile.csg back into OpenSCAD? Can OpenSCAD itself process the CSG file that it generates?

Yes it can, see attachment. Somehow, the import statements referring to
nonexistent "undef" layers are silently ignored. I would expect
processing to stop on such an issue, or at least write a warning. I am
still not sure how it manages to do linear_extrude on nothing and get
away with it?

Instead import warnings are issued about something unrelated (?) that
isn't even true: Using version 2020.11.23.nightly (git 0d5065d) under
Ubuntu, it complains about missing timestamps that are not missing.
here's one example:

"WARNING: variable timestamp not specified as parameter in file Orange
Crush Foot Switch.csg, line 234 "

There is one such warning for every import statement, including for the
cases where the DXF layer exists. I think this is unrelated to the
original issue though.

Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Orange Crush Foot Switch.csg.zip (24K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: the Write.SCAD file

cacb
In reply to this post by MichaelAtOz'
On 25.11.2020 00:50, Michael Marx wrote:
>
> write()
> ...
> for (r = [0:len(word)]){   // count off each character
>
> Needs a -1
>
> import() fails silently like most things.

Thant's probably the root cause indeed! A classic off-by-one bug.

Thanks.

Carsten Arnholm

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org