Hello to probably the best support of Altium on the planet.
I'm mid designing a project where I have hundreds of the same circuit segment to place on some complex shaped pcbs. The pcb shapes where design in auto-cad and the component positioing is extracted out of that, and i get X,Y and rotation data in a text file. I've been able to to extract that position data and move components around the board and get them in the correct place. In the instance below, i read in a file that has the designators of a bunch of components, and then move them to the x,y specified point. A big time saving..
I'd like to be able to do the same for an entire room of components though.. Does anyone know if you can move rooms in the same manner. I'm sure you can, i'm just not sure what its called.
Const ForReading = 1
' on mac generated .csv files run
' tr '\15' '\n' < coords.csv
' to fix end of line delimiters
Dim Board
Dim xCoord
Dim yCoord
Dim Angle
Dim Designator
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("W:\nfatonion_altium\coords.csv", ForReading)
' Load current board
If PCBServer Is Nothing Then
ShowMessage("Not a PCB or footprint editor activated.")
End If
Set Board = PCBServer.GetCurrentPCBBoard
If Board Is Nothing Then
ShowMessage("Not a PCB or footprint loaded.")
'End
End If
Call PCBServer.PreProcess
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = replace(strLine,"\15", ",")
arrFields = Split(strLine, ",")
Designator = arrFields(0)
Dim Comp
Set Comp = Board.GetPcbComponentByRefDes(Designator)
If Comp Is Nothing Then
ShowMessage("No Designator :"+designator)
Call PCBServer.PostProcess
End If
Call PCBServer.SendMessageToRobots(Comp.I_ObjectAddress, c_Broadcast, PCBM_BeginModify , c_NoEventData)
xCoord = arrFields(n+1)
yCoord = arrFields(n+2)
Angle = arrFields(n+3)
Comp.X = Board.XOrigin + MMsToRealCoord(xCoord)
Comp.Y = Board.YOrigin + MMsToRealCoord(yCoord)
Comp.Rotation = Strtofloat(Angle)
Call PCBServer.SendMessageToRobots(Comp.I_ObjectAddress, c_Broadcast, PCBM_EndModify , c_NoEventData)
Loop
Call PCBServer.PostProcess