SimplifiedLogic / creoson

OpenSource Automation using JSON Transactions for PTC's CREO Parametric
http://www.creoson.com
MIT License
79 stars 23 forks source link

Get Path of active files #77

Closed DieSwartKat closed 2 years ago

DieSwartKat commented 2 years ago

Hallo Guys

Does anyone know if there is a way to get the path (folder directory in windows) to a part or assembly that is open in CREO at the moment. I'm specifically looking for parts that are not in the working directory, but has been assembled into the model.

I'm assuming the drawing of that part will be in the same folder and therefore want to know the folder so that I can find the drawings.

phaleth commented 2 years ago

Hi,

Not sure about Creoson, but for J-Link I've found two following examples that are sort of interchangeable.

Window currentWindow = session.GetCurrentWindow();
Model currentModel = currentWindow.GetModel();
ModelDescriptor currModelDescr = currentModel.GetDescr();
// Path without the disk letter, without colon
// and with trailing backslash
String fullPath = currModelDescr.GetPath();
Model activeModel = session.GetActiveModel();
ModelDescriptor actModelDescr = activeModel.GetDescr();
// Full path without trailing backslash
String fullPath = actModelDescr.GetDevice() + ":" + actModelDescr.GetPath();
davidhbigelow commented 2 years ago

file : get_fileInfo?

Does that work?

On Tue, Apr 26, 2022 at 05:57 DieSwartKat @.***> wrote:

Hallo Guys

Does anyone know if there is a way to get the path (folder directory in windows) to a part or assembly that is open in CREO at the moment. I'm specifically looking for parts that are not in the working directory, but has been assembled into the model.

I'm assuming the drawing of that part will be in the same folder and therefore want to know the folder so that I can find the drawings.

— Reply to this email directly, view it on GitHub https://github.com/SimplifiedLogic/creoson/issues/77, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMSRJNNV2A4OUK7TGM46ZLVG64X3ANCNFSM5ULJBE5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- David Bigelow, President Simplified Logic, Inc https://www.simplifiedlogic.com | SimilarParts.ai C: 317-431-5454

adama2000 commented 2 years ago

Yes, the file : get_fileinfo should work, it returns file, dirname, and revision for the requested model.