That is my test, i put this rule in my assembly, to created and send to part the new path for derrived part
'present a File Selection dialog
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.InitialDirectory = oOrigRefName
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
Return
ElseIf oFileDlg.FileName <> "" Then
EMPLACEMENT = oFileDlg.FileName
End If
MessageBox.Show("YOUR SKETCH FILE IS: " & EMPLACEMENT , "iLogic")
iProperties.Value("Custom", "EMPLACEMENT") = EMPLACEMENT
FOLDER = ThisDoc.Path
POSITION1 = InStrRev(FOLDER, "\")
POSITION2 = Right(FOLDER, Len(FOLDER) - POSITION1)
SKETCHNAME = POSITION2 & "_SKETCH" & ThisDoc.FileName & ":1"
iProperties.Value("Custom", "SKETCHNAME")=SKETCHNAME
'SEND TO PART, EMPLACEMENT IS PATH 🙂
Parameter(POSITION2 & "_FOND" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_DIV" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_DOS" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TAB" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TRTAB" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TABCOCHER" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TRTOP" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TOP" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_PORTE1" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_PORTE2" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_FILG" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_FILD" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_PANAPP" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TR1BASE" & ThisDoc.FileName & ":1","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
Parameter(POSITION2 & "_TR2BASE" & ThisDoc.FileName & ":2","EMPLACEMENT") = iProperties.Value("Custom", "EMPLACEMENT")
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
ThisDoc.Save
and iin each part of this assembly i put a even triggers, iproperties change and a custom properties "Folder" of a rule who replace the derrived part to my new path
i try that but dont work?
Dim oDoc as Document
oDoc = ThisDoc.Document
Dim oRefFile As FileDescriptor
Dim oOrigRefName As Object
'Replace the reference
oRefFile.ReplaceReference (selectedfile)
InventorVb.DocumentUpdate()
oOrigRefName = "FOLDER"
iLogicVb.UpdateWhenDone = True
Thanks for your help 🙂