Hey All,
I'm trying to save a file as "PartNumber-SequenceNumber" with iLogic code. For example, 12345678-0001.ipt is how a file would be saved.
So far, what I've got is this:
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") ThisDoc.Document.SaveAs("PartNumber""-""SequenceNumber", False)
How can I do this better? Right now, I'm getting the following error code:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Thanks!
-Luke
Solved! Go to Solution.
Hey All,
I'm trying to save a file as "PartNumber-SequenceNumber" with iLogic code. For example, 12345678-0001.ipt is how a file would be saved.
So far, what I've got is this:
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") ThisDoc.Document.SaveAs("PartNumber""-""SequenceNumber", False)
How can I do this better? Right now, I'm getting the following error code:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Thanks!
-Luke
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi nealon.luke,
Something like this should work, although I didn't test it.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") ThisDoc.Document.SaveAs(PartNumber & "-" & SequenceNumber, False)
Hi nealon.luke,
Something like this should work, although I didn't test it.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") ThisDoc.Document.SaveAs(PartNumber & "-" & SequenceNumber, False)
Still getting this error even with that fix...
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Still getting this error even with that fix...
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Hi nealon.luke,
We need a path and file extension too. Also, I think you'll get an error if the file already exists, so you'd want to check for that as well.
Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") oPath = "C:\TEMP\" ThisDoc.Document.SaveAs(oPath & PartNumber & "-" & SequenceNumber & ".ipt", False)
Hi nealon.luke,
We need a path and file extension too. Also, I think you'll get an error if the file already exists, so you'd want to check for that as well.
Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim PartNumber As String Dim SequenceNumber As String PartNumber = iProperties.Value("Project", "Part Number") SequenceNumber = iProperties.Value("Custom", "Sequence Number") oPath = "C:\TEMP\" ThisDoc.Document.SaveAs(oPath & PartNumber & "-" & SequenceNumber & ".ipt", False)
Autodesk should update the code snippit then.. The snippit just says
ThisDoc.Document.SaveAs(NewFileNameAndExtension , True)
Should be this
ThisDoc.Document.SaveAs(PathAndNewFileNameAndExtension , True)
Autodesk should update the code snippit then.. The snippit just says
ThisDoc.Document.SaveAs(NewFileNameAndExtension , True)
Should be this
ThisDoc.Document.SaveAs(PathAndNewFileNameAndExtension , True)
Hi mcgyvr,
You're not wrong.
There are several areas in the iLogic tools and documentation that need:
Overall some attention is needed to bridge the communication gap between the Autodesk iLogic developers who create and document the iLogic tools and the iLogic users, particularly new iLogic users.
In the past it seemed to me that much of the documentation, certification material, etc. was handed from software engineers who had never used the tools in a real world situation, to technical writers who had never used the tools in a real world situation. Resulting in vague and ambiguous documentation. The iLogic documentation has that feel about it.
To be fair though, I think iLogic has been used above and beyond what the Autodesk iLogic developers had in mind originally, as Inventor users have bent it to our will. In any case, it needs and deserves a bit of attention at this point, IMHO.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi mcgyvr,
You're not wrong.
There are several areas in the iLogic tools and documentation that need:
Overall some attention is needed to bridge the communication gap between the Autodesk iLogic developers who create and document the iLogic tools and the iLogic users, particularly new iLogic users.
In the past it seemed to me that much of the documentation, certification material, etc. was handed from software engineers who had never used the tools in a real world situation, to technical writers who had never used the tools in a real world situation. Resulting in vague and ambiguous documentation. The iLogic documentation has that feel about it.
To be fair though, I think iLogic has been used above and beyond what the Autodesk iLogic developers had in mind originally, as Inventor users have bent it to our will. In any case, it needs and deserves a bit of attention at this point, IMHO.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Can't find what you're looking for? Ask the community or share your knowledge.