Scripted placement of Rooms? - Page 1
Forum section: electronics / general

author: mrpackethead
author_rank: Super Contributor
timestamp: July 15, 2015, 09:11:38 pm
content: 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 delimitersDim BoardDim xCoordDim yCoordDim AngleDim DesignatorSet objFSO = CreateObject("Scripting.FileSystemObject")Set objFile = objFSO.OpenTextFile("W:\nfatonion_altium\coords.csv", ForReading)' Load current boardIf PCBServer Is Nothing ThenShowMessage("Not a PCB or footprint editor activated.")End IfSet Board = PCBServer.GetCurrentPCBBoardIf Board Is Nothing ThenShowMessage("Not a PCB or footprint loaded.")'EndEnd IfCall PCBServer.PreProcessDo Until objFile.AtEndOfStreamstrLine = objFile.ReadLinestrLine = replace(strLine,"\15", ",")arrFields = Split(strLine, ",")Designator = arrFields(0)Dim CompSet Comp = Board.GetPcbComponentByRefDes(Designator)If Comp Is Nothing ThenShowMessage("No Designator :"+designator)Call PCBServer.PostProcessEnd IfCall 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)LoopCall PCBServer.PostProcess

author: free_electron
author_rank: Super Contributor
timestamp: July 15, 2015, 10:03:57 pm
content: you do know that you can load a pick and place file right ?tools - component placement- place from file ...

author: mrpackethead
author_rank: Super Contributor
timestamp: July 16, 2015, 03:20:57 am
content: Quote from: free_electron on July 15, 2015, 10:03:57 pmNo , thats a new one on me. In my case, not sure if it would have helped, i would have had to arrange my data into a suitable file, for it to have been read by altium, either way, i'd have had to write some code/script to convert from one side to the other.The big advantage of being able to move a room is that I can route one room out, then paste the routing format to the other ones.. Since i need to repeat this several hundred times, i'd love to be able to script the move.

author: free_electron
author_rank: Super Contributor
timestamp: July 16, 2015, 03:48:32 am
content: room copy only works if the schematic is designed as multichannel

author: mrpackethead
author_rank: Super Contributor
timestamp: July 16, 2015, 04:40:30 am
content: Quote from: free_electron on July 16, 2015, 03:48:32 amWhich it is. Thats not the problematic bit. The problematic bit is moving named rooms to specific locations.