Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
constantin3x
465 Views, 6 Replies

Post Processor - CAD file name as a comment including file name extensions

So in the HSM Post Forum I found how to add the CAD file as a comment, however that does not fully accomplish what I needed as I would like to see the extensions of the file I used as well. I am using Creo files that end in .prt.VersionNumber, as in .prt.1 for version 1 or prt.15 for version 15.

 

I can see on the side window that it sees the extension names, I am hoping I can include this on the NC file as well.

constantin3x_0-1680535638136.png

This is the code I found and works fine but for the importing the CAD file name but it does not include any extensions.

//file name
var documentPath = getGlobalParameter("document-path");
writeComment(documentPath);

 

Does anyone know if its possible?

 

 

 

seth.madore
in reply to: constantin3x

I don't think this is possible..


Seth Madore
Customer Advocacy Manager - Manufacturing
constantin3x
in reply to: seth.madore

Fair enough, thank you for the reply Seth

DarthBane55
in reply to: constantin3x

Not sure if it is 100% what you are after, but I output this:

(POSTED FROM FILE=10048-M1-M2.MC1.IAM) (which is an Inventor file).

I get that output with this code:

 

var inventorFileName = FileSystem.getFilename(getGlobalParameter("document-path"));

writeComment("POSTED FROM FILE=" + inventorFileName);

 

Similar to your code, but it gets it from FileSystem...  This also works in Fusion, I use it there too, just change the variable name.

DarthBane55
in reply to: DarthBane55

I just tried it in Fusion, and it works.

My file was called 6392-M2.35V, and it was version 8 in fusion, the comment output was this:

(POSTED FROM=6392-M2.35V V8)

I think this is what you were after.

constantin3x
in reply to: DarthBane55

Not quite, I tried your code however it returns the same thing, that is the file name and the Fusion version number.

Probably because as soon as you upload a third part model, i.e. STEP or .PRT it creates its own file and associates that?

Instead of the actual file name I am looking for the filename which the solid model was imported from. so for example, on the left view panel, when you expand the version list, the very first version shows from which file this was imported from.

constantin3x_0-1680645342567.png

Trying your code returns POSTED FROM=222-091-pcb-base v19 which was the last Fusion file version, not the imported model one's. 

DarthBane55
in reply to: constantin3x

Gotcha, sorry, probably like Seth said, or at least I don't know myself how to do it.  I misunderstood the initial request.