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?
Does anybody know if this is possible?





RE: How to launch UG external applications through GRIP
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
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
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
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
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
xspawn /prog,$
'C:\Program Files\Microsoft Office\OFFICE11\excel.exe','d:\test.xls'
halt