PCB shape from enclosure STEP file

Agreed. Holes as (locked) footprints are better. They add silkscreen, an indication of an area to keep clear of tracks, and for metal enclosures they can provide a GND connection to the enclosure.

In the end it does not matter much.
If they are circles on Edge.Cuts, they’re still freely editable in KiCad and can be deleted again (or moved to a user layer) after they have been used as a reference to place footprints.

I don’t have the convert arcs to circles option on my toolbar?

@ptr727
that is a today addition, following a trick I used to generate footprint from sketches.
I just noticed that many step files, particularly if coming from sw, have circles splitted in two semi-circles…
then I decided to do a little hack to avoid to redraw each circle.
You just need to update the ksu wb.

1 Like

What about:

Adding tangential constraints is by far the most time consuming single step in making an extracted sketch fully constrained.

1 Like

Here is the method that I use to import Hammond case outlines.

  1. Download the 2D CAD file which is in DWG format. If you open the file in a text editor the text at the top of the file AC1018 indicates AutoCAD DWG 2004.
  2. Open the file in QCAD and delete any parts of the drawing that you don’t need.
  3. Select all the drawing items with Ctrl-A and Modify->Explode so that all polylines become single items.
  4. Save a copy of the drawing as DXF R12 as Kicad can import this ok.
  5. In PcbNew use File->Import Graphics to load the DXF items onto the layer of your choice. For the screen capture I have added a Kicad dimension to show that the import dimensions are correct and have selected an arc. Notice the “Dimensions:” text on the capture. These graphics do not show in Qcad on the Model Space page but are there on the Qcad blocks list.
  6. It’s helpful for positioning in Kicad, to add a reference point or line somewhere .e.g between two mounting holes.

image

I wanted to try this way of getting the board outline (such a nice tool!!), however I did find a small error:

The loop selection worked great!

But the getting an sketch from a coplanar edge, produces a rotated sketch:

Comparing the “Data” from the 3D Model and the Sketch:
3D Model
image

Sketch
image

Changing the Placement Axis to Z=1, gives me the correct rotation of the sketch

Just wanted to let you know, is really a minor issue easily corrected! Thanks a bunch for the mini tutorials and KSU !

EDIT: The same rotation occurs when changing the 2D Drawing to sketch again (changin Placement Axis to Z=1 solves it also)

This looks suspicious:
image

The way rotating works in FreeCAD, is with an angle, and a vector, and the object is rotated around the vector.
The length of the vector is not (very) important, but it must have some length and therefore a direction.

In your case both X, Y and Z are set to zero, resulting in a zero length vector with an undefined direction.

Yah…

Did you used the tool from bottom view instead of top view? that could lead to a mirrored sketch…
In that case just rotate your object of 180 degs and repeat the process, but from the top view, on the upside-down object… that should solve the issue

4 Likes

Yes I did !

I can confirm that selecting my edge and changing the perspective to top view, produce the desired results!

Once again thanks a bunch !

3 Likes

I’ve tested this online CAD file converter - https://cloudconvert.com/dwg-to-dxf
The site says that you can use CloudConvert absolutely free for up to 25 conversions per day. The site happily converted the Hammond DWG to R12 DXF which imported correctly into PcbNew.

1 Like

The free Autodesk Trueview viewer can convert between DWG versions

also LibreCAD has dwg support…

2.2.0 release does read dwg and save as dxf

LibreDWG is good for R2000, which is where the Autodesk Trueview is useful to convert their almost annual file format change backwards.

If you’re experienced with FreeCAD or want to learn it, the suggestion others have made below work well.

But if you have the dimensions of the box with the detail provided (Hammond), you can actually create the outline of the board fairly easily with KiCAD.

The easy trick is to use the target object to drop at all the key points from that mechanical drawing.
Targets are on the edge cut layer. Left there they will cause you a lot of grief. If you send the board out to a PCB Shop. However if you can save the KiCAD project, close it - then open up the board layout file with a simple text editor - find the “targets” lines and change them from the edge cut layer to the margin layer. Save the file, close your favorite editor. Re-open the board layout file. The targets will have changed from “yellow” (edge cut) to “magenta”.

Board manufacturers pretty much ignore the margin layer – but they might actually try machining the edge cut layer.

Once those targets have been moved MANUALLY to the margin layer - you can drag and drop them to adjust the locations as needed.

Depending on the version of KiCAD you are using the 0,0 reference point may seem a little awkward (its upper left - if I remember correctly). One trick is to drop an ordinary target at the 0,0 location – then use the measuring device (ruler) to correctly lay down the “margin targets” you have… I save those measurements by simply unchecking the “show layer” for them – when not needed.

Once the “margin layer targets” are located correctly, you can draw margin lines that connect the center of the “margin layer targets”. I also then use those same targets and a small offset to lay down the edge cuts. Same goes true for the fill zones.

This works well because when the project is nearly completion – you can print a B&W PDF of the layers you select. Makes it easy to then create any addtional STL files for 3D printing.

This trick works well for simpler KiCAD projects. If the boards are going to have lots of corners shapes and need to be VERY precise – learn FreeCAD or another tool.

1 Like

this is an issue in main FC code… probably not with an immediate solution
Anyway I’ve added a dirty hack for this user case… it should work correctly now (please update the WB and test it)

1 Like

Thanks a bunch! I download the latest version, but unfortunately the behavior is the same. Creating the sketch while having the bottom perspective produces a rotated sketch as before.

Maybe I needed to do something different to trigger the hack ?

OS: Windows 10 Version 1903
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Germany (de_DE)


08:32:24  PoM not present
08:32:24  using 'Part' container and 'Links'
08:32:24  FC Version 019-24276
08:32:24  kicad StepUp version 9.7.6.2
08:32:24  tolerance on vertex applied
08:32:24  applying Materials to Shapes
08:32:24  your home path is C:\Users\uestrada
08:32:24  export to STEP False
08:32:24  Tabified done !
08:32:24  done!

may you send me the FC file? (even in pm if you prefer…)

I’ve been watching this post… it’s gotten cluttered, and amusing…

It seems to me that if the ‘collective’ goal is making an enclosure from a PCB (either extracted via KSU or, drawn in Kicad, Libre/other), a useful approach would be:

• Know where you want the PCB’s Shape (such as to make mounting features/display window…Enclosure…etc).
So, you can make Datum planes or use existing Faces/etc.

Then,

  1. Draw the shape in FreeCad and go through the process.

Or,

  1. Use an extracted DXF, or Step, or the PCB loaded from KSU

  2. Create a Datum-Plane (I love Datum-Planes, you should too!)

  3. Project the shape and Re-Map it to desired Datum-Plane or Face

Note: if using the PCB loaded by KSU, you can select the pcb from the list and use it for 2D projection

Note: Learn to use Datum’s, Part-Design, Part and Draft (and/or sketcher)

Example shows:

• A PCB with some Parts loaded via KSU
• A New Body added
• Two Datum Planes added for re-Maping to
• KSU Tree expanded to reveal the PCB’s shape
• View re-oriented to TOP view (to avoid Angle placements)
• Draft Workbench
• PCB selected from Tree
• 2D Projection onto the Datum Planes and ReMapped as desired

From there, it’s easy to re-orient rotations/etc…

tofu

I am happy to report that the latest changes of ksu fixed my issue, I am able to create the sketch from bottom view with the correct orientation! Thanks a bunch!

Even when doing it at an angle:

11:26:59  PoM not present
11:26:59  using 'Part' container and 'Links'
11:26:59  FC Version 019-24276
11:26:59  kicad StepUp version 9.7.6.2 

@BlackCoffee

I am not very familiar with FreeCAD or CAD in general, so maybe this question is silly, but are Datum Planes similar to a local coordinate system ? Are they always orthogonal to the global coordinate system?

1 Like

A short answer require’s your knowing enough about CAD (all parametric CAD programs use them).

So, a longer and more ‘cryptic’ explanation: Think of Datum-Planes as a Sheet of Paper - a Reference-Container for holding Sketches, Bodies, Parts…etc. They can be placed wherever and at any Angle and are Independent but can be referenced to the primary coord system (if desired).

Because they (and the sketches, bodies,parts/features) are Independent, and are, thus ‘Portable’ they reduce potential for headaches.

Sure, for simple designs, I don’t bother but, for real work, a user can’t get by without using them (but don’t often realize that until the design needs to change and the Lesson gets learned…).

Say you model a three-level building and the third-level started it’s build by attaching to the features of second-level (one man’s ceiling is another man’s floor). That makes sense. But, what if you wanted to delete the second-level… Ouch, the third-level comes crashing down. That is, unless it was built from a Datum-plane instead of the second-level… get it!

And, what if you wanted to use that second-level for another building… Datum-planes is the trick.

Note: Datum-planes, Datum-Axis, Datum-point…etc are NOT the same a “Datum’s” used in CAD/other drawings. Totally different beasts.

1 Like