cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a part has changed on disk

Genius
Genius

How can I check if a part has changed on disk since it was loaded?

The Part/Loaded Parts information shows that info (see attachment), but how can I get it from the API?

 

Regards

Jan

 

Jan Böttcher
7 REPLIES

Re: How to check if a part has changed on disk

Siemens Legend Siemens Legend
Siemens Legend

Hi ijb,

 

I think the following part method should help:

part.GetHistoryInformation()

 

Boris

Re: How to check if a part has changed on disk

Genius
Genius

Thank you Boris, but I don't have a clue how to realize it with GetHistoryInformation.

GetHistoryInformation lists information about the current loaded part and shows the same information before and after the part has changed on disk.

Comparing the timestamp with the modification date of the file isn't a solution because it is only given in minutes.

Am I missing something?

 

Regards

Jan

 

Jan Böttcher

Re: How to check if a part has changed on disk

Valued Contributor
Valued Contributor

try

ufs.part.ismodified(part_tag)

Re: How to check if a part has changed on disk

Genius
Genius

Thank you mark, but isModified is true if the part is modified in the current session. It does not say anything about the state of the partfile on the disk.

 

Regards

Jan

 

Jan Böttcher

Re: How to check if a part has changed on disk

Esteemed Contributor
Esteemed Contributor

You can use ug_inspect to get the history information of a part on disk.

 

You would then parse the output to get the version number of that part:

V10 filing history:
  Version  Save Time          Machine     User             Program
  -------  ---------          -------     ----             -------
       10  05-Feb-2009 15:31  NT x64      Stefan.Pendl     NX 4.0.4.2
        9  03-Feb-2009 13:21  NT x64      Stefan.Pendl     NX 4.0.4.2

Using the version information retrieved by GetHistoryInformation() you should be able to determine if the part has changed on disk, which means the part on disk has a different version number than the loaded one.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
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: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: How to check if a part has changed on disk

Genius
Genius

Thank you for pointing to the ug_inspect.exe for examining the disk file. Not nice since I have to rely on the output format but it is a working solution.

 

Regards

Jan

Jan Böttcher

Re: How to check if a part has changed on disk

Esteemed Contributor
Esteemed Contributor

It would be nice to have an API method to get the version number from the part on disk as it is done with the internal checks used at the time of saving a part.

May be an enhancement request is in order for this.

 

The phrase "V10 filing history" is always there and there is also always the line with multiple dashes, so you can set a flag if you encounter the phrase and read in the next line immediately and you encounter a line containing three continuous dashes.

This next line will be the one with the highest version number as the first space-separated field.

This should be fairly easy to parse.

 

Creating the ER might also allow a GTAC engineer to come up with a more advanced solution.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
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: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community