Hello
We use two counters for the unique naming of CAD files that we save in the ePDM VAULT (P-XXXXXX.sldprt and A-XXXXXX.sldasm). Our CAD files are all backed up in the vault without exception.
I am developing an in-house application that will generate new files that will have to be saved in the vault. So I need access to the meters.
I would like to do it properly, that is to say, not to write directly in XML files. Otherwise I would not be able to say anything about the competing access of these meters.
I discovered the presence of the SmartCounter.dll file. What an interesting name, isn't it? Is there any associated documentation?
Kind regards
Hello
If you are making an application via the PDM API, unless I'm mistaken, you can look in the help on the GetSerialNumberNames side, it allows you to access the counters.
1 Like
Hello
To take a number from ePDM see the example : Creating Serial Numbers
and also the example at the bottom of this page: Value Property
Hello
Thank you for your answers and sorry for my lack of precision. Our meter number is given by the smartproperty and does not use EPDM tools like serial numbers. The counters are defined in an xml file stored outside the vault (on a windows share).
<Counters>
<Counter name="NomFichierPrt" id="Incrementing0" Auto="0" AutoName="" type="1">
<Value value="55413" StartValue="0" step="1" />
<Custom value="" SeparatorList=";" LinkFileList="False" />
<Format value="P-0000000#" />
</Counter>
<Counter name="Incrementing" id="Incrementing" Auto="0" AutoName="" type="1">
<Value value="0" StartValue="0" step="0" />
<Custom value="" SeparatorList=";" LinkFileList="False" />
<Format value="0#" />
</Counter>
<Counter name="NomFichierAsm" id="Incrementing1" Auto="0" AutoName="" type="1">
<Value value="86557" StartValue="0" step="1" />
<Custom value="" SeparatorList=";" LinkFileList="False" />
<Format value="A-0000000#" />
</Counter>
</Counters>
In this case, the xml file is made for that.
Just increment 'Value value="55413" ' in the
Do we write directly to the file? Isn't there a risk with concurrent access? Do I need to create a '.lock' lock file?
uses FileShare.None:
bool success = false;
while (!success)
{
try
{
using(Stream file = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
// Read current content from file.
// Make changes
// Save new content to file.
}
success = true;
}
catch(IOException e)
{
// Someone else was modifying the file or another IO exception.
}
}
OK. I think it's going to do it.
I'll make a "feedback" comment when I've advanced my dev.
Thank you and have a good weekend.