Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
I've been trying to make a program that will go thorugh an idw and seperate out each sheet, moving it to a new .idw and changing the titleblock in the process. However, every time I try, it is giving me an error.
I have made a similiar program to this, that essentially does the same thing, however it does not give me errors.
Is anyone aware of any hidden conditions involved in using the .AddTitleBlock method that is not mentioned in the API programming, or even what the .LateGet error is caused by?
Any help is much appreciated!
The error codes I get are:
Error in rule: oMakeDwg, in document: 334308-001 to 012.idw The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) ------------------------------------------------------ System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) at LmiRuleScript.Main() at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem) at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Sub Main() Dim oSheet As Sheet = ThisApplication.ActiveDocument.Sheets.Item(ThisApplication.ActiveDocument.Sheets.Count) Dim sPromptStrings(4) As String Try sPromptStrings(0) = oSheet.TitleBlock.GetResultText(oSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(48)) ' Title sPromptStrings(1) = oSheet.TitleBlock.GetResultText(oSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(49)) 'DESCRIPTION 1 sPromptStrings(2) = oSheet.TitleBlock.GetResultText(oSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(50)) 'DESCRIPTION 2 sPromptStrings(3) = oSheet.TitleBlock.GetResultText(oSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(52)) 'CUSTOMER DRAWING# sPromptStrings(4) = oSheet.TitleBlock.GetResultText(oSheet.TitleBlock.Definition.Sketch.TextBoxes.Item(53)) 'SCALE 'oRevOrigin = oSheet.RevisionTables.Item(1).Position() Catch End Try oFileDoc=ThisApplication.Documents.Add(kDrawingDocumentObject,"C:\Users\ \Template File Containing New TitleBlock.idw", True) oSheet.CopyTo(oFileDoc) oFileDoc.Activate oFileDoc.Sheets.Item(oFileDoc.Sheets.Count).Activate oFile = "C:\Directory\" & "Test" & ".idw" ‘Test is to be replaced by an iProperty once I get this working oFileDoc.SaveAs(oFile, False) If Not oFileDoc.ActiveSheet.TitleBlock Is Nothing Then oFileDoc.ActiveSheet.TitleBlock.Delete End If Dim oTitleBlock As Inventor.TitleBlock oTitleBlock = oFileDoc.Sheets.Item(oFileDoc.Sheets.Count).AddTitleBlock("NEW TITLEBLOCK", ,sPromptStrings) oFileDoc.Sheets.Item(1).Delete ' oFileDoc.Close End Sub
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Justin K
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
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
Solved! Go to Solution.