Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to launch UG external applications through GRIP

Status
Not open for further replies.

shimuk

Mechanical
Jul 5, 2007
8
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?
 
Replies continue below

Recommended for you

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
 
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?
 
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
 
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...
 
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
 
This seems to work for me.

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor