×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to launch UG external applications through GRIP

How to launch UG external applications through GRIP

How to launch UG external applications through GRIP

(OP)
I am interested to launch UG external applications through GRIP. To be more specific, if I use UG(NX) Windows based, can I launch for example a Microsoft Excel application through a GRIP? Let's say I have a part which has some features (holes) I want to create through a GRIP. The information I need for the holes creation are in an Excel file (a table). I am interested to be able to open the excel file while I am running the GRIP.
Does anybody know if this is possible?

RE: How to launch UG external applications through GRIP

Okay the answer is in two parts. UG is interactive with excel using spreadsheets so for that you need to look at the documentation for Spreadsheets. If you can do so then this may be the simplest option and that won't involve extra licenses for products you may not have purchased.

Yes you can launch external applications via grip, there is a command for it. However passing data back and forward from grip to excel is going to be the tough part. Grip will not read an excel formatted file. It will output a formatted table that excel could open as a text file. You may want probably create a program using VB or similar to automate that process, and lauch that instead, (this is what I did in the past). If you want to interact in the opposite direction with UG you'd need to save you results from excel as a text file and have grip open that to read in the results.

Hopefully somebody will post here with a solution for UG open programming, which how uses VB anyhow and might be a heck of a lot simpler.

Try the spreadsheets thing first. Let us know what you're trying to achieve and what version of UG you're using.

Regards

Hudson

RE: How to launch UG external applications through GRIP

(OP)
Hi,

Thank you for your reply.

As far as communicating between UG and an Excel application I have everything figured out. I am doing exactly as you mentioned: I have a VBA application which is calculating everything I need and I transfer data back and forth using text files and a GRIP. No problem with that.
My problem was related to the fact that the Excel file is an actual VBA which from what I know is not supported by UG. UG opens its own spreadsheet and I don't think I can connect an UG file with an existing Excel file which has already code within.

This is why I am interested on what is the GRIP command that launches an Excel file and not the UG spreadsheet. I was looking through the GRIP documentation and I didn't find something on this topic.
Could you please direct me to the chapter which is debating this idea? Is it the case to utilize a C or Fortran script to solve this?

RE: How to launch UG external applications through GRIP

I had to go through my old grip stuff to dig this one out, so I hope it still works.

The command was xspawn, as coded below.

xspawn/prog,'d:\test.exe'

I noticed that I wrote this in 1998, but the xspawn grip command is still included in the documentation so give it a try and I hope that it works for you.

Regards

Hudson

RE: How to launch UG external applications through GRIP

(OP)
I tried to do something similar to what you suggested.
I am getting an error message though.
What might be the reason? The fact that I am trying to open a file which is not actually an .exe (a program) and it is an Excel file? Or I might need some special license?

The error doesn't refer to the fact that the system doesn't find the file but it is an execution error...

RE: How to launch UG external applications through GRIP

A fair assumption would be that you are running windows, perhaps not XP as I am. I would have thought that you're looking for the DOS command that opens the excel file. At the command prompt I simply typed book1.xls and XP launched excel. I had though you might need a more complicated command line but it seemed not.

Failing that if you're programming xspawn/prog perhaps read the documenation once more and try xspawn/concur or some similar variant, becuase you're opening a file not running and application .exe so to speak.

I'll leave to you to test

Regards

Hudson

RE: How to launch UG external applications through GRIP

This seems to work for me.

xspawn /prog,$
'C:\Program Files\Microsoft Office\OFFICE11\excel.exe','d:\test.xls'
halt

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources