Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gopinadh7XTGG
369 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.

2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: gopinadh7XTGG

Hi @gopinadh7XTGG.  I suspect that the DrawingWeldingSymbol objects are simply not supported for adding to the Document.SelectSet or HightlightSet yet.  Have you reviewed the similar forum post at the following link yet.  It was to help address the inability to use the Pick method to select one, and uses a different route for selecting one.

https://forums.autodesk.com/t5/inventor-programming-ilogic/commandmanager-pick-kdrawingweldsymbol-in... 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
gopinadh7XTGG
in reply to: WCrihfield

Hi WCrihfield,

You are correct. Currently DrawingWeldingSymbol objects are simply not supported for adding to the Document.SelectSet or HightlightSet.

I have gone through your method for Selecting drawing weld symbol and it works great.
Many Thanks.

Regards,
Gopinadh Gvs.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report