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: 

API: MultiBody parts.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
922 Views, 3 Replies

API: MultiBody parts.

Hi.

I am trying to access the material and/or renderstyle for each solid in a multibody part document, but it seems like this is not supported in the API.

Is this correct?

If this is correct, why the HasMultipleSolidBodies property? (Yes, I am probably missing something here, but... :-))

 

R

3 REPLIES 3
Message 2 of 4
sanjay.ramaswamy
in reply to: Anonymous

The PartComponentDefinition.SurfaceBodies returns all the solid bodies within a part. You can then call the SurfaceBody.GetRenderStyle method on each returned body to query its render style. Note that Material can only be set per document (and not per body).

 

Does this help? If not, please provide the Inventor document and sample code to reproduce the problem.

 

 

Message 3 of 4
Anonymous
in reply to: Anonymous

Yes, of course! Why didn't I think of this?

Thank you very much!

 

R

Message 4 of 4
Anonymous
in reply to: Anonymous

Sorry for bringing up such an old post.  This is exactly what I'm trying to do, but it takes such a long time.  On some of our larger parts, iterating through and setting each face on a surface body to featureRenderStyle takes hours.  Is there a faster way?

 

 Here is my current code:

foreach (SurfaceBody oSurfaceBody in oPartDef.SurfaceBodies)
{
	oSurfaceBody.SetRenderStyle(StyleSourceTypeEnum.kFeatureRenderStyle, null, true);

	foreach (Face face in oSurfaceBody.Faces)
	{
		face.SetRenderStyle(StyleSourceTypeEnum.kFeatureRenderStyle);
	}
}

 

Is there a way to make it faster or more efficient?  If Inventor were thread-safe, I'd do it in parallel.  

 

Is there code similar to this that might work on a surfaceBody? ModTheMachine shows that it only selects faces that have an override.

oPartDocument.AttributeManager.FindObjects("com.autodesk.inventor.FaceAttributes", "FaceColor");

 

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

Post to forums  

Autodesk Design & Make Report