problem with accuracy of projection()

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

problem with accuracy of projection()

amati
I am new to openscad. I want to project a 3d object into 2d. I used this:

projection()  import(filename);

My input file(zipped stl) is attached. The projection has a very low accuracy. Am I missing something?

P.S: I used the scale([1,1,0]) instead of projection, and it worked pretty well. but I know the output of scale is still a 3D object. I need 2D.

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

4.zip (102K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

nophead
There is a bug in OpenSCAD with tiny 2D objects. Scaling up the import, doing the projection and scaling it down again will probably work.

On 23 July 2017 at 22:45, ahmad <[hidden email]> wrote:
I am new to openscad. I want to project a 3d object into 2d. I used this:

projection()  import(filename);

My input file(zipped stl) is attached. The projection has a very low accuracy. Am I missing something?

P.S: I used the scale([1,1,0]) instead of projection, and it worked pretty well. but I know the output of scale is still a 3D object. I need 2D.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

MichaelAtOz
Administrator
In reply to this post by amati
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the projection?
Admin - PM me if you need anything,
or if I've done something stupid...

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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

amati
No. I want to convert it to 2D, and then generate dxf file.


On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <[hidden email]> wrote:
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the
projection?



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

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!
--
View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

fred_dot_u
Just a wild guess here, but do you know that when you render the model (F6), it will become 2D?



On Sunday, July 23, 2017, 6:20:59 PM EDT, ahmad <[hidden email]> wrote:


No. I want to convert it to 2D, and then generate dxf file.


On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <[hidden email]> wrote:
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the
projection?



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

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!
--
View this message in context: http://forum.openscad.org/ problem-with-accuracy-of- projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

______________________________ _________________
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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

boxcarmib
In reply to this post by amati
Right, so do the following….

scale([1/500,1/500])
projection()
scale([500,500,1])
import(filename);

Then export it as a dxf file.
Note that the scaling of [1/500,1/500] only operates on two of the vertices so it preserves the 2 dimensional projection.

On Jul 23, 2017, at 3:19 PM, ahmad <[hidden email]> wrote:

No. I want to convert it to 2D, and then generate dxf file.


On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <[hidden email]> wrote:
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the
projection?



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

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!
--
View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

amati
worked pretty well. but I am not sure how much I have to scale up an object to resolve the problem.

On Sun, Jul 23, 2017 at 3:26 PM, Hugo Jackson <[hidden email]> wrote:
Right, so do the following….

scale([1/500,1/500])
projection()
scale([500,500,1])
import(filename);

Then export it as a dxf file.
Note that the scaling of [1/500,1/500] only operates on two of the vertices so it preserves the 2 dimensional projection.

On Jul 23, 2017, at 3:19 PM, ahmad <[hidden email]> wrote:

No. I want to convert it to 2D, and then generate dxf file.


On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <[hidden email]> wrote:
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the
projection?



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

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!
--
View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: problem with accuracy of projection()

boxcarmib
Well that would all depend on what your end use is I suppose. I mean, the current size of the object is so tiny its not like you’d be getting worthwhile results on a 3D FFM printer.
It’s a little like adjusting the $fa, $fs and $fn values… it all depends on what you’re using it for.
If you’re doing a lot of this kind of thing, you could write a general purpose module that could (for example) take a scaling factor from the current value of say $fn. something like this….

module dxf_prepare() {
scaleFactor = $fn * 50;
scale([1/scaleFactor, 1/scaleFactor])
projection()
scale([scaleFactor, scaleFactor, 1])
children();
}

then you could do what you require with:

dxf_prepare()
import(filename);

and then adjust $fn to give you the results you want, either globally…

$fn = 50;
dxf_prepare()
import(filename);

or just for the module call:

dxf_prepare($fn = 50)
import(filename);


On Jul 23, 2017, at 3:29 PM, ahmad <[hidden email]> wrote:

worked pretty well. but I am not sure how much I have to scale up an object to resolve the problem.

On Sun, Jul 23, 2017 at 3:26 PM, Hugo Jackson <[hidden email]> wrote:
Right, so do the following….

scale([1/500,1/500])
projection()
scale([500,500,1])
import(filename);

Then export it as a dxf file.
Note that the scaling of [1/500,1/500] only operates on two of the vertices so it preserves the 2 dimensional projection.

On Jul 23, 2017, at 3:19 PM, ahmad <[hidden email]> wrote:

No. I want to convert it to 2D, and then generate dxf file.


On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <[hidden email]> wrote:
I scaled it by 1000 in netFabb and it looked much better.
Also the object is not flat(~45degrees in XY), is that why you are doing the
projection?



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

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!
--
View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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


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

Re: problem with accuracy of projection()

MichaelAtOz
Administrator
In reply to this post by amati
It depends what you want to do with it.
While stl files are technically unit-less, most tools presume mm.
The 4.stl is 0.12  0.13 x 0.09 mm, so sending that to a typical machine (CNC, laser cutter etc), is not going to be useful.
So if the item is meant to be 12 x 13 cm then scale(1000) etc.
Admin - PM me if you need anything,
or if I've done something stupid...

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!
Loading...