Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
jatindevaiya08
in reply to: mirkomaga

@mirkomaga 

I have created C# code for the same and it's working fine for me. See attached images.

Test_4.png

SketchName_1.png


Here is the C# code. It's console Application code. And note that Inventor application as well as Part is open when you test it.

 

 

Inventor.Application inventorApplication = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");

PartDocument partDocument = (PartDocument)inventorApplication.ActiveDocument;
PartComponentDefinition partComponentDefinition =partDocument.ComponentDefinition;

foreach (PartFeature partfeature in partComponentDefinition.Features)
{
  if (partfeature.Type == ObjectTypeEnum.kHoleFeatureObject)
  {
    HoleFeature holeFeature = (HoleFeature)partfeature;
    Console.WriteLine(holeFeature.Sketch.Name);
   }
}

 

 


Regards,
Jatin Devaiya

Accept it as solution.

Regards,
Jatin Devaiya

If a response answers your question, please use ACCEPT SOLUTION to assist other users later.


Also be generous with Likes! Thank you and enjoy!