- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Autodesk,
We want to read bodies in inventor pattern feature (rectangular, Circular, etc)
We tried to read bodies in Pattern feature but it seems it whole pattern bodies as single body.
We tried following code
PartComponentDefinition partComponentDefinition = this.ivPartDocument.ComponentDefinition;
RectangularPatternFeatures rectPatternFeatures = partComponentDefinition.Features.RectangularPatternFeatures;
foreach (RectangularPatternFeature patternFeat in rectPatternFeatures)
{
int patternBodiesCount = patternFeat.SurfaceBodies.Count; // Getting 1 body always though pattern contains many instances of a body
RectangularPatternFeatureDefinition patterndefinition = patternFeat.Definition;
foreach (SurfaceBody surfaceBody in patternFeat.SurfaceBodies)
{
int patternBodyFacesCount = patternFeat.SurfaceBodies.Faces.Count; // Faces count is total of faces all pattern body instances
}
}
I have attached sample part
We tried differrent API's from RectangularPatternFeature but couldn't get disting bodies from pattern features.
We tried many things but couldn't get each body data seperately from PatternFeature
PartFeaturesEnumerator partFeatureEnum = surfaceBody.AffectedByFeatures;
foreach (PartFeature feature in surfaceBody.AffectedByFeatures) // surfaceBody.AffectedByFeatures.Count = 2 but still body is same for each AffectedFeature.
{
SurfaceBody body = feature.SurfaceBody; // This body
}
Please suggest correct way if possible to achieve this. Looking for fastest resolution.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
im not exactly sure what you are trying to do but if you want to get multiple bodies from a pattern then you should make the pattern like this.
then you will get multiple bodies.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks @JelteDeJong
But is it possible to get bodies separately without this change somehow through API's? Like for attached part without modifying pattern feature?
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If you don't want to change the model to be actual separate bodies, then you have to look at the FaceShells of the solid body.
simple sample:
Dim pDef As PartComponentDefinition = TryCast(ThisApplication.ActiveDocument.ComponentDefinition, PartComponentDefinition)
If IsNothing(pDef) Then Exit Sub
Dim oBody As SurfaceBody = pDef.SurfaceBodies.Item(1)
MessageBox.Show(oBody.FaceShells.Count)
If you have hollow parts then you will have loop through All FaceShells to look out for Void FaceShells [FaceShell Object], but if not then Count should be sufficient.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report