Trouble importing full 3D PCB into SolidWorks

The IDF export will only contain the board unless you create and add some IDF outlines. If you want a STEP model you need to use Maurice’s scripts. If you’re happy with an IDF model you will need to create definitions for the component outlines (more documentation at https://drive.google.com/open?id=0By_XTJN-s8aXbkM5UTE0Zm5SN28&authuser=0). There are 3 command line tools to help create outlines:

  • idfcyl: creates a cylindrical model which may have a lead on one side when vertical or an axial or radial lead when horizontal
  • idfrect: creates a rectangle which may have a chamfer or a single lead
  • dxf2idf: creates an IDF outline definition from a DXF outline file

If you wish to use IDF outlines they are easily scripted; the following is a sample script to produce the components for the pic_programmer demo board:

# large horizontal axial caps
idfcyl << _EOF
in
h
x
0.2
0.8
0.05
0.04
1.0
axial_cap.idf
_EOF

# vertical inductor L1
idfcyl << _EOF
in
v
r
0.30
0.35
0
inductor.idf
_EOF

# generic resistors
idfcyl << _EOF
in
h
x
0.08
0.3
0.02
0.035
0.4
r40generic.idf
_EOF

# diode, 0.5" pitch
idfcyl << _EOF
in
h
x
0.1
0.3
0.02
0.04
0.5
diode_050.idf
_EOF

# diode, 0.3" pitch
idfcyl << _EOF
in
h
x
0.08
0.2
0.02
0.035
0.3
diode_030.idf
_EOF

# dual caps
idfrect << _EOF
in
0.3
0.1
0.3
0
n
dual_cap.idf
_EOF

# LEDs
idfcyl << _EOF
in
v
r
0.1
0.2
0
led_5mm.idf
_EOF

# VR1
cat >vr1.idf << _EOF
.ELECTRICAL
“VR1” “PIC_PROG” THOU 110
0 -300 150 0
0 -300 -150 0
0 200 -150 0
0 300 -50 0
0 300 50 0
0 200 150 0
0 -300 150 0
.END_ELECTRICAL
_EOF

# dual caps
idfrect << _EOF
in
0.4
0.35
0.3
0
n
p1.idf
_EOF

# ZIF-40x0.6
cat >zif40x60.idf << _EOF
.ELECTRICAL
“ZIF40X60” “PIC_PROG” THOU 150
0 -1350 400 0
0 -1350 -400 0
0 -1450 -400 0
0 -1500 -350 0
0 -1600 -350 0
0 -1650 -400 0
0 -1650 -450 0
0 -1600 -500 0
0 -1500 -500 0
0 -1450 -450 0
0 750 -450 0
0 750 -600 0
0 800 -650 0
0 900 -650 0
0 950 -600 0
0 950 -450 0
0 1200 -450 0
0 1250 -400 0
0 1250 400 0
0 1200 450 0
0 -950 450 0
0 -950 600 0
0 -1000 650 0
0 -1100 650 0
0 -1150 600 0
0 -1150 450 0
0 -1300 450 0
0 -1350 400 0
.END_ELECTRICAL
_EOF

# TO-220 (horizontal)
cat >to220H.idf << _EOF
.ELECTRICAL
“TO220H” “PIC_PROG” THOU 180
0 0 150 0
0 200 150 0
0 200 200 0
0 800 200 0
0 800 -200 0
0 200 -200 0
0 200 -150 0
0 0 -150 0
0 0 150 0
.END_ELECTRICAL
_EOF

# J1 (DB-9F)
cat >DB9F.idf << _EOF
.ELECTRICAL
“DB9F” “PIC_PROG” THOU 520
0 650 -100 0
0 650 600 0
0 300 600 0
0 300 950 0
0 -300 950 0
0 -300 600 0
0 -650 600 0
0 -650 -100 0
0 650 -100 0
.END_ELECTRICAL
_EOF

# TO-92, +45 orientation
cat >to92-45.idf << _EOF
.ELECTRICAL
“TO92_45” “PIC_PROG” THOU 300
0 24.497 74.497 0
0 -74.497 -24.297 180
0 -17.077 -65.561 0
0 65.561 17.077 0
0 24.497 74.497 0
.END_ELECTRICAL
_EOF

# DIL8x30
cat >dil8x30.idf << _EOF
.ELECTRICAL
“DIL8X30” “PIC_PROG” MM 4
0 4.675 -4.06 0
0 4.675 -3.24 0
0 4.9 -3.24 0
0 4.9 3.24 0
0 4.675 3.24 0
0 4.675 4.06 0
0 -4.675 4.06 0
0 -4.675 3.24 0
0 -4.9 3.24 0
0 -4.9 -3.24 0
0 -4.675 -3.24 0
0 -4.675 -4.06 0
0 4.675 -4.06 0
.END_ELECTRICAL
_EOF

# DIL14x30
cat >dil14x30.idf << _EOF
.ELECTRICAL
“DIL14X30” “PIC_PROG” MM 4
0 8.485 -4.06 0
0 8.485 -3.24 0
0 8.71 -3.24 0
0 8.71 3.24 0
0 8.485 3.24 0
0 8.485 4.06 0
0 -8.485 4.06 0
0 -8.485 3.24 0
0 -8.71 3.24 0
0 -8.71 -3.24 0
0 -8.485 -3.24 0
0 -8.485 -4.06 0
0 8.485 -4.06 0
.END_ELECTRICAL
_EOF

# DIL18x30
cat >dil18x30.idf << _EOF
.ELECTRICAL
“DIL18X30” “PIC_PROG” MM 4
0 11.025 -4.06 0
0 11.025 -3.24 0
0 11.25 -3.24 0
0 11.25 3.24 0
0 11.025 3.24 0
0 11.025 4.06 0
0 -11.025 4.06 0
0 -11.025 3.24 0
0 -11.25 3.24 0
0 -11.25 -3.24 0
0 -11.025 -3.24 0
0 -11.025 -4.06 0
0 11.025 -4.06 0
.END_ELECTRICAL
_EOF

# DIL28x30
cat >dil28x30.idf << _EOF
.ELECTRICAL
“DIL28X30” “PIC_PROG” MM 4
0 17.375 -4.06 0
0 17.375 -3.24 0
0 17.6 -3.24 0
0 17.6 3.24 0
0 17.375 3.24 0
0 17.375 4.06 0
0 -17.375 4.06 0
0 -17.375 3.24 0
0 -17.6 3.24 0
0 -17.6 -3.24 0
0 -17.375 -3.24 0
0 -17.375 -4.06 0
0 17.375 -4.06 0
.END_ELECTRICAL
_EOF

# DIL40x60
cat >dil40x60.idf << _EOF
.ELECTRICAL
“DIL40X60” “PIC_PROG” MM 4
0 25 -7.87 0
0 25 -7.3 0
0 25.225 -7.3 0
0 25.225 7.3 0
0 25 7.3 0
0 25 7.87 0
0 -25 7.87 0
0 -25 7.3 0
0 -25.225 7.3 0
0 -25.225 -7.3 0
0 -25 -7.3 0
0 -25 -7.87 0
0 25 -7.87 0
.END_ELECTRICAL
_EOF

mkdir -p idf
mv *.idf idf

@jwr
here you can see the demo board converted to SolidWorks, by the kicad StepUp exporter tool

Thanks. I looked at the StepUp exporter tool, but was scared away by the apparent complexity of the export process.

Also, I’m not clear on whether StepUp will only work for the components whose VRML (.wrl) files have been converted to STEP? (in particular, the little subset shipped with the StepUp exporter tool?). This is the impression I got from reading the starter guide.

I am silently hoping this will all get rolled into KiCad one day, so that I can just click Export and be done with it :smile:

@jwr
the process to export the board to STEP is just one click
the only relatively complex part is to prepare the 3D library

to convert board and parts, you need to have a library of 3D STEP format parts (that will be necessary also when the new 3D refactory will be available, you will have to get IGES models instead of STEP)

Basic How To '(using kicad StepUp the easiest way)'
(not changing the way you use kicad)

1. just copy the STEP 3d models in the same folder in which there are your wrl 3d models and use the same name of the wrl model name (e.g. r_0603.wrl => r_0603.step)
2. go to your board folder and copy the script kicad_StepUp.FCMacro, the config file ksu-config.cfg and the file ‘launch-kicad_StepUp-demo.bat(sh)’ inside that folder, edit the config file ksu-config.cfg with e.g. notepad changing your model prefix to your KISYS3DMOD path, edit the config file launch-kicad_StepUp-demo.bat(sh) file adjusting FreeCAD path and pcbnew boad file name
3. export from kicad pcbnew the IDF model of the board NB export at Xref=0;Yref=0
4. run the script from command line or from a bash/batch file or with the command:
“path to Freecad executable file”/freecad <kicad_pcb_name.emn> ksu-config.cfg kicad_StepUp.FCMacro
‘(e.g. freecad mypcb.emn ksu-config.cfg kicad_StepUp.FCMacro)’
just watch the script assembly your 3D board with 3D models :slight_smile:

So the process is a bit complex only in configuring the 3D part library, which is not distributed with kicad…

some image of the 3D lib here:


I’m going to add more models to the 3D library I’ve done here, thanks to @Joan_Sparky:


if you go through the repo, you can find 3D models in STEP and VRML for:
chip resistors, chip capacitors, tantalum capacitors, aluminum capacitors, qfn ICs, dip ICs, qfp ICs, soic ICs, sot ICs, ssop ICs, tssop ICs

unfortunately arranging the 3D library is the most complex part in the exporting process… but when you have done it for one board, you have done for all :slight_smile:

Well, I guess I will have to get through this eventually…

I have one related question. Could you please explain the practical difference between STEP and IGES formats? Does IGES carry more useful information?

I’d like to know for the future, as I’m collecting my 3d model library.

1 Like

if you look at the web:
https://www.google.com/search?q=iges+vs+step


http://thatcadguy.blogspot.it/2012/12/step-vs-iges-or-why-step-is-better.html

you get some tips

when I decided to develop the exporter the options were:
kicad IgesUp
kicad StepUp
then the rest is just code :wink:

STEP is better because the data generally describes the solid models better via “winged edge structures”. IGES is a much older specification, is simpler to program for and still universally supported by MCADs, but is expected to decline in use over the next decade or so. The only drawback of STEP from the user’s perspective is the varying degree of support for different ‘Application Protocols’ since the standard has been changing rapidly since it started in the mid-1980s (first published 1995). The planned IGES export in KiCad is just a baby step towards STEP support; support is intended via a lightweight library rather than OCE/FreeCAD which has a very large geometry toolkit. But don’t believe the old hype about IGES being dead - that’s been going on since ~1988 long before STEP was even published. For electronics assemblies STEP should be the only thing you need; it’s a different matter in the mechanical manufacturing world where some outfits still prefer an IGES model due to old software or inconsistencies in the support of various STEP APs and their versions.

Ok, so to summarize — STEP is the way to go and I should build a collection of STEP models.

If you’re using StepUp scripts, draw your parts in FreeCad, export .step and .vrml and put them in the same folder. Reference your footprints to these and you’ll be good to go.

1 Like

and I’m building a 3D MCAD library ready to be used with standard kicad ‘.pretty’ module libraries…


Why do I think that a free 3D MCAD library is useful and important for kicad?
Because I would like to make possible to publish a full open hardware project: schematic, pcb and 3D mechanical model for enclosure design …
using pseudo free on-line libraries this full freedom cannot be achieved :smile:
I provided chip resistors, chip capacitors, Tantalum and Aluminum SMD capacitors
and I’m preparing most Gull Wings integrated circuits (SOIC, SSOP, QFP etc.) and QFN…
and I’m getting some help to add also connectors and some transistor and diode models…

2 Likes

@maui, you are doing fantastically useful work, thank you!

I hope some (or all) of what you are building will get pulled into KiCad, so that we can all just click “Export STEP” and be done with it.

1 Like

Now that I think of it, it would be even better if KiCad could export STEP, and also two bitmaps, to be used as texture maps for PCB top and bottom. That way you could create totally realistic-looking assemblies in your CAD. (Just a wish).

Not sure if I follow it or/and I dont know how that softwares works… but you can already export the layers (i.e: plotting) with kicad… maybe you need some external program (eg: inkscape and/or the gimp) to export to a image.
Depending on your skills dealing with textures, you can also take a screenshot of the 3d-viewer without models and use it as texture maps for your top and bottom planes.

Resume: you can do it already but not automatically, you need to have some skills with your CAD software and maybe other images softwares.

@kammutierspule My point was that I am hoping that all this will be done with a single click. Everything is theoretically possible today, but some operations require a lot of time and effort. @maui’s work is spectacular, but if I want to use it I still have to install FreeCAD, figure out the directory structures, download and install additional STEP models, and then learn how to use the scripts from a 27-page Starter Guide.

To be clear: I am not complaining, just quietly voicing my hopes for the future :grinning:

I’ve asked to developers mailing list a wish to have a configurable button in pcbnew to execute a python file
https://lists.launchpad.net/kicad-developers/msg21531.html
that would give the STEP exporter a more user friendly operability…
and would give the opportunity to easily run any python macro just with a click, avoiding the geek way to open the pcbnew python console and digit python commands

[EDIT]
@jwr please note that you will always would need a 3D library of STEP models to create your 3D mechanical model of board and parts…
(have a look e.g. what other famous PCB CAD do)
the way to convert VRML models to STEP is not feasible, because of non BREP models…
the opposite STEP to VRML is the only way… (and it is what the 3d refactoring will do internally in kicad)
for that reason I’m trying to put the attention on the need (I consider a must) to have a 3D library in STEP for 3D models/parts and I’m putting a lot of effort on that :smile:

  1. FreeCAD is a MCAD modeler … so you get a plus installing … after a bit you probably will find it a very nice tool
  2. download and install additional STEP models -> we need a 3D mechanical library
  3. learn how to use the scripts from a 27-page Starter Guide… I know I’ve been a bit verbose :slight_smile: , but the pages are about the script options, the tools, the 3D parametric libraries I’ve done… if you just want to run the script you can stop the reading at page 2 (page 1 is the Table of content)

@maui Yes, I understand the need for a STEP library, I just think that either KiCad should switch to STEP models, or dual STEP+VRML libraries should be maintained. Your library-building effort is impressive, and I hope it will make its way into KiCad.

I suspect that VRML was chosen because it was easier to implement than anything else, so it’s likely mostly a historical reason now.

That would be dependent on the exporter / file format. It depends on work related with exporters. I guess for the CAD exporters they will not be very happy to spend time on a feature like this.
Maybe if we have some exporter to render propose (eg: to be render in blender…etc) we can have something like that.

not just that… but STEP format is behind a paywall afaik, I couldn’t find an easily accessible format specification for it… VRML standard is open source.

from Goolge

STEP-File is the most widely used [citation needed] data exchange form of STEP.
ISO 10303 can represent 3D objects in Computer-aided design (CAD) and
related information. Due to its ASCII structure it is easy to read with
typically one instance per line.


http://stepcode.org/
http://stepcode.org/docs/home/
http://stepcode.org/docs/p21_cpp_example/

I would say it is just a bit more complex then vrml…

but there are libraries like Open Cascade (used by e.g. FreeCAD) or StepCode :slight_smile:

so I would vote for

cool, stepcode.org is new to me - thanks for the link.
It’s because of the ISO thing I stumbled across and the steptools website… all very commercial.