Pulsonix User Forum

Technical advice from Pulsonix engineers and the wider community.

 All Forums
 Help with using Pulsonix
 Setting component positions in PCB Design

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List

* Forum Code is ON

   Upload a file

Check here to subscribe to this topic.

T O P I C    R E V I E W
rabryan Posted - 19 Sep 2014 : 11:20:14
I'm trying to automate the placement of certain components' positions in the PCB Design editor via javascript. I've tried assigning the Position.X and Position.Y attributes of the component directly with a float as well as trying to set them with the Design.toDSU() function, but neither seem to have any effect. Has anyone been able to assign positions to pcb components? Below is the full code. Also, is there a log or console anywhere that shows any output from the running of the script?

var Design = ActiveDocument();
var DesignComps = Design.Components();
var Comps = new Enumerator(DesignComps);

// Spin through the list of components.
for (; !Comps.atEnd(); Comps.moveNext()) {

    // Retrieve the current component.
    var Comp = Comps.item();
    Comp.Position.X = Design.ToDsuX(0.0);
    Comp.Position.Y = Design.ToDsuY(0.0);
    // Have also tried this
    //Comp.Position.X = 0;
    //Comp.Position.Y = 0;

3   L A T E S T    R E P L I E S    (Newest First)
psxforum Posted - 19 Sep 2014 : 12:48:02
If you are placing items in a circular pattern, I would suggest you investigate Polar grids if you haven't already done so. A grid (for snapping items onto) usually gives you straightforward X Y steps, but by setting a grid as Polar you can tell it to start from a given location and subdivide the circle around that point by the required angular step, and also apply a number of concentric rings. It will also auto-rotate components as you place them at intersection points on the grid.

As things stand in the current software, there isn't really any way to feed the application with a list of component positions and angles

rabryan Posted - 19 Sep 2014 : 12:34:20
Hi David. Thanks for the quick reply. Is there any other way to set position data for a large number of components outside of scripting? We have 60 led and resistors we're placing in a circular pattern. Just to change the radius of the circle, we have to: computer x,y coordinates from radius,angle in excel; click through each led/resistor pair and set the coordinates through the dialog. Perhaps there a text format such that we could copy it to the clipboard and then do an "apply layout to selected" operation?
psxforum Posted - 19 Sep 2014 : 12:07:41
Sadly, what you are trying to do is not currently possible. Contrary to what it says for data type 'Point' (that X and Y have both Get and Set functions), you will find on the page for DesignItem (the base class of most design objects) that the Position property has a 'Get' but no 'Set' function. This means that for items like components you can get the current position but you cannot change it.