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.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings