SDK load SmartComponent
I have created a GraphicComponent group in an addin and wish to programmatically to add a PositionSensor from the standard RS SmartComponent Library. How do I do this and paramatise it (ie set length and size)
0
Best Answer
-
Hi Simon, try this:
GraphicComponentGroup myGroup = ...<br> var libPath = Path.Combine(ApiConfiguration.ABBLibraryDirectory, "Components", "LineSensor.rslib");<br> var library = GraphicComponentLibrary.Load(libPath, true);<br> var lineSensor = library.RootComponent.CopyInstance() as SmartComponent;<br> myGroup.GraphicComponents.Add(lineSensor);<br>
The CopyInstance() call is needed to create a modifiable copy of the component.
Regards,
Johannes
Johannes Weiman
Software Engineer
RobotStudio Team, ABB Robotics5
Answers
-
Correction I meant a Line Sensor0
Categories
- All Categories
- 5.6K RobotStudio
- 398 UpFeed
- 20 Tutorials
- 14 RobotApps
- 300 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 828 RAPID Programming
- 12 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings