pcb

OpenSCAD 3D-model exporter

Bug #699502 reported by Bert Timmerman
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcb
In Progress
Wishlist
Bert Timmerman

Bug Description

Hi all,

I started coding a OpenSCAD exporter, based on the XY-file part of the BOM exporter.

This is a work in progess and significant changes may occur in the (near) future ;-) and YMMV, and all other possible disclaimers may apply.

The git patches apply against the following git HEAD as of:

October 9th, 2011 (I rebased my branch).

For convenience I gave the patches a sequential number to indicate the patch order.

Suggestions on how to improve the OpenSCAD exporter are always welcome, either on geda-dev, #geda irc or private e-mail.

Kind regards,

Bert Timmerman.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Hi,

I forgot to mention that my git repository lives here:

https://github.com/bert/pcb-openscad

Kind regards,

Bert Timmerman.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

This one needs some TLC for rework needed because of the internal nm-resolution introduced recently.

WARNING: please do not patch !

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Adapted to the recent nm resolution changes.

The OpenSCAD exporter seems to have the same
behaviour as before the changes in the pcb core units.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :
tags: added: 3rd-party-export
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Fixing a small bug

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Made thickness of the board an input parameter.

The thickness can now be entered in either the
GUI dialog window or, if all goes well, as a command
line option.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

All Users have the right to read the documentation.

After running into trouble Users can determine where
they deviated from the road to success.

description: updated
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Added documentation for OpenSCAD command line options.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Remove the dot before the footprint suffix too.

When removing the footprint suffix "fp" from the string in the
description string, remove the dot as well (resulting in removing ".fp"
from the string if this sequence of characters occurs).

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Made thickness of the board an input parameter.

The thickness can now be entered in either the
GUI dialog window or as a command line option.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Added an OpenSCAD exporter paragraph to pcb.texi

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Remove remaining RCS $Id$ identifiers left over from our CVS days.

Changed in pcb:
status: New → In Progress
Changed in pcb:
assignee: nobody → Bert Timmerman (bert-timmerman)
Revision history for this message
levente (leventelist) wrote :

This is cool! Please let us know if it works. How do you get the 3D data from the footprints? E.g. the height?

Revision history for this message
Traumflug (mah-jump-ing) wrote :

Indeed great work!

I just pushed it into a branch of the main repo, the branchs' name is LP699502-openscad-exporter. I did so after fixing a few whitespace errors in the exported text and fixing a leak of via_name (many instances created, only one free()). I did this not by adding new commits, but by fixing the existing commits. Maybe a bad habit of mine.

A few issues are left:

- Trying to render the result (exported with default settings) in OpenSCAD results in these OpenSCAD errors:

WARNING: Can't find 'include' file 'COLORS.scad'.
WARNING: Can't find 'include' file 'CONST.scad'.
WARNING: Can't find 'include' file 'BOARD.scad'.
WARNING: Can't find 'include' file 'PIN_HOLE.scad'.
WARNING: Can't find 'include' file 'VIA_HOLE.scad'.
WARNING: Can't find 'include' file 'PACKAGES.scad'.
WARNING: Can't open 'use' file 'INSERT_PART_MODEL.scad'.

Not sure where these files should be, but I'm pretty sure standard ones should be included by default.

- Tests fail. BTW., thanks a ton for creating them!

All test fail with this:

@@ -2,5 +2,5 @@
  * \file Basic_OpenSCAD_Test.scad
  *
- * \author Copyright Bert Timmerman.
+ * \author Copyright Markus Hitter.
  *
  * \brief PCB - OpenSCAD 3D-model exporter Version 1.0

Not easy to detect for a single developer ;-)

Tests 2 and 4 additionally fail with this:

@@ -32,6 +32,21 @@
 DRILL_HOLE = [1.0, 1.0, 1.0];

-include <CONST.scad>
-include <BOARD.scad>
+$fa = 1;
+$fs = 0.1;
+$fn = 36;
+$t = 0.01;
+
+module BOARD
+(
+ length,
+ width,
+ thickness,
+)
+{
+ color (FR4)
+ {
+ cube([length, width, thickness], center = false);
+ }
+}

 module PIN_HOLE (x, y, diameter, depth)

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Hi all,

Now this exporter lives in a topic branch in the main pcb repo it's about time for some further explanation.

WARNING: there still are some caveats and bugs ! Do not use on production work --> play it safe in a sandbox ;-)

The exporter creates a single file defining the toplevel 3D model in OpenSCAD language (resembles C code), have a look at the generated pcb.pdf file in the doc subdirectory (page 28 and further) for a bit more detailed information.

The maximum length and maximum width dimensions of the board are used regardless the information in the outline layer.

The height of the parts is not generated from footprints, pcb has no knowledge of that, pcb doesn't even know the board thickness.

You have to specify board thickness in the exporter pop-up dialog window, the dialog gives a default value (in mil/100 or mm) which can be altered.

The parts on the pcb themselves are to be created by the user (IMHO content is the user's responsibility, geda-devs should only supply methods), if you want some I made look here:

https://github.com/bert/openscad-models

Either download a zipped archive or git-clone (or fork as a github repo and add for all to benefit).

YMMV ;-)

Make sure all required 3D models are within the scope of the toplevel 3D model file.

Based on demand these will be included by OpenSCAD.

By ticking 'modules' some basic modules for the 'board', 'pin holes', 'via holes' and a module for inserting parts are inserted in the top level 3D model file, do not tick if you want to use your own *.scad files for those basic modules.

If you have more questions please do ask.

Patches, comments and all other forms of feedback are welcome.

Kind regards,

Bert Timmerman.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Hi Markus,

I should debug the tests w.r.t. the latest commits altering the output (or creating bugs).

The line with '\author' should/could be handled properly, I will look into this, there is a solution for one of the other exporters, let's adapt that one for the OpenSCAD exporter.

Other (shallow) bugs will surface once this code is viewed by many eyes ;-)

Kind regards,

Bert Timmerman.

Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Done ;-)

Traumflug (mah-jump-ing)
Changed in geda-project:
importance: Undecided → Low
status: New → In Progress
importance: Low → Wishlist
no longer affects: pcb
affects: geda-project → pcb
Changed in pcb:
importance: Wishlist → Low
importance: Low → Wishlist
assignee: nobody → Bert Timmerman (bert-timmerman)
Revision history for this message
Traumflug (mah-jump-ing) wrote :

Please keep your fingers off geda-project unless you want to contribute to it.

Changed in geda-project:
importance: Undecided → Wishlist
status: New → In Progress
Changed in pcb:
milestone: none → future-feature-release
Changed in pcb:
milestone: pcb-4.2.0 → future-feature-release
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

Bug watches keep track of this bug in other bug trackers.