WARNING: Scaling a 2D object with 0 - removing object

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

WARNING: Scaling a 2D object with 0 - removing object

kevfquinn
I get the warning, "Scaling a 2D object with 0 - removing object" when first
running code like this:

  linear_extrude(height=10,scale=[0.0,1.0])
  square([10.0,10.0],center=true);

As far as I can tell, it's correctly generating what I'm expecting and
doesn't look like it has removed anything, but am I missing something?




--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

fred_dot_u
I pasted your code into the latest release, hit F5 and got the same error.

Changing the first scale vector to 1.0 turned it into a cube, but returning
the code to 0.0, F5 generated the triangle shape and no error. Erasing the
code, re-pasting it and F5 generated no error, but closing the program,
re-opening, re-pasting makes the error again.

There's something inherently wrong-feeling with a zero scaling factor,
though, isn't there?



--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

DanS
In reply to this post by kevfquinn
your first number in "scale" is zero.  So it is doing a multiplication by zero on that.  Not sure what you are expecting

On Tue, May 21, 2019 at 10:22 AM kevfquinn <[hidden email]> wrote:
I get the warning, "Scaling a 2D object with 0 - removing object" when first
running code like this:

  linear_extrude(height=10,scale=[0.0,1.0])
  square([10.0,10.0],center=true);

As far as I can tell, it's correctly generating what I'm expecting and
doesn't look like it has removed anything, but am I missing something?




--
Sent from: http://forum.openscad.org/

_______________________________________________
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: WARNING: Scaling a 2D object with 0 - removing object

acwest
That is a totally valid case in a linear extrude. If you apply this to a square, you will get a wedge as a result

On Tue, 21 May 2019, 11:29 Dan Shriver, <[hidden email]> wrote:
your first number in "scale" is zero.  So it is doing a multiplication by zero on that.  Not sure what you are expecting

On Tue, May 21, 2019 at 10:22 AM kevfquinn <[hidden email]> wrote:
I get the warning, "Scaling a 2D object with 0 - removing object" when first
running code like this:

  linear_extrude(height=10,scale=[0.0,1.0])
  square([10.0,10.0],center=true);

As far as I can tell, it's correctly generating what I'm expecting and
doesn't look like it has removed anything, but am I missing something?




--
Sent from: http://forum.openscad.org/

_______________________________________________
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

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

Re: WARNING: Scaling a 2D object with 0 - removing object

DanS
I get the warning in my old version of OpenScad too.  But it also renders a wedge (suggesting the warning, at least in my version, happens every time there is multiplication by zero; but that it does not necessarily really remove the object).  If both arguments are zero it renders a pyramid.


On Tue, May 21, 2019 at 11:38 AM A. Craig West <[hidden email]> wrote:
That is a totally valid case in a linear extrude. If you apply this to a square, you will get a wedge as a result

On Tue, 21 May 2019, 11:29 Dan Shriver, <[hidden email]> wrote:
your first number in "scale" is zero.  So it is doing a multiplication by zero on that.  Not sure what you are expecting

On Tue, May 21, 2019 at 10:22 AM kevfquinn <[hidden email]> wrote:
I get the warning, "Scaling a 2D object with 0 - removing object" when first
running code like this:

  linear_extrude(height=10,scale=[0.0,1.0])
  square([10.0,10.0],center=true);

As far as I can tell, it's correctly generating what I'm expecting and
doesn't look like it has removed anything, but am I missing something?




--
Sent from: http://forum.openscad.org/

_______________________________________________
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
_______________________________________________
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: WARNING: Scaling a 2D object with 0 - removing object

RayBellis


On 21/05/2019 17:10, Dan Shriver wrote:

> I get the warning in my old version of OpenScad too.  But it also
> renders a wedge (suggesting the warning, at least in my version,
> happens every time there is multiplication by zero; but that it does
> not necessarily really remove the object).  If both arguments are
> zero it renders a pyramid.

The "scale" value is causing the original square to be turned into a
degenerate line in the [0, 1] case or a point for [0, 0].

For a system that's intended for modelling 3D, I'm not entirely
surprised that it's complaining about the resulting 2D and 1D "objects".

Ray


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

Re: WARNING: Scaling a 2D object with 0 - removing object

acwest
It is by far the simplest way to generate wedges and cubes, though,
and there is no actual 1D or 2D object, they are just a vertex or edge
of the final 3D object, which are both valid.

On Tue, May 21, 2019 at 12:25 PM <[hidden email]> wrote:

>
>
>
> On 21/05/2019 17:10, Dan Shriver wrote:
>
> > I get the warning in my old version of OpenScad too.  But it also
> > renders a wedge (suggesting the warning, at least in my version,
> > happens every time there is multiplication by zero; but that it does
> > not necessarily really remove the object).  If both arguments are
> > zero it renders a pyramid.
>
> The "scale" value is causing the original square to be turned into a
> degenerate line in the [0, 1] case or a point for [0, 0].
>
> For a system that's intended for modelling 3D, I'm not entirely
> surprised that it's complaining about the resulting 2D and 1D "objects".
>
> Ray
>
>
> _______________________________________________
> 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: WARNING: Scaling a 2D object with 0 - removing object

RayBellis


On 21/05/2019 17:32, A. Craig West wrote:

> It is by far the simplest way to generate wedges and cubes, though,
> and there is no actual 1D or 2D object, they are just a vertex or edge
> of the final 3D object, which are both valid.

They might _look_ like just a vertex or edge, but unless OpenSCAD has
smarts I don't know about, aren't they actually four vertices (or two
edges) occupying the same location(s).

Specifying e.g. 0.001 as the scale factor should produce something
that's physically identical, but without the degeneration to 2D or 1D.

Ray

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

Re: WARNING: Scaling a 2D object with 0 - removing object

kevfquinn
In reply to this post by DanS
I'm expecting the square to scale to a line, on the understanding that the
source code is an "ideal" mathematical expression of the shape.

In other words I'm expecting it to be identical to:

  linear_extrude(height=10.0)
  polygon([[-5,0],[5,0],[0,10]]);

(bar the rotation).


DanS wrote
> your first number in "scale" is zero.  So it is doing a multiplication by
> zero on that.  Not sure what you are expecting
>
> On Tue, May 21, 2019 at 10:22 AM kevfquinn &lt;

> co@

> &gt; wrote:
>
>> I get the warning, "Scaling a 2D object with 0 - removing object" when
>> first
>> running code like this:
>>
>>   linear_extrude(height=10,scale=[0.0,1.0])
>>   square([10.0,10.0],center=true);
>>
>> As far as I can tell, it's correctly generating what I'm expecting and
>> doesn't look like it has removed anything, but am I missing something?
>>
>>
>>
>>
>> --
>> Sent from: http://forum.openscad.org/
>>
>> _______________________________________________
>> OpenSCAD mailing list
>>

> Discuss@.openscad

>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

kevfquinn
In reply to this post by fred_dot_u
I'm assuming the processing that issues the warning becomes cached, so the
warning only appears the first time. I think that makes sense for warnings
(which don't prevent processing from completing successfully).


fred_dot_u wrote

> I pasted your code into the latest release, hit F5 and got the same error.
>
> Changing the first scale vector to 1.0 turned it into a cube, but
> returning
> the code to 0.0, F5 generated the triangle shape and no error. Erasing the
> code, re-pasting it and F5 generated no error, but closing the program,
> re-opening, re-pasting makes the error again.
>
> There's something inherently wrong-feeling with a zero scaling factor,
> though, isn't there?
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

kevfquinn
In reply to this post by RayBellis
Ah; so what's probably happening is it has the five non-zero-area faces that
it's happy with, and is just warning that it computed a sixth zero-area face
on the top, which it discarded.

Which all sounds eminently sensible - in general it wouldn't be able to tell
the difference between an intentionally zero-area face and an accidentally
zero-area face, and coding in special exemptions to the warning would be the
wrong thing to do.

In which case the 0.0 scale is fine for the end of an extrusion, no need to
approximate in the source code to avoid the warning.


RayBellis wrote

> On 21/05/2019 17:32, A. Craig West wrote:
>
>> It is by far the simplest way to generate wedges and cubes, though,
>> and there is no actual 1D or 2D object, they are just a vertex or edge
>> of the final 3D object, which are both valid.
>
> They might _look_ like just a vertex or edge, but unless OpenSCAD has
> smarts I don't know about, aren't they actually four vertices (or two
> edges) occupying the same location(s).
>
> Specifying e.g. 0.001 as the scale factor should produce something
> that's physically identical, but without the degeneration to 2D or 1D.
>
> Ray
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

adrianv
In reply to this post by kevfquinn
When I do this in 2019.05 under Linux I get no geometry as a result, so it
*is* removing the geometry.  




--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

MichaelAtOz
Administrator
adrianv wrote
> When I do this in 2019.05 under Linux I get no geometry as a result, so it
> *is* removing the geometry.  

Could someone reproduce this.
Adrian can you try it on 2015.03.

It works on windows.

I'm thinking linear_extrude is just calling the 2D scale for each slice, and
the final slice is scale 0, so it just warns as it would any other scale
call.
Interestingly there is no flat top.



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: WARNING: Scaling a 2D object with 0 - removing object

adrianv
MichaelAtOz wrote
> adrianv wrote
>> When I do this in 2019.05 under Linux I get no geometry as a result, so
>> it
>> *is* removing the geometry.  
>
> Could someone reproduce this.
> Adrian can you try it on 2015.03.

I couldn't find that ancient version to install.  I tried it on RC3.1 and
RC2 and both behaved the same way: no geometry.




--
Sent from: http://forum.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: WARNING: Scaling a 2D object with 0 - removing object

MichaelAtOz
Administrator
adrianv wrote
> that ancient version

Surely you mean vintage, it is the next most recent release...may be
retro...



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!