Clarifying License Setup for Siemens NX 8.5 Installation (University of Maryland)

The University of Maryland was recently given a $750 million software grant for the popular Siemens Product Lifecycle Management (PLM) software. After reading the article, I decided to install the software.

My experience should primarily help UMD students (who may legally download the software after logging in to the UMD portal), though I found a version of my solution online.

My installation of Siemens NX occurred at my home on my Windows 7 64-bit OS. The installation was straightforward, but I received a licensing error when attempting to run NX 8.5.

The instructions provided by UMD, titled “Siemens NX Windows Requirements and Instructions,” tell users to provide license information given in the document. Then, users are instructed to run the licensing options tool, selected through the path: “Start -> Siemens NX 8.5-> NX Licensing Tools->Licensing Options,” except that my path ended with “License Options.” Same difference.

The next step is to “add both the listed bundles.” I could not find the bundles that were listed in the document. I did, however, find a solution at a Rensselaer Polytechnic Institute website.

Scroll down to Common Errors with NX 8.0, to error 11), which states “When I open License Options, there is no bundle listed.” They state that there are two options for why this is happening:

  • a) ” You may have lost connection to the RPI network, otherwise see step B.”
  • b) “To fix, right select on My Computer > Properties > Advanced System Settings. Select Advanced > Environment Variables. Under System Variables, click New. For Variable name type UGS_LICENSE_BUNDLE. For the Variable value type: ACD30; ACD31”

I assumed my network was working fine, and I followed the instructions for b). Using the comparable bundles listed in the “Siemens NX Windows Requirements and Instructions” (which I will not list here for legal reasons)  I was able to get NX to start successfully. I did not have to restart after adding my environment variables.

Thanks to RPI for documenting this issue. Hopefully UMD includes an update to their instructions. Otherwise, I hope that this post helps UMD students.

Advertisements

PDF from multiple PDFs or Images! Reduce PDF size through image compression! (Mac OS X 10.7.3)

I had 3 goals at the outset:

  1. Create a PDF from an image (JPEG, TIFF, PNG, etc.)
  2. Combine PDFs into one larger PDF
  3. Reduce the image quality of the PDF to a manageable size, while preserving readability. This process is not recommended for expert resizing of pictures.
This was all completed, but more importantly, the process wasn’t what I expected. I learned how to do the above, but the way below is simpler:
  1. If you are working with only images, it is useful to highlight all images and “Open With…” then select “Preview” and then Print to PDF. It joined all my images into a single PDF.
  2. If you are working with only PDFs, you can go straight to the section I’ve written below on Multiple PDFs to PDF.
  3. Reduce the image quality of the PDF to a manageable size, while preserving readability.

But there are some advantages and disadvantages about this method in 1. because if you Print to PDF in Preview it will create a white border around all of your images in your new PDF. The alternative is to create a Service in Automator that will go through all your images and convert them to PDFs, then condense all PDFs to one PDF. I haven’t fleshed out this process yet, as I’m satisfied (i.e. unwilling to complain) with the white border.

I’ve been encumbered by the inability to create PDFs from multiple PDFs or multiple images for some time. Today I decided it would be an essential skill so I learned how to do it, and now you’re going to learn. It was another beautiful day where I felt justified in purchasing my Macbook Air. Note that the majority of this instruction was compiled from about 6-8 different websites (so you don’t have to go crazy over tiny misconceptions and errors), so I thought I would throw it all into this one!

Some helpful sites (but note that my write-up is a condensed version of all of these sites to save you some time):

Create PDFs from images
Multiple Page PDF from PDFs
Combine PDF files Service
Reduce file size through quality
Resolving Quartz Filter Issues

Multiple PDFs to PDF

  • We’re going to use the built-in tool “Automator” to get things done. You can access Automator by going to your Launchpad and then clicking on Automator.
  • “Choose a type for your document:” immediately pops up, so you’re going to want to choose “Service.”
  • “Drag actions or files here to build your workflow” is the location where you will drag commands that will execute sequentially (top to bottom). Those commands can be accessed from the left-hand side where you see the library for Actions and Variables. The easiest way to find your desired action is by searching. There is a search bar next to “Actions” “Variables” in the top left of your Automator screen.
  • There is a section above the workflow area that says “Service receives selected” and has a drop-down menu. From the drop-down, select “PDF Files.” You’ll notice that to the right, “in any application” is selected, and should be fine.
  • First, we’ll search and add Combine PDF Pages to our workflow. Make sure “Appending Pages” radio button is selected if desired. Note that there are “Options” you can look choose from. Explore all the options just so you feel comfortable with the workflow.
  • Then search and add to workflow “Copy Finder Items.” I usually send the Finder items to Desktop. I do not check “Replace existing files.”
  • Then search and add to workflow “Rename Finder Items.” You can change the “Add Date or Time” pulldown to whatever naming convention customization you’d like. You should look at options and select “Show this action when the workflow runs.”
  • Finally, search and add to workflow “Move Finder Items.” I usually default moving the items to my Desktop.

After you’ve completed these steps, go to File and then Save! I saved mine as “Combine PDFs.”

These are the workflow steps within Automator to Combine PDFs.

Once you’ve closed Automator, test our your new Service. Highlight multiple PDF files and then Control + Click them to bring up several Finder options, and then scroll down to Services, where you should see Combine PDFs as one of the options.

Select your PDFs and ctrl+click, select Services, then select Combine PDFs and you’re done!

Let me know if it didn’t work for you in the comments and we’ll sort it out! Make sure you execute all the steps correctly before you accuse me of shenanigans!

Custom Reduction of Image Quality Using ColorSync Filters

I needed to reduce a PDF that I combined from something outrageous (like 200 MB to 600 MB) to something manageable (like 2-6 MB). How can we reduce the order of magnitude by 2 and still have recognizable quality? I had the same question. It turns out for practical purposes, if someone scanned a page of writing in very high TIFF quality (each image ~15 MB), they’ve overdone it. So let’s get it back to something more manageable.

I created a custom ColorSync filter, first. Later, this filter will be applied to my really long PDF as a postprocessing step.

  • Open ColorSync by going to your “Launchpad” –> “Utilities” –> “ColorSync Utility.”
  • When you open ColorSync, navigate to Filters on your new window.
  • You’ll notice a little “+” button at the bottom left of your new window. You’ve now added a custom filter. Give it a name.
  • Use the small drop down arrow to the right of your new Filter and select “Add Image Effects Component” and then select “Image Compression.”
  • Navigate to your new filter and expand it. Change the Mode of Image Compression to “JPEG” from the drop-down. I’ve made three filters reducing file sizes from high quality to above-average quality, middle quality, and below average quality. As far as I know, these filters are written (saved) as you make the adjustments. I have found the Reduce File Size High to Below Average (placing Quality at the 1/4 mark between Min and Max to yield the best results).
  • Close the Filters window, but stay in ColorSync Utility. Create a backup of your desired PDF just in case. Open your desired PDF using ColorSync Utility (go to File –> Open). If you do this, at the bottom you’ll notice there is a Filter option. Change the Filter to your desired new created filter, and then hit Apply!
  • File –> Save a copy of your new file! Now hopefully your file is easier to deal with.
For the compression type:

Choose your type of Filter for the PDF.

And for the Filters:

Create your Filters by using ColorSync Utility.

Good luck!

Installing gcc and gfortran for Mac OS X (10.7.3)

Things you’ll need:

  • Knowledge of how to use the terminal
  • An internet connection
  • A Mac developer account (you can get this as we go along)
  • Copy of Xcode (free)
  • About an hour of your time (30 minutes downloading, 15-30 minutes doing things)

Basic steps:

  1. Download and install Xcode
  2. Download command line tools
  3. Download and install gfortran from other source
Note that if you attempt to only download and install gfortran without gcc you might get the following error!

error trying to exec `as': execvp: No such file or directory

Also note that I performed this installation on a Macbook Air.

gcc

Download and install Xcode by clicking this link, or by searching for it in the Apple App Store, where it can be downloaded for free (see image).

Xcode contains gcc

After you’ve downloaded Xcode, you’ll want to open it and agree to their terms of service. Then, you’ll want to navigate to the menu Xcode –> Preferences –> Downloads. Here you’ll see an option to download Command Line Tools (see image). Note that you’ll need a developer account at this stage, and I was redirected to their developer page where I had to fill out a form and create my account (using my existing Apple ID, where a lot of the form was already auto-filled).

CL Tools

Download Command Line Tools from Preferences --> Downloads

After you have successfully installed the command line tools, open your terminal and type something like:

$ which gcc

which should return the path of your gcc in /usr/local/bin. All of this should have been taken care of automatically.
gfortran

I mentioned at the beginning that I got an error when attempting to use gfortran on my machine before I’d even installed gcc. I found that gcc must be installed in order to use gfortran. But my gfortran installation went smooth because it’s very straightforward.

Download gfortran from this link.

After considering my hardware, I chose the option:

Mac OS Lion (10.7) on Intel 64-bit processors (gfortran 4.6.2): download (released on 2011-10-20)

The installation has a walkthrough that comes with the package, like many Mac installations. Straightforward and it should also work automatically. Then, open your terminal and type

$ which gfortran

and it should reveal that it was successfully installed in /usr/local/bin.

Happy programming!

Profiling a simple Fortran code with gprof

I finished working through Chapman’s Introducton to Fortran 90/95, and it was a very interesting (helpful) read. My next step is to work through Chapman’s (no relation?) Using OpenMP, but there are some performance considerations I must first address.

Therefore, I looked into gprof, which is the GNU profiling tool. It will give me an understanding of how quickly my code runs, and which tasks in the workflow are taking up the most resources. Here is what the ifort man pages say about the gprof compiler flag (note that I have a 32-bit processor for this test!):

-p
Compiles and links for function profiling with gprof(1).
Architectures: IA-32, Intel® 64 architectures
Arguments: None
Default: OFF
Files are compiled and linked without profiling.
Description: This option compiles and links for function profiling with gprof(1).
Alternate Options:
Linux and Mac OS X: -pg (only available on systems using IA-32 architecture or Intel® 64 architecture), -qp (this is a deprecated option)

That’s interesting, sure! So with that bit of knowledge, I want to apply it to a large code that might make debugging a pain. I’m going to focus on a much simpler test case (that I’m taking from Chapman’s Fortran 90/95 book, Example 6-10, pg. 340).

gprof Example with Fortran Code

The example I consider has a function called “ave_value” which calculates the average value of a function between two points first_value and last_value. “ave_value” is called by “my_function,” which is declared as external in the test driver program “test_ave_value.” It’s a very simple program with three .f90 files.

I wrote these functions based on the example given in Chapman, and then  I compiled them with the following command:

$ ifort -p ave_value.f90 my_function.f90 test_ave_value.f90 -o test_ave_value

As a reminder, the -p flag allows me to specify our gprof option, and the -o flag allows me to rename the executable.

Now that you have your executable, you can simply run it, as I did:

$ ./test_ave_value

And you’ll notice that it has generated a “gmon.out” file that can be interpreted by gprof to show you your statistics! Writing gmon.out will overwrite any previous versions that you had in the folder, so use caution. Now, run gprof to interpret the gmon.out file.

$ gprof test_ave_value > tav.output

The tav.output was my re-naming of the gprof output. Now we can view the results of gprof in tav.output, in any competent text editor.

Looking at the Numbers

There is sufficient documentation for understanding gprof numbers on their website, but I’ll hit some critical points. The outputs are separated into the Flat Profile and the Call Graph. The Flat Profile conveys how much time your program has spent executing each function. The Call Graph conveys how much time was spent in the function and its children. You can read more here.

Visualization of gprof results

A quick way to put a visualization together (per the documentation of gprof2dot):

gprof path/to/your/executable | gprof2dot.py | dot -Tpng -o output.png

Here, gprof executes your program (which you’ve already compiled and linked with the appropriate flag!). That output is piped to a program called gprof2dot, which then pipes its output to create an output file that you can view in any competent image display tool!

Note that if you download gprof2dot, you’ll need to change the permissions to ensure that it’s an executable. I tried to run the non-executable version with

$ ./gprof2dot.py

but it would not execute because the file permissions were not set to executable.

Now that I learned this, I’m going to try it on a bigger code. Happy profiling!