Custom SheetFormat "Doesn't Exist" Within My Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So As the title says, in one drawing I made a custom sheet format (by right clicking a sheet name) then saved this as a document template.
I'm making a code to automate drawing creations, and in this I must change sheet formats so that the sheets don't look like crap.
Anyways, in doing so, my code with recognize and function properly if I use anyone of the default sheet formats, but fails if I use mine.
There last 2 lines of the error that it keeps throwing is:
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
Now, I have read somewhere that this error appears when the file cannot be found in memory, or is having memory issues. This leads to believe that the code doesn't think it exists. However, when I go create a file with my template file, it clearly does.
Any help would be appreciated! Thanks!
SyntaxEditor Code Snippet
Private Sub CreateDwgDoc(oModelName As String, oDrawingDoc As DrawingDocument) Dim oModel As Document Dim oDocs As Documents = ThisApplication.Documents Dim oFormat As SheetFormat oModel= oDocs.ItemByName(oModelName) oFormat = oDrawingDoc.SheetFormats.Item(7) oDrawingDoc.Activate oDrawingDoc.Sheets.AddUsingSheetFormat(oFormat, oModel, "Shee",,,)
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type