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: 

ILogic - number of solids within a ipt file

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Mark_XD_UK
208 Views, 2 Replies

ILogic - number of solids within a ipt file

  • Hi all, is there a way of creating an iLogic rule that can identify the number of solids within a ipt part file & populate result into a custom iproperty?  Thx in advance
2 REPLIES 2
Message 2 of 3
A.Acheson
in reply to: Mark_XD_UK

Hi @Mark_XD_UK

The solidbody info can be found under surfacebodies in the part component definition object. See help page here.

You can check between surfaces and solidbodies further if you need to. 

 

Try this out. 

Dim partDoc as PartDocument = ThisDoc.Document
Dim compDef as PartComponentDefinition = partDoc.ComponentDefinition

Dim count as Integer = compDef.SurfaceBodies.Count

Dim propertyName As String = "SolidBodyCount"

customPropertySet = partDoc.PropertySets.Item("Inventor User Defined Properties")
Dim prop As [Property]
Try
      prop = customPropertySet.Item(propertyName)
Catch
      ' Assume error means not found
    prop = customPropertySet.Add("", propertyName)
End Try

prop.Value = count

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3
Mark_XD_UK
in reply to: A.Acheson

Brilliant!  @A.Acheson - many thx ...thats exactly what i needed 

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

Post to forums  

Autodesk Design & Make Report