SDK load SmartComponent
Options
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.4K RobotStudio
- 383 UpFeed
- 14 Tutorials
- 12 RobotApps
- 291 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 247 ScreenMaker
- 2.7K Robot Controller
- 279 IRC5
- 46 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 734 RAPID Programming
- 15 Wizard Easy Programming
- 105 Collaborative Robots
- 3 Job listings