Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ksuToolsAddTracks fail #195

Closed
myamigo opened this issue Nov 10, 2023 · 12 comments
Closed

ksuToolsAddTracks fail #195

myamigo opened this issue Nov 10, 2023 · 12 comments

Comments

@myamigo
Copy link

myamigo commented Nov 10, 2023

Description

I have a fairly complicated PCB (8 layers, 805 components) that I am importing into FreeCAD using KiCadStepUp. The "Load Board" command works fine and finishes in about 1 min. When I move to "Add Tracks" I hit a fault after a little more than 1 hr...

10:13:27  zones done
10:16:29  running time: 3850.488sec
10:16:29  running time: 3853.867sec
10:16:29  Sketch001
10:16:29  Running the Python command 'ksuToolsAddTracks' failed:
Traceback (most recent call last):
  File "C:\Users\scott\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\.\kicadStepUpCMD.py", line 4352, in Activated
    add_toberemoved = tracks.addtracks()
  File "C:\Users\scott\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\.\tracks.py", line 647, in addtracks
    topPads_cut_Name, temp_tobedeleted = cut_out_tracks(pcb_sk,topPads,ftname_sfx)
  File "C:\Users\scott\AppData\Roaming\FreeCAD\Mod\kicadStepUpMod\.\tracks.py", line 238, in cut_out_tracks
    FreeCAD.ActiveDocument.getObject('Board_Geoms'+tname_sfx).addObject(extrude)

<no object bound to built-in method addObject>

The fault occurs while processing the top layer.

Given how log it takes to get to the fault I worked on getting the file size down to narrow focus and managed to isolate it to an edge case, literally.

I have a castellated edge connector in my design to which I attach a Tag Connect EC-10 edge connector adapter. The board edge should run down the center of the holes, splitting them in two as shown below...

image

image

If I move the board edge so it clears the TC_EC-10 pads (Y=0.64mm) then fault does not occur...
image

image

If I set the bottom edge of the board to Y=0.63mm then the fault occurs.

Steps to reproduce

  1. Save StepUp_Issue#195.zip file to a folder and extract the board file.
  2. Run FreeCAD and enabled the StepUp WB
  3. "Load Board" then "Add Tracks"
  4. Verify fault
  5. Edit the board outline and set the lower edge at 0.64mm
  6. Repeat step 3 and verify that there is no fault
  7. Edit the board outline and set the lower edge at 0.63mm
  8. Repeat step 3 and verify that there is fault again

FreeCAD | kicadStepUpMod Version

OS: Windows 11 build 22631
Word size of FreeCAD: 64-bit
Version: 0.21.1.33668 +26 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/Canada (en_CA)
Installed mods: 
  * kicadStepUpMod 10.21.1

KiCad Version

Application: KiCad x64 on x64

Version: 7.0.8, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1

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

	wxWidgets: 3.2.2 (wchar_t,wx containers)
	Boost: 1.81.0
	OCC: 7.7.1
	Curl: 7.88.1-DEV
	ngspice: 41
	Compiler: Visual C++ 1936 without C++ ABI

Build settings:
	KICAD_SPICE=ON

@easyw
Copy link
Owner

easyw commented Nov 10, 2023

@myamigo
thanks for the detailed feedback.
I tried your board but I cannot reproduce your issue...
I get only this warning message:
Part::Extrusion: Link(s) to object(s) 'Sketch' go out of the allowed scope 'Extrude57'. Instead, the linked object(s) reside within 'Board_c493'
here my FC info:

OS: Windows 10
Word size of FreeCAD: 64-bit
Version: 0.21.1.33694 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3

tested also with the one from the installer:

OS: Windows 10 build 18363
Word size of FreeCAD: 64-bit
Version: 0.21.1.33668 +26 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3

StepUp_Issue#195-castellated-kv7.zip
I downloaded FC from here:
https://github.com/FreeCAD/FreeCAD/releases/download/0.21.1/FreeCAD_0.21.1-Windows-x86_64.7z

Your issue and FC error seem similar to this issue #179

As a side note, please consider to add Grid origin to your kicad_pcb file... then all your sketches in FC will be aligned to this origin.
StepUp_Issue#195-castellated-wGridOrigin-kv7.zip

@myamigo
Copy link
Author

myamigo commented Nov 11, 2023

Hmmm. What version of KiCad are you running? I prefer aux=drill origin so the PCB lines up with other mech models.

@myamigo
Copy link
Author

myamigo commented Nov 11, 2023

That error mssg with sketch out of scope seems to be relevant. Does the mssg go away when the board outline is extended past the part?

@easyw
Copy link
Owner

easyw commented Nov 12, 2023

Hmmm. What version of KiCad are you running? I prefer aux=drill origin so the PCB lines up with other mech models.

you can choose aux=drill origin as you prefer,
but then you have to set in FC kSU pref the same.
Then FreeCAD and KiCAD will use the same reference for mech objects

aux-origin

in kicad v7 grid origin is hidden under long click on aux origin icon
grid-origin

https://forum.kicad.info/t/grid-origin-in-kicad-6-solved/32030/3

@myamigo
Copy link
Author

myamigo commented Nov 12, 2023

Thanks for the tip!

I solved my "no object bound to built-in method addObject" problem at line #238 of tracks.py

I changed that line from:

        FreeCAD.ActiveDocument.getObject('Board_Geoms'+tname_sfx).addObject(extrude)

to

        try:
            FreeCAD.ActiveDocument.getObject('Board_Geoms'+tname_sfx).addObject(extrude)
        except:
            print('EXCEPTION: Board_Geoms'+tname_sfx+'.addObject(extrude)')
            pass

And it happily gets by. I don't know exactly what is going on under the hood but I expect the edge connector is getting split into two zones groups with one being associated with the board because it is inside, and the other is left as an orphan. This change seems to handle the orphan.

This got me by that issue and on to another one involving net-ties that I will create another issue for.

Thank you for your help and a great FC add-on.

@easyw
Copy link
Owner

easyw commented Nov 12, 2023

@myamigo
please test the board with the new update 0f8c4d5 ...
it should solve the issue and keep the cut for tracks.

@myamigo
Copy link
Author

myamigo commented Nov 13, 2023

Confirming that your update gets by the issue. I'm testing it with my larger PCB now and I'll report the result. I'm also using the grid origin after setting it to the drill origin (PCB center).

@myamigo
Copy link
Author

myamigo commented Nov 13, 2023

The larger PCB import completed and it looks much better but now I am noticing problems.

There is a large rectangular "pad" that is the size of the overall GND pour included with the topPads face but it is located at the design origin (0, 0) where the grid origin is now at (200, 100).
image

If I Draft | Downgrade the face I can select and delete the rectangle. Then I can select all of the downgrade shapes and Upgrade them gain I have what I expect... almost!

I am noticing random instances of pads missing...
Here is a 12x12 BGA in KiCad...
image

... and after the FC_ SU import...
image
... that is mostly showing a 9x9 pattern.

This show show 2 pads and a net-tie (highlighted) ...
image

The ISP_BOOTn pad and net-tie next to it are missing in FC as is the footprint below...
image

In another spot I see a track area that has not been completely constructed. ...
In KiCad...
image

When imported...
image
Several pads are missing in this view and the highlighted rectangle does not have a outline like the other objects. I think I can work with the output now so I can export to STEP an load back into my CAD package for assembly fit and rendering.

I am willing to try anything you might suggest but I have to get back on track.

@myamigo
Copy link
Author

myamigo commented Nov 13, 2023

I may be seeing more issues with the use of complex pads as I note in #196 (comment)

I'll report what I find.

@easyw
Copy link
Owner

easyw commented Nov 13, 2023

If you are looking for rendering, you may look for kicad to blender plugin.
To get assembly checking, missing some pads shouldn't be an issue at all.
The main purpose of kicadStepUp is the mechanical integration and tracks are added just for this scope.

@myamigo
Copy link
Author

myamigo commented Nov 14, 2023

I've not looked at Blender yet but I will. I'm also looking for high quality renders of our product with the PCB in exploded view so our pro CAD package is best for that. Anyway, I'm getting closer to a solution.

@myamigo
Copy link
Author

myamigo commented Nov 15, 2023

My issues have been addressed with updated FP's as per #196.

@myamigo myamigo closed this as completed Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants