discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

problem with accuracy of projection()

A
ahmad
Sun, Jul 23, 2017 9:45 PM

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.

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.
NH
nop head
Sun, Jul 23, 2017 10:01 PM

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 ahmad.razavi@gmail.com 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <ahmad.razavi@gmail.com> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
M
MichaelAtOz
Sun, Jul 23, 2017 10:16 PM

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.

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.
A
ahmad
Sun, Jul 23, 2017 10:19 PM

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

On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz oz.at.michael@gmail.com
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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

No. I want to convert it to 2D, and then generate dxf file. On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
F
fred
Sun, Jul 23, 2017 10:25 PM

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 ahmad.razavi@gmail.com wrote:

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

On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz oz.at.michael@gmail.com 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
Discuss@lists.openscad.org
http://lists.openscad.org/ mailman/listinfo/discuss_ lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <ahmad.razavi@gmail.com> wrote: No. I want to convert it to 2D, and then generate dxf file. On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com> 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 Discuss@lists.openscad.org http://lists.openscad.org/ mailman/listinfo/discuss_ lists.openscad.org _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
HJ
Hugo Jackson
Sun, Jul 23, 2017 10:26 PM

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 ahmad.razavi@gmail.com wrote:

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

On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com mailto:oz.at.michael@gmail.com> 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/ http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org mailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <ahmad.razavi@gmail.com> wrote: > > No. I want to convert it to 2D, and then generate dxf file. > > > On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com <mailto:oz.at.michael@gmail.com>> 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/ <http://www.ourfairdeal.org/> time is running out! > -- > View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html <http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html> > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A
ahmad
Sun, Jul 23, 2017 10:29 PM

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 hugo@apres.net 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 ahmad.razavi@gmail.com wrote:

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

On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz oz.at.michael@gmail.com
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/prob
lem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <hugo@apres.net> 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 <ahmad.razavi@gmail.com> wrote: > > No. I want to convert it to 2D, and then generate dxf file. > > > On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com> > 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/prob >> lem-with-accuracy-of-projection-tp21916p21918.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
HJ
Hugo Jackson
Sun, Jul 23, 2017 10:38 PM

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 ahmad.razavi@gmail.com 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 <hugo@apres.net mailto:hugo@apres.net> 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 <ahmad.razavi@gmail.com mailto:ahmad.razavi@gmail.com> wrote:

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

On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com mailto:oz.at.michael@gmail.com> 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/ http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html
Sent from the OpenSCAD mailing list archive at Nabble.com http://nabble.com/.


OpenSCAD mailing list
Discuss@lists.openscad.org mailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org mailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <ahmad.razavi@gmail.com> 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 <hugo@apres.net <mailto:hugo@apres.net>> 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 <ahmad.razavi@gmail.com <mailto:ahmad.razavi@gmail.com>> wrote: >> >> No. I want to convert it to 2D, and then generate dxf file. >> >> >> On Sun, Jul 23, 2017 at 3:16 PM, MichaelAtOz <oz.at.michael@gmail.com <mailto:oz.at.michael@gmail.com>> 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/ <http://www.ourfairdeal.org/> time is running out! >> -- >> View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html <http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21918.html> >> Sent from the OpenSCAD mailing list archive at Nabble.com <http://nabble.com/>. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
M
MichaelAtOz
Sun, Jul 23, 2017 10:45 PM

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!

View this message in context: http://forum.openscad.org/problem-with-accuracy-of-projection-tp21916p21924.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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