Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Finding current workspace

JamesM

New member
I am writing a script which would select a part and open it, using something like:


IL.select( "WSPI", partnumber ); // recorded step: 13
IL.startEditor( true ); // recorded step: 14



I will know the file name to assign to 'partnumber' but the script fails unless I also include a workspace name preceding it (ws1/part1.prt instead of just part1.prt). Is there a way for a script to find the current workspace name?


A related question: is there a documented list of all keywords available in Intralink scripting?
 
There are a couple of approaches to getting the current workspace, but there
is no direct way, unfortunately.


Someone on the PTC/User forum suggested a method in which the title of the
GUI window is analyzed to determine the workspace name. They found that to
be reliable. I don't have the details on it. You'll have to search those
forums for more information.


My preferred method is to use a sequence like this:
IL.deselectAll( "WSPI" );
IL.select( "WSPI", 0 );
String objs[] = IL.getSelectedObjects("WSPI");
String ws_name = objs[0].replaceAll("/.*","");


This selects the first item in the workspace (the workspace must have data
for this to work), gets the selected objects array, then strips off the
filename portion of the first array element leaving the workspace name.



As I said, there are many ways to do it and this is just one of them.



As far as Intralink Scripting commands, this page shows you how to report
all classes and methods that are available from Intralink.
[url]http://inversionconsulting.blogspot.com/2008/03/extracting-c lass-info-with-java.html[/url]


These aren't necessarily intended to be used, nor are they documented, but
they are accessible. Trying to figure it all out is a huge amount of work.



Marc
 
Thanks for the replies. I was aware of the "Reflections on Pro/INTRALINK Scripting" article - it was actually my first introduction into scripting.


I like the idea of selecting a workspace item and extracting the workspace name from it, but will have to decide if it's too risky because of the possibility that a user may start from an empty workspace.
 

Sponsor

Articles From 3DCAD World

Back
Top