question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component offset in POS file

See original GitHub issue

Hi, To be fair, I am not sure if it is some configuration I have, or something to do with the plugin…

Describe the bug Position data is offset for components selected through the JLCPCB component selector. ~7.6mm in -x direction

To Reproduce Steps to reproduce the behavior:

  1. Go to PCBNEW
  2. Click plugin button
  3. Select JLCPCB Components
  4. Generate assembly files
  5. View POS file is incorrect (Within JLCPCB viewer) -> components are shifted 7.61118mm -x

Expected behavior POS file to be correct

KiCad Version

Application: KiCad (64-bit)

Version: (6.0.6), release build

Libraries:
	wxWidgets 3.1.6
	libcurl/7.82.0-DEV Schannel zlib/1.2.12

Platform: Windows 11 (build 22000), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Jun 26 2022 02:39:06
	wxWidgets: 3.1.6 (wchar_t,wx containers)
	Boost: 1.79.0
	OCC: 7.6.0
	Curl: 7.82.0-DEV
	ngspice: 37
	Compiler: Visual C++ 1929 without C++ ABI

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Bounicommented, Jul 29, 2022

Thank you for your detailed research! I guess when we use the PR #199 and add popt.SetUseAuxOrigin(True) as well we cover most cases.

1reaction
Jan21493commented, Jul 27, 2022

I was a bit impatient, so I modified the plugin a bit. I replaced a part in file fabrication.py:

    def generate_pos(self):
        """Generate placement file (POS)."""
        posname = f"POS-{self.filename.split('.')[0]}.csv"
        self.corrections = self.parent.library.get_all_correction_data()
        designSettings = self.board.GetDesignSettings()
        m_place_Offset = designSettings.GetAuxOrigin()
        self.logger.info(f"origin point for POS data is origin point for drill files (%d, %d) mm" % (ToMM(m_place_Offset.x),ToMM(m_place_Offset.y)))
        with open(
            os.path.join(self.assemblydir, posname), "w", newline="", encoding="utf-8"
        ) as csvfile:
            writer = csv.writer(csvfile, delimiter=",")
            writer.writerow(
                ["Designator", "Val", "Package", "Mid X", "Mid Y", "Rotation", "Layer"]
            )
            for part in self.parent.store.read_pos_parts():
                for fp in get_footprint_by_ref(self.board, part[0]):
                    if get_exclude_from_pos(fp):
                        continue
                    fp_pos  = fp.GetPosition()
                    fp_pos -= m_place_Offset
                    writer.writerow(
                        [
                            part[0],
                            part[1],
                            part[2],
                            ToMM(fp_pos.x),
                            ToMM(fp_pos.y) * -1,
                            self.fix_rotation(fp),
                            "top" if fp.GetLayer() == 0 else "bottom",
                        ]
                    )
        self.logger.info(f"Finished generating POS file")

It should be easy to find. It looks that this solves the problem for myself. I haven’t ordered a new pcb yet and I’ve only verified the top layer, so I’m not sure if this solves the problem completely.

I also found this: https://forum.kicad.info/t/coordinate-system-grid-and-origins-in-the-pcb-editor/24535 to explain the topic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

POS File Format - X-Ways
Specifies the start offset of the position itself, i. e. the offset within a file or a disk. In case of disk partitions...
Read more >
Generate Position File in Kicad - Help Center - PCBWay
Select the menu bar Place-> Drilling and Position Offset, place the origin at the bottom left corner of the PCB board frame, and...
Read more >
Footprint Position File X coordinates suddenly negative
So the problem is that suddenly the X coordinates in the output POS file went negative. I've tried moving the Drill and Place...
Read more >
How to write at a specific address using pos mode and pos offset
I want to reserve the first 100 bytes for a binary file and start writing raw data from the 101th byte address. I...
Read more >
offset-position - CSS: Cascading Style Sheets - MDN Web Docs
If two non-keyword values are used, the first value represents the horizontal position and the second represents the vertical position. If only ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found