Do you want to work with all local iLogic rules, or do you prefer external iLogic rules for this solution?
What action do you want to trigger the sketch text to change? Do you just want to run a local rule within the main assembly to make it all happen? Or maybe you want it so that when you change the value of the text parameter in the assembly, it causes a local rule within the assembly to run that will push that value to the part, then run a rule in the part to change the text in the sketch? It will be easier to set-up the parameter change triggering if you are using local rules in both cases, but it can also be done using external rules if needed (just requires more work/set-up).
If using local rules, and you want the change to happen when you change the parameter value within the main assembly, here is some example local iLogic rule codes you can try:
Within the main assembly document, create a new rule and copy/paste this following code into it. You will need to change the path & file name to the target Part file, or get the Part file in another way, if needed. (You can delete the comments, once you get it working OK.)
'try to specify/find/get the target part document
'it should already be 'initiated' because it's within the assembly, so we don't need to specifically open it
Dim oPDoc As PartDocument
Try
'<<<< CHANGE THIS PATH & FILE NAME >>>>
'or get the part document another way, if needed
oPDoc = ThisApplication.Documents.ItemByName("C:\Temp\MyPart.ipt")
Catch
MsgBox("Couldn't find the Part document named 'MyPart.ipt'. Exiting.")
Exit Sub
End Try
Dim oPrtParam As Inventor.Parameter
Try
oPrtParam = oPDoc.ComponentDefinition.Parameters.Item("EngravingL")
Catch
MsgBox("Couldn't find the parameter named 'EngravingL' within the Part. Exiting.")
Exit Sub
End Try
'set the value of the part's parameter to the value of the assemblies parameter
'when using a 'blue' local parameter name, it will trigger this rule to run when its value changes
oPrtParam.Value = Engraving 'local' parameter (should turn blue) within the Assembly
Then within the Part document, change its local rule code to this:
Dim oPDoc As PartDocument = ThisDoc.Document 'points to the 'local' document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
For Each oSketch As PlanarSketch In oPDef.Sketches
For Each oTextBox As Inventor.TextBox In oSketch.TextBoxes
oTextBox.Text = EngravingL 'local parameter (should turn blue)
Next
Next
You may have to update the part and/or assembly after wards to see the changes, or simply include an extra line of code in them to RebuildAll or Update.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)