Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Search all parts using iLogic

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

Search all parts using iLogic

If anyone out there could help me I would appreciate it.

 

I have a custom iProperty in every part that I make ("Fluid Mass"). I have already figured out the iLogic to automatically fill in this iProperty with the correct information. I was wondering if there is a way at the assembly level (using iLogic) to search all parts for this iProperty and add them together? (Similar to the way mass works at the assembly level without iLogic).

 

An added bonus would be if for some reason any parts in the assembly didn’t have the ("Fluid Mass") iProperty then a message would alert me to which ones needed the iProperty added.

 

Thank you in advance to anyone that helps.

3 REPLIES 3
Message 2 of 4
scottmoyse
in reply to: Anonymous

You will better off posting this in the Inventor Customisation forum instead.


Scott Moyse
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.


EESignature


Design & Manufacturing Technical Services Manager at Cadpro New Zealand

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

Message 3 of 4
Anonymous
in reply to: Anonymous

Hi,

 

Kindly check the below code, but you have to create custom property  in your assembly "Total Fluid Mass".

 

 

 

Option Explicit

Imports Autodesk.Inventor

 

Sub Main
  Dim oApp As Inventor.Application =  ThisApplication
  Dim oAssy As Inventor.AssemblyDocument = oApp.ActiveDocument
  Dim TotalFluidMass As Double = 0
 
  For Each oSubDoc as Inventor.Document in oAssy.AllReferencedDocuments
    ' Only process if document is a part document
    if oSubDoc.DocumentType = kPartDocument then
       
'Get Custom Properties (User Defined Properties)

        Dim oPartPropset As Inventor.PropertySet = oSubDoc.PropertySets("Inventor User Defined Properties")


       Try 
          Dim FluidMass As Double = oPartPropset("Fluid Mass
").Value
          ' Add part Fluid Mass to total Mass
         TotalFluidMass += FluidMass
       Catch ee As Exception
         ' Do not raise or display an error.  We assume all parts have a "Fluid Mass" custom property
       End Try
    End If
  Next

  ' Get Master Assembly Custom PropertySet

  Dim oAssyPropset As Inventor.PropertySet = oAssy.PropertySets("Inventor User Defined Properties")


  Try
    ' Set Custom Property to total Mass
    oAssyPropset("Total Fluid Mass").Value = TotalFluidMass
  Catch
    ' Do not raise or display an error.  We assume the Master Assembly has  a "Total Fluid Mass" custom property
  End Try

  oAssyPropset = Nothing
  oAssy = Nothing
  oApp = Nothing

 

'Remove the following when doen testing
MessageBox.show(TotalFluidMass.ToString & " TotalFluidMass of parts in the assembly")

 


End Sub

 

Message 4 of 4
Anonymous
in reply to: Anonymous

Thank you. That’s exactly what I needed.  

 

Thank you so much.

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

Post to forums  

Autodesk Design & Make Report