Need Help with iLogic! - Obsolete Parts form

Need Help with iLogic! - Obsolete Parts form

Anonymous
Not applicable
656 Views
4 Replies
Message 1 of 5

Need Help with iLogic! - Obsolete Parts form

Anonymous
Not applicable

I am trying to create a rule that will open a form (either ran manually by user or by some system function such as on a "save" command). 

The Rule needs to do the following:

1.) Check a custom parameter within iProperties named "Obsolete" for a "Yes" Value for all parts and sub assemblies within the main Assembly.

2.) If any individual parts or subassemblies within main Assembly come back with a "Yes" Value. Display them on a form/list. 

 

My main goal, is a way of knowing within an assembly if it contains any old obsolete parts or assemblies. At my job we are given old assemblies to reference for new jobs and there is no way of knowing if it contains obsolete parts unless physically instructed by word of mouth,which is a very flawed system. if anyone was alternate ideas i'm all ears. 

 

Thanks very much

-Corbin  

0 Likes
657 Views
4 Replies
Replies (4)
Message 2 of 5

JBerns
Advisor
Advisor

@Anonymous,

 

This is not an iLogic/VBA solution, but an option until the code is developed.

 

Have you considered adding the custom iProperty as a column in the BOM? At a glance you can see and sort obsolete components. Here is a link to add a custom iProperty column to the BOM.

 

Hope this is helpful.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 3 of 5

Anonymous
Not applicable

Jerry, 

 

Thanks for the response! that is possibly an option with adding the custom property to the  BOM. 

 it still seems to me, with the myriad of other things I've seen iLogic do, that it should be possible to do something like this, but then again i am not very versed in iLogic. 

 

Regards

-Corbin  

0 Likes
Message 4 of 5

JBerns
Advisor
Advisor

@Anonymous,

You mentioned that you wanted to display the identified obsolete parts, based on a custom iProperty, in a form.

Is this intended to be a simpler form of the built-in BOM interface?

Do you need to do anything with this list of obsolete parts?

 

Approximately how many parts will be listed? 10's, 100's, 1000's? This may determine the interface used to display the obsolete part names.

 

Regards,

Jerry 

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 5 of 5

JBerns
Advisor
Advisor

@Anonymous,

In a new assembly, create an iLogc rule.

Paste the following code into the rule, save , and then run it.

Sub Main()        
    ' Initialize counter
    Dim i As Integer
    i = 0

    ' Get the active assembly.
    Dim oAsmDoc As AssemblyDocument
    oAsmDoc = ThisApplication.ActiveDocument
    ' Get all of the referenced documents.
    Dim oRefDocs As DocumentsEnumerator
    oRefDocs = oAsmDoc.AllReferencedDocuments
    
    'Define String Builder and Obsolete
    Dim sb As New System.Text.StringBuilder
    Dim oObsolete As Object

    ' Iterate through the list of documents.
    Dim oRefDoc As Document
    RefDocCount = oRefDocs.Count
    For Each oRefDoc In oRefDocs
        Try
            oObsolete = oRefDoc.PropertySets.Item("Inventor User Defined Properties").Item("OBSOLETE").Value ' iPropGet("OBSOLETE", , oRefDoc)
	Catch
	    'more error checking here when component is missing OBSOLETE custom iProperty
	End Try
        If oObsolete = True Then
            sb.Append (oRefDoc.DisplayName)
            sb.Append (System.Environment.NewLine)
            'Increment the counter
            i = i + 1
        End If
    Next

    'Total
    sb.Append (System.Environment.NewLine)
    sb.Append ("Total: " + i.ToString)
    MessageBox.Show(sb.ToString(), "Obsolete Components")
        
End Sub

 

Your components must have a custom iProperty named OBSOLETE (not case-sensitive) in order to be listed.

 

I still consider myself a novice at iLogic and VBA, but hopefully this code can help you get started. I would welcome any feedback from more experienced programmers.

 

I look forward to hearing of your success, Corbin.

 

 

Regards,

Jerry

 

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes