04-20-2022
11:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-20-2022
11:45 PM
Hello,
I trying to get Sketch Definition from Hole Feature.
Considering that it is the same document:
VB:
Addin c#:
As you can well see: in the second image the sketch throw me an exception that is not there in the first one.
This is Model, anyone have the same problem?
Solved! Go to Solution.
04-21-2022
08:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-22-2022
10:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-22-2022
10:48 PM
@mirkomaga
I have created C# code for the same and it's working fine for me. See attached images.
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!
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!