Need help with some type of rule(s) that can do the following within a dwg in inventor. I created code that can locate the path where the xml file lives (XMLFileName As String) but i need two rules to toggle the xml to read only on and off. Here are the details of the process I am trying to achieve.
- Button (triggers rule #1) is clicked and checks if the xml file is read only, if yes msgbox, if no it then loads the xml file first and then sets it to read only. This will then open a form that when upon completion you will click a button (triggers rule @#2) set the xml file to read write and then save over that xml using
iLogicVb.Automation.ParametersXmlLoad(ThisDoc.Document, XMLFileName)
and complete.
-Thanks in advance
@Anonymous,
To check the readonly xml file, try suggestion in below blog link.
https://docs.microsoft.com/en-us/dotnet/api/system.io.fileinfo.isreadonly?view=netframework-4.8
Try below VB.net code to read, write and save xml file.
https://www.codeproject.com/Articles/1222133/Reading-and-Writing-XML-in-Csharp-VB-Net
iLogic code is similar to VB.net code.
Thanks and regards,
I was able to find the solution, the reference files you posted were helpful. Thanks!
Posting solution below.
IO.File.SetAttributes("file.txt",IO.FileAttributes.ReadOnly) 'sets file.txt to read only
IO.File.SetAttributes("file.txt",IO.FileAttributes.Normal) 'sets file.txt to read-write
Can't find what you're looking for? Ask the community or share your knowledge.