I have a UI Styler dialog and I am trying to pass a selected body to Knowledge Fusion. The existing Knowledge Fusion program has a body select tool in it that I want to populate with the body select dialog from UI Styler. I kept tying to give a value to "Root:nxtPartProperties:%bodySelector:", "SelectedObjects" like the recorded journal was showing but only got errors. I then tried sending the selected body directly to "calculationBodies" (which is populated by the body selector in the KF). This runs fine, but the values are all zeros for the expressions that the KF creates.
workPart.RuleManager.CreateDynamicRule("root:", "nxtPartProperties", "Child", "{class, nxt_partp_partproperties;}", Nothing)
workPart.RuleManager.CreateDynamicRule("Root:nxtPartProperties:%solidSelectionType:", "Value", RuleManager.RuleType.Integer, "1")
'workPart.RuleManager.CreateDynamicRule("Root:nxtPartProperties:%bodySelector:", "SelectedObjects", RuleManager.RuleType.List, "{ug_refObject(""Solid Body:C-20-8"","""")}")
workPart.RuleManager.CreateDynamicRule("Root:nxtPartProperties:", "calculationBodies", RuleManager.RuleType.Name, SelectedBody.Name)
workPart.RuleManager.CreateDynamicRule("Root:nxtPartProperties:%unitsSelector:", "Value", RuleManager.RuleType.Integer, "0")
re: Passing a body from NXOpen to KF
I managed to pass the solid object to the Knowledge Fusion application using:
Dim strRefText As String = theRM.GetReferenceText(SelectedBody)
After I massaged that string a little bit, but I was then able to pass it to KF like: