Replace components in schematic JavaScript
- Информация о материале
- Автор: Super User
- Родительская категория: Заметки
- Категория: Электроника / cхемотехника
- Просмотров: 999
// get the component to replace
var componentToReplace = "R1";
// get the new component from a different library
var newComponentPath = "MyLibrary\\NewComponents.LibPkg"; // the path to the new library package
var newComponentName = "R3"; // the name of the new component in the library
// loop through all components in the schematic
for (var i = 0; i < currentSheet.GetSchObjectCount(); i++) {
var obj = currentSheet.GetSchObject(i);
if (obj.GetSelectStatus() == eSelected) {
if (obj.GetState() == SCH_COMP) {
var component = obj;
if (component.GetLibReference().GetLibItemName() == componentToReplace) {
// get the current location of the component
var x = component.GetState_X();
var y = component.GetState_Y();
// get the current rotation of the component
var rotation = component.GetState_Rotation();
// remove the current component
currentSheet.RemoveSchObject(component);
// add the new component from the new library at the same location and rotation
var newLib = currentDoc.FindLibrary(newComponentPath);
var newComponentTemplate = newLib.FindSchComponentTemplate(newComponentName);
var newComponent = currentSheet.CreateSchComponent(x, y, rotation, newComponentTemplate);
currentSheet.AddSchObject(newComponent);
}
}
}
}
C++ programming in Visual Studio Code:: setup
- Информация о материале
- Автор: Super User
- Родительская категория: Заметки
- Категория: Компьютерная повседневность
- Просмотров: 923
2. Istall VS code and tools:
Тригонометрия на круге : наглядно
- Информация о материале
- Автор: Super User
- Родительская категория: Заметки
- Категория: Интересное
- Просмотров: 928
How to make Footprint Comparison Report in Altium Designer 23
- Информация о материале
- Автор: Super User
- Родительская категория: Заметки
- Категория: Электроника / cхемотехника
- Просмотров: 994
then
Tools >>> Update from PCB libraries
Конвертор с 0..3V на ±5V
- Информация о материале
- Автор: Super User
- Родительская категория: Заметки
- Категория: Электроника / cхемотехника
- Просмотров: 839

Страница 41 из 197
