PC3B/PC3B.FCMacro

47 lines
1.1 KiB
Text
Raw Permalink Normal View History

2024-09-16 14:59:40 -04:00
import Asm4_libs as Asm4
import importlib
import math
import pcbnew
from pcbnew import VECTOR2I as Vec
import PC3B
import PC3B.Boards
try:
importlib.reload(Asm4)
importlib.reload(PC3B)
importlib.reload(PC3B.Connector)
importlib.reload(PC3B.Connector.Asm4)
importlib.reload(PC3B.Connector.Base)
importlib.reload(PC3B.Boards)
pass
except Exception as e:
import traceback
print(e)
traceback.print_tb(e.__traceback__)
pass
from PC3B.Connector.Asm4 import Asm4Connector, Asm4ConnectionManager
from PC3B.Connector.Base import Connector
from PC3B.Boards import SubBoard, BoardManager
ad = App.ActiveDocument
# TODO bootstrap Asm4 by externally loading the WB
# this prevents `<class 'Base.FreeCADError'>: No such command 'Asm4_makeAssembly'`
# from being raised if this is ran before Asm4 has been loaded
print('starting....')
board = pcbnew.LoadBoard('/home/morgan/mnt/Documents/PCBs/pcbnew_assembly_demo/pcbnew_assembly_demo.kicad_pcb')
groups = list(board.Groups())
ad.openTransaction('pcb')
bm = BoardManager(board, ad, {
'conn_cls': Asm4Connector,
'conn_man_cls': Asm4ConnectionManager,
})
ad.commitTransaction()