iLogic Issues

iLogic Issues

Anonymous
Not applicable
447 Views
3 Replies
Message 1 of 4

iLogic Issues

Anonymous
Not applicable

Good Morning all,

 

We are currently trying to update all our systems from Inventor 2018 to 2021 and I am having some issues with a Rule not running properly. When we start a new job, we are prompted to input all of the customer info when opening the assembly (this rule still works) then there is an iTrigger that auto populates the info into the tag on the base in the assembly. We also have a rule that populates the same info into the 2-d drawings which is working. I'm not sure if it's the iTrigger causing the problem, but it says it works when hitting it (the message box at the end of the code) when in fact it isn't. Are there any known issues with Rules/iTriggers? I've attached the rule below if that helps. Thanks in advance for any help!

 

Mbrighton1_0-1590145092131.png

 

0 Likes
Accepted solutions (1)
448 Views
3 Replies
Replies (3)
Message 2 of 4

mdavis22569
Mentor
Mentor

Likely need to share the code itself to the ticket for testing.   Kind of hard to help with a blurry image of coding.


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 4

Anonymous
Not applicable
trigger = iTrigger0

' Get the active assembly document.
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument

'Global Values set
Dim CustomerCityName = iProperties.Value("Custom", "Customer City Address")
Dim CustomerName = iProperties.Value("Custom", "Customer Name")
Dim CustomerPart = iProperties.Value("Custom", "Customer Part Number")
Dim CustomerStreet = iProperties.Value("Custom", "Customer Street Address")
Dim WorkOrder = iProperties.Value("Custom", "Work Order #")
Dim Gage = iProperties.Value("Custom", "Gage Number")
Dim RevLevel = iProperties.Value("Custom", "Rev. Level")

' Iterate through all of the documents referenced by the assembly.
Dim oDoc As Document
For Each oDoc In oAsmDoc.AllReferencedDocuments

' Verify that the document is a part.
    If oDoc.DocumentType = kPartDocumentObject Then    
        Dim oPartDoc As PartDocument = oDoc
'Manipulate part    
        Dim model As String = oPartDoc.DisplayName
        model = model & ".ipt"
        Try
            If iProperties.Value(model,"Summary", "Category") = "Custom" Then
                iProperties.Value(model,"Summary", "Category") = "Custom"
                Else
				'Sets Custom Properties for Components that are in the Main Assembly.
				iProperties.Value(model,"Custom" , "Customer City Address") = CustomerCityName
				iProperties.Value(model,"Custom" , "Customer Name") = CustomerName
				iProperties.Value(model,"Custom" , "Customer Part Number") = CustomerPart
				iProperties.Value(model,"Custom" , "Customer Street Address") = CustomerStreet
				iProperties.Value(model,"Custom" , "Work Order #") = WorkOrder
				iProperties.Value(model, "Custom", "Gage Number") = Gage
				iProperties.Value(model,"Custom" , "Rev. Level") = RevLevel
            End If
        Catch
		End Try

    End If
Next

MessageBox.Show("Gage Tag information is updated", "Gage Tag Update")

Sorry about that, thanks!
0 Likes
Message 4 of 4

marcin_otręba
Advisor
Advisor
Accepted solution

Try to reset your display name first :

oPartDoc.DisplayName=""

and check if it already does not contains ipt in it:

  Dim model As String = oPartDoc.DisplayName
		If Right(model,4)<> ".ipt" Then
        model = model & ".ipt"
	End If

 

 

trigger = iTrigger0

' Get the active assembly document.
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument

'Global Values set
Dim CustomerCityName = iProperties.Value("Custom", "s_length")
Dim CustomerName = iProperties.Value("Custom", "s_width")
Dim CustomerPart = iProperties.Value("Custom", "laser")
Dim CustomerStreet = iProperties.Value("Custom", "description_pl")
Dim WorkOrder = iProperties.Value("Custom", "stock")
Dim Gage = iProperties.Value("Custom", "spot")
Dim RevLevel = iProperties.Value("Custom", "cutting")

' Iterate through all of the documents referenced by the assembly.
Dim oDoc As Document
For Each oDoc In oAsmDoc.AllReferencedDocuments

' Verify that the document is a part.
    If oDoc.DocumentType = kPartDocumentObject Then    
        Dim oPartDoc As PartDocument = oDoc
'Manipulate part
Try 
	oPartDoc.DisplayName=""
	Catch
	End Try	

        Dim model As String = oPartDoc.DisplayName
		If Right(model,4)<> ".ipt" Then
        model = model & ".ipt"
	End If
        Try
            If iProperties.Value(model,"Summary", "Category") = "Custom" Then
                iProperties.Value(model,"Summary", "Category") = "Custom"
                Else
				'Sets Custom Properties for Components that are in the Main Assembly.
				iProperties.Value(model,"Custom" , "Customer City Address") = CustomerCityName
				iProperties.Value(model,"Custom" , "Customer Name") = CustomerName
				iProperties.Value(model,"Custom" , "Customer Part Number") = CustomerPart
				iProperties.Value(model,"Custom" , "Customer Street Address") = CustomerStreet
				iProperties.Value(model,"Custom" , "Work Order #") = WorkOrder
				iProperties.Value(model, "Custom", "Gage Number") = Gage
				iProperties.Value(model,"Custom" , "Rev. Level") = RevLevel
            End If
        Catch
		End Try

    End If
Next

MessageBox.Show("Gage Tag information is updated", "Gage Tag Update")

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes