Ok, I've banged my head against this for a while today and need a quick hand. How do I open a part?
Here is my problem.
I need to open a part via a command line based application. Read in some attributes on the part. Finally I need to close the part. I thought I had this and then I found out I'm being screwed by two disimilar types.
PartCollection seems to have the needed open file functionality to open a *.prt file. Part has the ".getStringAttribute" which is what I need to pull the needed data (for now lets say I want the "DB_NAME_REV" property).
What is the solution here? Is there a way to open a part under the "Part" type? Is there a ".getStringAttribute" under PartCollection? Is there a method I need to convert "PartCollection" to "Part"?
BTW, the examples here are useless as they show using PartCollection functions on Part, which throws a java error.
I assume you are using Java for Scripting your tool. If you want to open a part file in a commandline application, you have to specify the part file on the commandline. Then you connect to the Session and open the part file as follows:
Session theSession = (Session)SessionFactory.get("Session");
basePart = theSession.parts().baseWork();
The part collection allows to access all parts in the open session if you have loaded an assembly.
On what examples are you referring in your post?
You use the part collection to open parts, all methods of the part collection return part objects.
You use the part methods on the returned part objects, there is no need to convert anything.
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk Testing: NX12.0
How to Get the Most from Your Signature in the Community