Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
gopinadh7XTGG
433 Views, 2 Replies

Issue with Highlight / SelectSet - Drawing Weld Symbol in Inventor 2024

Hello All,

I was trying to Highlight all Drawing weld symbols that are available in a drawing in Inventor 2024. I was getting this error (System.Runtime.InteropServices.COMException: 'Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))'). Instead of Highlight, I tried with SelectSet also which is also throwing the same error. Below is the code I am using, which is working fine with Highlight / SelectSet in all dimensions but the issue is only with the Drawing Weld Symbol.. Attached are the Inventor CAD files for testing purposes.

Any help is appreciated.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Inventor;
using System.Runtime.InteropServices;

namespace Testcase_Inv2024_WeldSymbol_Highlight
{
static class Program
{
static void Main()
{
Inventor.Application oApp = Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;

DrawingDocument drawingDocument = (DrawingDocument)oApp.ActiveDocument;

Sheet oActiveSheet = drawingDocument.ActiveSheet;

DrawingWeldingSymbols allWeldSymbols = oActiveSheet.WeldingSymbols;

DrawingDimensions alldimensions = oActiveSheet.DrawingDimensions;

HighlightSet _oHighlightSet = oApp.ActiveDocument.CreateHighlightSet();
_oHighlightSet.SetColor(255, 255, 0);

ObjectCollection myDimensionCollection = oApp.TransientObjects.CreateObjectCollection();

ObjectCollection myWeldSymbolCollection = oApp.TransientObjects.CreateObjectCollection();

foreach (DrawingDimension drawingDimension in alldimensions)
{
myDimensionCollection.Add(drawingDimension);
}

foreach (DrawingWeldingSymbol weldSymbol in allWeldSymbols)
{
myWeldSymbolCollection.Add(weldSymbol);
}

drawingDocument.SelectSet.SelectMultiple(myDimensionCollection);
_oHighlightSet.AddMultipleItems(myDimensionCollection);

drawingDocument.SelectSet.SelectMultiple(myWeldSymbolCollection); //API Issue
//Error -> System.Runtime.InteropServices.COMException: 'Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))'
_oHighlightSet.AddMultipleItems(myWeldSymbolCollection); //API Issue
//Error->System.Runtime.InteropServices.COMException: 'Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))'
}
}
}

Thanks,
GopinadhGvs.