CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[PyFoam] STL Utility problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2015, 15:36
Default STL Utility problem
  #1
New Member
 
Nejc Brelih
Join Date: Apr 2013
Posts: 5
Rep Power: 12
NejcB is on a distinguished road
Dear All,

I would like to use the the pyFoamSTLUtility.py to join several stl files in one file. However when I run the command "pyFoamSTLUtility.py cat file1.stl file2.stl" I receive an error message saying:

Error in /usr/local/bin/pyFoamSTLUtility.py : FatalError in PyFoam: 'PyFoam FATAL ERROR on line 478 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PyFoamApplication.py: Specify either --to-stdout or --stld-file' in Application-class: STLUtility

To me it looks there is a problem with file streams but based on the error code I am not able to debug it. I was also thinking that there may be simply a syntax problem and that the syntax of my command is not right (e.g. some bracket missing etc.). Then since it may be stream related I tried to use it with binary and ascii stl formats but I get the same error message in both cases.

Does someone, who has already successfully been using this app tell me if you can see a mistake I am doing?

Thanks in advance,
Nejc
NejcB is offline   Reply With Quote

Old   February 4, 2015, 02:24
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I am not a specialist in pyFoam but if you look at STLUtility.py:

Code:
...
        # Add option groups to parsers
        for cmd in [joinCmd,removeCmd,mergeCmd]:
            outOpts=OptionGroup(cmd.parser,
                                "Write Options",
                                "Where the resulting STL is written to")
            outOpts.add_option("--to-stdout",
                               action="store_true",
                               dest="stdout",
                               default=False,
                               help="Instead of writing to file write to stdout (used for piping into other commands)")
            outOpts.add_option("--force-write",
                               action="store_true",
                               dest="forceWrite",
                               default=False,
                               help="Force writing if the file already exists")
            outOpts.add_option("--stl-file",
                               action="store",
                               dest="stlFile",
                               default=None,
                               help="Write to this filename")
            cmd.parser.add_option_group(outOpts)
...
So the error you get is due to missing output option. Utility does not know where to write resulting file.
alexeym is offline   Reply With Quote

Old   February 4, 2015, 02:48
Default
  #3
Member
 
Peter
Join Date: Feb 2015
Location: New York
Posts: 73
Rep Power: 11
opedrofunk is on a distinguished road
For a quick fix, you might also just append one (or more) stl files to one another:

Code:
cat file*.stl > combined.stl
Hope that helps!
Peter
opedrofunk is offline   Reply With Quote

Old   February 5, 2015, 07:53
Default
  #4
New Member
 
Nejc Brelih
Join Date: Apr 2013
Posts: 5
Rep Power: 12
NejcB is on a distinguished road
Thank you, indeed the > fileOut.stl syntax is needed for successful operation.

The problem is solved.
NejcB is offline   Reply With Quote

Old   February 7, 2015, 06:17
Default
  #5
New Member
 
Nejc Brelih
Join Date: Apr 2013
Posts: 5
Rep Power: 12
NejcB is on a distinguished road
Dear All, I was a bit too quick while replying for the first time because I only noticed that there had been no more error thrown in the terminal and that a new file got created if you use "> fileOut.stl" but when I opened the file I found out that it's just the error message that gets flushed to that new file.

Then I experimented a bit and I found out that the following code works well:

Code:
pyFoamSTLUtility.py join fileIn1.stl fileIn2.stl fileIn3.stl ... --stl-file fileOut.stl
Where fileOut.stl is the merged stl.

The utility works on ascii stl file but not on the binary version of files.

Best regards,
Nejc
NejcB is offline   Reply With Quote

Reply

Tags
pyfoam, stl file


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in compiling the makeAxialMesh utility Belmar OpenFOAM Programming & Development 1 July 18, 2017 15:17
[SOWFA] Problem Defining terrainBlockMesherDict, point swl to stl chusma OpenFOAM Community Contributions 0 April 11, 2017 04:59
Sample utility - file name indexing problem sepponen OpenFOAM Post-Processing 0 July 28, 2016 06:58
sample utility problem And OpenFOAM Post-Processing 36 May 20, 2014 08:50
perturbU Utility for cylindrical problem DaSh OpenFOAM Pre-Processing 0 October 1, 2013 05:48


All times are GMT -4. The time now is 21:03.