ILogic rule that can change all parts, parameters from the top assembly

ILogic rule that can change all parts, parameters from the top assembly

Anonymous
Not applicable
2,709 Views
5 Replies
Message 1 of 6

ILogic rule that can change all parts, parameters from the top assembly

Anonymous
Not applicable

Hello again Community.
I'm now in front of a task i cannot handle and I need your help!

My task is to make an ILogic rule that can go into all parts of the assembly (and subassemblies) and change given custom parameters.
The parameters i want to change is called "Kunde" and "Ordrenr".

After the rule is set, I will place it under a form so it will be quick to change.


The closet thing I could find was this..

 

 

Dim openDoc As Inventor.Document
Dim docFile As Inventor.Document
Dim DrawingDoc As DrawingDocument
Dim FNamePos As Long
Dim docFName As String
Dim iDesc As String

DrawingDoc = openDoc
openDoc = ThisApplication.ActiveDocument
iDesc = iProperties.Value("Project", "Kunde")

For Each docFile In openDoc.AllReferencedDocuments

'    Check if referenced document is a Part file.  If it is, fill in the SK field.
    If docFile.DocumentType = kPartDocumentObject Then
        'If Not Mid(iDesc, Len(iDesc) - 4, 4) = "<SK>" Then 
        '    iDesc = iDesc + "<SK>"
        'End If
        
        FNamePos = InStrRev(docFile.FullFileName, "\", - 1)
        docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos)
        iProperties.Value(docFName, "Custom", "SK") = "(SK)"
    
    End If
Next

iLogicVb.UpdateWhenDone = True

 

 

With best regards, Mikael Nanke

Accepted solutions (1)
2,710 Views
5 Replies
Replies (5)
Message 2 of 6

CCarreiras
Mentor
Mentor

Just create the parameter in every part... and link those parameters to the respective parameter in main assembly!!

CCarreiras

EESignature

0 Likes
Message 3 of 6

Anonymous
Not applicable
Hey Ccarreiras, thank you for responding.

But i'm sad to inform you that this is not a parameter but a Custom property found in Iproterties in every parts and assembly, which is linked to the drawing header, so i cannot force it as an parameter.
0 Likes
Message 4 of 6

CCarreiras
Mentor
Mentor

Yes you can , if is a number parameter, you mark the parameter to export...

 if is a text parameter you can't do it directly, but there's other ways...

 

1.png

CCarreiras

EESignature

0 Likes
Message 5 of 6

Anonymous
Not applicable

Here is the Values i was talking about and they do not show up in the parameter section so i cant export them.

0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution

I found the solution!

 

Also, i have added the most used colors i work with.

With this code,  you will also need a form, with a button connected to a the code called "OrdreKundeFarve", and when the "Kund" and "Ordre Nr" parameter have been set/filled, it can set alle below parts with the same parameters. 

 

 

SyntaxEditor Code Snippet

'Set Farve
Dim oFarveList As New ArrayList
oFarveList.add("Metal-Steel")
oFarveList.add("1007")
oFarveList.add("1012")
oFarveList.add("1013")
oFarveList.add("1018")
oFarveList.add("1021")
oFarveList.add("2004")
oFarveList.add("3000")
oFarveList.add("3020")
oFarveList.add("5000")
oFarveList.add("5001")
oFarveList.add("5002")
oFarveList.add("5003")
oFarveList.add("5005")
oFarveList.add("5007")
oFarveList.add("5009")
oFarveList.add("5010")
oFarveList.add("5012")
oFarveList.add("5013")
oFarveList.add("5014")
oFarveList.add("5015")
oFarveList.add("5017")
oFarveList.add("5018")
oFarveList.add("5019")
oFarveList.add("5021")
oFarveList.add("5024")
oFarveList.add("6000")
oFarveList.add("6011")
oFarveList.add("6018")
oFarveList.add("6021")
oFarveList.add("6027")
oFarveList.add("6029")
oFarveList.add("6032")
oFarveList.add("7001")
oFarveList.add("7004")
oFarveList.add("7011")
oFarveList.add("7015")
oFarveList.add("7016")
oFarveList.add("7021")
oFarveList.add("7024")
oFarveList.add("7032")
oFarveList.add("7035")
oFarveList.add("7036")
oFarveList.add("7037")
oFarveList.add("7038")
oFarveList.add("7045")
oFarveList.add("8017")
oFarveList.add("9001")
oFarveList.add("9002")
oFarveList.add("9003")
oFarveList.add("9005")
oFarveList.add("9006")
oFarveList.add("9010")
oFarveList.add("9016")
oFarveList.add("9018")
oFarveList.add("9022")
oFarveList.add("U / lak")
oFarveList.add("Galv. EL")
oFarveList.add("Galv. Varm")





oFarveValg = InputListBox("Prompt",oFarveList, oFarveList, Title := "Title", ListName := "List")
iProperties.Value("Custom", "Farve") = oFarveValg
oKundeNummer = iProperties.Value("Custom", "Kunde")
oOdreNummer = iProperties.Value("Custom", "OrdreNr")
    
'define the active assembly
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument 
 
'Check all referenced docs
Dim oDoc As Inventor.Document
For Each oDoc In oAssyDoc.AllReferencedDocuments
'format file name
    'format file name
    Dim FNamePos As Long
    FNamePos = InStrRev(oDoc.FullFileName, "\", -1)
    Dim docFName As String
    'returns file name with extension
    docFName = Right(oDoc.FullFileName, Len(oDoc.FullFileName) - FNamePos)

iProperties.Value(docFName,"Custom", "Kunde") = oKundeNummer
iProperties.Value(docFName,"Custom", "OrdreNr") = oOdreNummer
iProperties.Value(docFName,"Custom", "Farve") = oFarveValg
Next

 

0 Likes