Hi,
I am trying to replace the title block of the first sheet of the active drawing via C#. I currently am receiving the following error on the last line of code: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)). Very frustrating.
Any ideas as to why the code below is throwing this error? I have tried multiple variations of the code below to no avail and I'm sure this is something minor that I am overlooking. The title block definition under Drawing Resources is replaced with no errors, the title block on Sheet 1 is deleted just fine, but I can't seem to add a Title Block back in!
How Documents are defined:
Inventor._DrawingDocument oDoc = getDoc(); Inventor.DrawingDocument sourceDoc = (DrawingDocument)instance.Documents.OpenWithOptions(sPath, options, false);
Find, copy, replace:
TitleBlockDefinition tBlock = sourceDoc.TitleBlockDefinitions[blockList.SelectedItem.ToString()]; TitleBlockDefinition newBlock = tBlock.CopyTo(oDoc, true); oDoc.Sheets[1].TitleBlock.Delete(); oDoc.Sheets[1].AddTitleBlock(newBlock);
Any help would be greatly appreciated.
Thanks,
Ben
Can't find what you're looking for? Ask the community or share your knowledge.