Issue11 2 #253

Closed
wants to merge 87 commits into
from

Conversation

Projects
None yet
3 participants
@donbright
Member

donbright commented Jan 26, 2013

Hi Marius

This is a proposed fix for issue #11 , cmdline output of images from OpenSCAD.
Currently it only works on CGAL, and has only been tested under Linux and Wine
I am submitting this now to see what you think - before I go any further down the road to get OpenCSG and --viewport working.

usage:

   openscad -o image.png file.scad --render

(In the future, omitting '--render' will cause OpenCSG to be used)

The patch is highly experimental - I had to refactor quite a bit. The big changes are as follows:

A. Rewrite the Offscreen PNG writing code to use std::ostream instead of filename
(because all other output, like STL, DXF, etc, was based on passing std::ostreams so I stuck with that convention)

A.1. This meant rewriting some of the Mac OSX code (imageutils-macosx.cc) when I don't actually have access to a Mac. I am very unsure about this.... but I tried to copy other examples I have seen of creating a DataConsumer from an std::ostream

A.2. I also refactored quite a bit of the image writing code in OffscreenContext.* and imageutils* to reduce duplication of code

B. Move a bunch of code from the Test Suite to the main 'src' directory

C. Refactor the Test Suite to actually be able to test against the gui cmdline.

I went for the 'most direct, easiest' approach here - I simply copied all the "regression/cgalpngtest" images to "regression/guicgalpngtest" and created a "guicgalpngtest" shell wrapper to 'fool' the existing infrastructure into calling the already-built GUI openscad binary using the '-o' parameter. This did reveal one issue with the "root modifier" (! character), which caused more refactoring of node.cc and several other files.

It is very inefficient space-wise for now to have duplicate sets of test images, but for now it works. In fact it enables the running of 'guicgalpngtest' without having to run 'make' under the testing directory and build all the other tests. For example -

     git submodule update --init # MCAD
     qmake && make
     cd tests && mkdir bin && cd bin && cmake ..
     ctest -R guicgalpngtest 

Gives a 100% pass. (for some reason tests in the SRC dir itself dont find MCAD)

Please let me know what you think...

donbright added some commits Jan 24, 2013

@kintel

This comment has been minimized.

Show comment Hide comment
@kintel

kintel Jan 28, 2013

Owner

woah, that sounds awesome! I'll give it a spin and report back if I find any issues.

Owner

kintel commented Jan 28, 2013

woah, that sounds awesome! I'll give it a spin and report back if I find any issues.

@kintel

This comment has been minimized.

Show comment Hide comment
@kintel

kintel Jan 28, 2013

Owner

It now builds on Mac. I just tested one random model and it worked - will look more into details later.

Owner

kintel commented Jan 28, 2013

It now builds on Mac. I just tested one random model and it worked - will look more into details later.

@kintel

This comment has been minimized.

Show comment Hide comment
@kintel

kintel Jan 30, 2013

Owner

Copying the OpenSCAD binary to the cmake binary dir causes it not to find MCAD since it looks for MCAD relative to its own location. I'm not sure if this copy is actually needed though.

Owner

kintel commented Jan 30, 2013

Copying the OpenSCAD binary to the cmake binary dir causes it not to find MCAD since it looks for MCAD relative to its own location. I'm not sure if this copy is actually needed though.

@donbright

This comment has been minimized.

Show comment Hide comment
@donbright

donbright Jan 30, 2013

Member

I shouldn't have made the wrapper a shell script --- i had forgotten about Windows. . . .

The only other thing I can think of is to alter test_cmdline_tool.py . . . there's probably some relatively clean way to do it ... and get rid of the shell script alltogether. . . .

Member

donbright commented Jan 30, 2013

I shouldn't have made the wrapper a shell script --- i had forgotten about Windows. . . .

The only other thing I can think of is to alter test_cmdline_tool.py . . . there's probably some relatively clean way to do it ... and get rid of the shell script alltogether. . . .

@donbright

This comment has been minimized.

Show comment Hide comment
@donbright

donbright Feb 1, 2013

Member

OK, I think this is ready for re-review ... I will hold off on opencsg png export until you think the refactor is good....

Member

donbright commented Feb 1, 2013

OK, I think this is ready for re-review ... I will hold off on opencsg png export until you think the refactor is good....

kintel and others added some commits Feb 7, 2013

@donbright

This comment has been minimized.

Show comment Hide comment
@donbright

donbright Feb 24, 2013

Member

closing. i had to add some compatability for win32 and am in the middle of doing opencsg. will re-request pull later.

Member

donbright commented Feb 24, 2013

closing. i had to add some compatability for win32 and am in the middle of doing opencsg. will re-request pull later.

@donbright donbright closed this Feb 24, 2013

@kintel

This comment has been minimized.

Show comment Hide comment
@kintel

kintel Apr 2, 2013

Owner

This looks a bit weird: Two identical assignments after each other. It looks like the one below is not actually doing anything, apart from redoing the evaluate and tossing the results?

Owner

kintel commented on src/openscad.cc in 6535b16 Apr 2, 2013

This looks a bit weird: Two identical assignments after each other. It looks like the one below is not actually doing anything, apart from redoing the evaluate and tossing the results?

This comment has been minimized.

Show comment Hide comment
@donbright

donbright Apr 2, 2013

Member

agreed... i will do a patch tonight

Member

donbright replied Apr 2, 2013

agreed... i will do a patch tonight

@kintel

This comment has been minimized.

Show comment Hide comment
@kintel

kintel May 24, 2013

Owner

win32* doesn't trigger for me.
If I change it to "win*", "win32" or "windows", it works.
I'm not sure what the * is supposed to do..

(using the MXE environment on a Mac)

Owner

kintel commented on openscad.pro in 1bec7aa May 24, 2013

win32* doesn't trigger for me.
If I change it to "win*", "win32" or "windows", it works.
I'm not sure what the * is supposed to do..

(using the MXE environment on a Mac)

This comment has been minimized.

Show comment Hide comment
@GilesBathgate

GilesBathgate May 24, 2013

Contributor

There is nothing in the relevant QT documentation that suggests scopes can match wildcard expressions. Yet you say 'win_' works? Prehaps it was intended to match 'win32' and 'win64'? in which case 'win_' is correct anyway.

Contributor

GilesBathgate replied May 24, 2013

There is nothing in the relevant QT documentation that suggests scopes can match wildcard expressions. Yet you say 'win_' works? Prehaps it was intended to match 'win32' and 'win64'? in which case 'win_' is correct anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment