Message 1 of 7
(API) External parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to play with external parameters. According to the Robot API manual, it is possible to define arbitrary external parameters and assign them to individual structure elements. Unfortunately, my attempts were not successful. It seems that the UniqueId from RobotParamDef is not working properly. Please check my code below:
Sub TestExtParam() Dim RobApp As RobotApplication Set RobApp = New RobotApplication If Not RobApp.Visible Then Set RobApp = Nothing MsgBox "Open Robot and load Model", vbOKOnly, "ERROR" Exit Sub End If Dim RSelection As RobotSelection Set RSelection = RobApp.Project.Structure.Selections.Get(I_OT_NODE) Dim AllNodes As RobotNodeCollection Set AllNodes = RobApp.Project.Structure.Nodes.GetMany(RSelection) Dim RNode As RobotNode Set RNode = AllNodes.Get(1) Dim ID As Long ID = RNode.UniqueId
Dim CmpFact As RobotComponentFactory
Set CmpFact = RobApp.CmpntFactory
Dim RPD As RobotParamDef
Set RPD = CmpFact.Create(I_CT_PARAM_DEF) RPD.ValueType = I_PVT_TEXT RPD.GuiVisible = True RPD.Name = "Node Name" RPD.GuiSetName 1, "Node Name" RPD.DefaultValue = "Pier 1" Dim Scheme As RobotParamSchema RobApp.Project.Structure.ExtParams.Schemas.Clear RobApp.Project.Structure.ExtParams.Schemas.Create "My Test Scheme" Set Scheme = RobApp.Project.Structure.ExtParams.Schemas.GetByName("My Test Scheme") Scheme.RemoveAllParams ID Scheme.SetParam ID, RPD.UniqueId, RPD.DefaultValue RPD.ValueType = I_PVT_INTEGER RPD.GuiVisible = True RPD.Name = "Radius" RPD.GuiSetName 1, "Radius" RPD.DefaultValue = 69 Scheme.SetParam ID, RPD.UniqueId, RPD.DefaultValue End Sub
Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.
Roman Zhelezniak
Robot Evangelist & Passionate Civil Structural Engineer