discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Using QCAD or Inkspace to get details into OpenSCAD?

S
shadowwynd
Wed, Jun 2, 2021 11:37 AM

The key is having an accurate sense of scale.  My preferred way is to use a
flatbed scanner (or a copier with scan feature, if I am at work) with the
part of which I need (e.g. hole placement, complex curves, etc.) but to also
include a rectangular scale model (such as a credit card - something that I
can easily measure and get exact dimensions on).  If I am starting from a
photo then I try to take the photo as orthogonal as possible, but the camera
skew makes this really difficult.

In practice, most of the scanners I have used have some autoscale involved
that throws things by a centimeter, which is why having a scale reference is
important.  I then open the scan in inkscape, draw a matching scale
rectangle based on measured dimensions (e.g. a typical credit card is 85.6mm
x 53.98 mm, so I would draw a rectangle that size in inkscape (with no outer
line, as that adds thickness, and lower the opacity to say 50%) and then
scale the scan so that it matches the size of the scale model.

If the part you are tracing is thin enough that you can shut the scanner
bed, you should have high contrast between part and background and then the
"Path-->Trace Bitmap should work very well.  If the part sticks up enough
that you can't shut the scanner, I use the Freehand Line tool to trace the
outline (50% opacity trick works here also) and then Node Edit to get the
points where I need.

The newer versions of OpenSCAD can import SVG files, otherwise you need to
use DXF.  Especially when using DXF, I do Extensions-->Modify Path-->Flatten
Beziers  with angularity of 0.1 or so (OpenSCAD tends not to like curves in
a DXF, so converting a curve to a LOT of small line segments helps).

On importing the SVG/DXF into OpenSCAD (leave the file open in Inkscape), I
leave the scale model (at least at first).  I make a simple square in
OpenSCAD that matches the (credit card or whatever) dimensions and make sure
that the size still matches and I don't need to scale or resize it (Inkscape
recently changed their default DPI and broke Inkscape OpenSCAD export tool I
used, and I haven't checked if it has been updated yet, and I have seen both
DXF and SVG be drawn in a "wrong" size, so having a second size check saves
hair-pulling.

--
Sent from: http://forum.openscad.org/

The key is having an accurate sense of scale. My preferred way is to use a flatbed scanner (or a copier with scan feature, if I am at work) with the part of which I need (e.g. hole placement, complex curves, etc.) but to also include a rectangular scale model (such as a credit card - something that I can easily measure and get exact dimensions on). If I am starting from a photo then I try to take the photo as orthogonal as possible, but the camera skew makes this really difficult. In practice, most of the scanners I have used have some autoscale involved that throws things by a centimeter, which is why having a scale reference is important. I then open the scan in inkscape, draw a matching scale rectangle based on measured dimensions (e.g. a typical credit card is 85.6mm x 53.98 mm, so I would draw a rectangle that size in inkscape (with no outer line, as that adds thickness, and lower the opacity to say 50%) and then scale the scan so that it matches the size of the scale model. If the part you are tracing is thin enough that you can shut the scanner bed, you should have high contrast between part and background and then the "Path-->Trace Bitmap should work very well. If the part sticks up enough that you can't shut the scanner, I use the Freehand Line tool to trace the outline (50% opacity trick works here also) and then Node Edit to get the points where I need. The newer versions of OpenSCAD can import SVG files, otherwise you need to use DXF. Especially when using DXF, I do Extensions-->Modify Path-->Flatten Beziers with angularity of 0.1 or so (OpenSCAD tends not to like curves in a DXF, so converting a curve to a LOT of small line segments helps). On importing the SVG/DXF into OpenSCAD (leave the file open in Inkscape), I leave the scale model (at least at first). I make a simple square in OpenSCAD that matches the (credit card or whatever) dimensions and make sure that the size still matches and I don't need to scale or resize it (Inkscape recently changed their default DPI and broke Inkscape OpenSCAD export tool I used, and I haven't checked if it has been updated yet, and I have seen both DXF and SVG be drawn in a "wrong" size, so having a second size check saves hair-pulling. -- Sent from: http://forum.openscad.org/
AC
Alan Cox
Wed, Jun 2, 2021 12:19 PM

On Tue, 1 Jun 2021 06:46:03 -0700 (MST)
Terrypin terrypingm@gmail.com wrote:

Thanks Jon, appreciate the fast reply, that’s Reassuring and I’ll try it
shortly.

But I’ve left Inkscape till slightly later because I understand that it can
do the job automatically, i.e without any manual clicking, by using Trace
Bitmap?

Inkscape can generate vector traces from a bitmap. The potrace command
line tool on Linux can do likewise and turn a bitmap into eps.

My own tool chain uses 1200dpi scans, potrace -r 1200 and pstoedit -nc -f
xfig together to generate an xfig file of the trace so it's easy to parse
then just import that as a polygon and centre it.

Alan

On Tue, 1 Jun 2021 06:46:03 -0700 (MST) Terrypin <terrypingm@gmail.com> wrote: > Thanks Jon, appreciate the fast reply, that’s Reassuring and I’ll try it > shortly. > > But I’ve left Inkscape till slightly later because I understand that it can > do the job automatically, i.e without any manual clicking, by using Trace > Bitmap? Inkscape can generate vector traces from a bitmap. The potrace command line tool on Linux can do likewise and turn a bitmap into eps. My own tool chain uses 1200dpi scans, potrace -r 1200 and pstoedit -nc -f xfig together to generate an xfig file of the trace so it's easy to parse then just import that as a polygon and centre it. Alan
T
Terrypin
Wed, Jun 2, 2021 5:34 PM

My thanks to all for the further suggestions. Much to study!

Howver I have made some progress as described a few minutes ago in the QCAD
forum - which now appears focused largely on Inkspace! But I'll now paste
here for convenience:

Starting from my edited profile photo opened in Inkspace...

http://forum.openscad.org/file/t3184/01-ImageOpened.jpg

... I played with various settings of Trace Bitmap...

http://forum.openscad.org/file/t3184/Brightness550.jpg

... and saved it as an SVG

http://forum.openscad.org/file/t3184/InOpenSCAD.jpg

I've posted separately asking how to 'square up' my view.

And I have yet to play with 'scaling', 'upscaling'. etc.

Terry

--
Sent from: http://forum.openscad.org/

My thanks to all for the further suggestions. Much to study! Howver I have made some progress as described a few minutes ago in the QCAD forum - which now appears focused largely on Inkspace! But I'll now paste here for convenience: Starting from my edited profile photo opened in Inkspace... <http://forum.openscad.org/file/t3184/01-ImageOpened.jpg> ... I played with various settings of Trace Bitmap... <http://forum.openscad.org/file/t3184/Brightness550.jpg> ... and saved it as an SVG <http://forum.openscad.org/file/t3184/InOpenSCAD.jpg> I've posted separately asking how to 'square up' my view. And I have yet to play with 'scaling', 'upscaling'. etc. Terry -- Sent from: http://forum.openscad.org/
T
Terrypin
Wed, Jun 2, 2021 5:50 PM

I've uploaded the edited photo here in case anyone else wants to extract a
'better' SVG from it.

https://www.dropbox.com/s/wnbkpxans1kmed6/EditedPhoto.png?dl=0httraw=1
https://www.dropbox.com/s/wnbkpxans1kmed6/EditedPhoto.png?dl=0httraw=1

--
Sent from: http://forum.openscad.org/

I've uploaded the edited photo here in case anyone else wants to extract a 'better' SVG from it. https://www.dropbox.com/s/wnbkpxans1kmed6/EditedPhoto.png?dl=0httraw=1 <https://www.dropbox.com/s/wnbkpxans1kmed6/EditedPhoto.png?dl=0httraw=1> -- Sent from: http://forum.openscad.org/
FH
Father Horton
Wed, Jun 2, 2021 6:53 PM

If you're going to try to print the results with an FDM printer, that
jagged edge is going to drive it nuts.

If you're going to try to print the results with an FDM printer, that jagged edge is going to drive it nuts. > >
T
Terrypin
Wed, Jun 2, 2021 9:47 PM

Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the
depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the
0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings
respectively.

But I agree that perfectly straight lines would be desirable. I have yet to
try drawing those in Inkscape. But I hope that now I have determined the
dimensions more accurately I should be able to proceed exclusively in
OpenSCAD.

--
Sent from: http://forum.openscad.org/

Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the 0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings respectively. But I agree that perfectly straight lines would be desirable. I have yet to try drawing those in Inkscape. But I hope that now I have determined the dimensions more accurately I should be able to proceed exclusively in OpenSCAD. -- Sent from: http://forum.openscad.org/
NH
nop head
Wed, Jun 2, 2021 9:49 PM

You might be able to smooth it by offsetting outwards and inwards by the
same amount.

On Wed, 2 Jun 2021 at 22:47, Terrypin terrypingm@gmail.com wrote:

Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the
depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the
0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings
respectively.

But I agree that perfectly straight lines would be desirable. I have yet
to try drawing those in Inkscape. But I hope that now I have determined the
dimensions more accurately I should be able to proceed exclusively in
OpenSCAD.

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You might be able to smooth it by offsetting outwards and inwards by the same amount. On Wed, 2 Jun 2021 at 22:47, Terrypin <terrypingm@gmail.com> wrote: > Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the > depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the > 0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings > respectively. > > But I agree that perfectly straight lines would be desirable. I have yet > to try drawing those in Inkscape. But I hope that now I have determined the > dimensions more accurately I should be able to proceed exclusively in > OpenSCAD. > ------------------------------ > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> > at Nabble.com. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Ray West
Wed, Jun 2, 2021 10:32 PM

Hi, I'm uncertain as to what you are trying to do. Is it to 3d print, as
near as possible a copy of the original item (the photo of the white
object you posted earlier on?) Or is it to get a 2mm high 'outline ' of
the edge of the object? How accurate has it got to be? If you are trying
to match an existing object, then print two, and replace the original
original, they'll both look the same. If it is to model the orange
outline, 2mm high, then in open scad, a few 'squares', and 'rounded
corner' will do it, more or less (or is 'more or less' not good enough,
or am I completely barking up the wrong tree?)

Best wishes,

Ray

On 02/06/2021 22:47, Terrypin wrote:

Don’t forget the thickness is a only 2 mm. Visually, my rough guess at
the depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower
than the 0.16 or 0.28 resolutions of my Ender 3 V2 at high and low
quality settings respectively.

But I agree that perfectly straight lines would be desirable. I have
yet to try drawing those in Inkscape. But I hope that now I have
determined the dimensions more accurately I should be able to proceed
exclusively in OpenSCAD.

Sent from the OpenSCAD mailing list archive
http://forum.openscad.org/ at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hi, I'm uncertain as to what you are trying to do. Is it to 3d print, as near as possible a copy of the original item (the photo of the white object you posted earlier on?) Or is it to get a 2mm high 'outline ' of the edge of the object? How accurate has it got to be? If you are trying to match an existing object, then print two, and replace the original original, they'll both look the same. If it is to model the orange outline, 2mm high, then in open scad, a few 'squares', and 'rounded corner' will do it, more or less (or is 'more or less' not good enough, or am I completely barking up the wrong tree?) Best wishes, Ray On 02/06/2021 22:47, Terrypin wrote: > Don’t forget the thickness is a only 2 mm. Visually, my rough guess at > the depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower > than the 0.16 or 0.28 resolutions of my Ender 3 V2 at high and low > quality settings respectively. > > But I agree that perfectly straight lines would be desirable. I have > yet to try drawing those in Inkscape. But I hope that now I have > determined the dimensions more accurately I should be able to proceed > exclusively in OpenSCAD. > ------------------------------------------------------------------------ > Sent from the OpenSCAD mailing list archive > <http://forum.openscad.org/> at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
D
dpa
Thu, Jun 3, 2021 1:02 AM

I don't understand how you can discuss this for so long. It is so simple. I
have made an example video https://youtu.be/JSu4j-EgjFc. Of course you
have to set the strokes a little more precisely but it is so easy to draw
something and then extrude it in openscad.

  • draw something in inkscape
  • save it in a folder
  • in same folder make the scad file
  • scad import the svg file and extrude it
  • load/update in OpenSCAD

Am Do., 3. Juni 2021 um 00:33 Uhr schrieb Ray West raywest@raywest.com:

Hi, I'm uncertain as to what you are trying to do. Is it to 3d print, as
near as possible a copy of the original item (the photo of the white object
you posted earlier on?) Or is it to get a 2mm high 'outline ' of the edge
of the object? How accurate has it got to be? If you are trying to match an
existing object, then print two, and replace the original original, they'll
both look the same. If it is to model the orange outline, 2mm high, then in
open scad, a few 'squares', and 'rounded corner' will do it, more or less
(or is 'more or less' not good enough, or am I completely barking up the
wrong tree?)

Best wishes,

Ray
On 02/06/2021 22:47, Terrypin wrote:

Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the
depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the
0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings
respectively.

But I agree that perfectly straight lines would be desirable. I have yet
to try drawing those in Inkscape. But I hope that now I have determined the
dimensions more accurately I should be able to proceed exclusively in
OpenSCAD.

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I don't understand how you can discuss this for so long. It is so simple. I have made an example video <https://youtu.be/JSu4j-EgjFc>. Of course you have to set the strokes a little more precisely but it is so easy to draw something and then extrude it in openscad. - draw something in inkscape - save it in a folder - in same folder make the scad file - scad import the svg file and extrude it - load/update in OpenSCAD Am Do., 3. Juni 2021 um 00:33 Uhr schrieb Ray West <raywest@raywest.com>: > Hi, I'm uncertain as to what you are trying to do. Is it to 3d print, as > near as possible a copy of the original item (the photo of the white object > you posted earlier on?) Or is it to get a 2mm high 'outline ' of the edge > of the object? How accurate has it got to be? If you are trying to match an > existing object, then print two, and replace the original original, they'll > both look the same. If it is to model the orange outline, 2mm high, then in > open scad, a few 'squares', and 'rounded corner' will do it, more or less > (or is 'more or less' not good enough, or am I completely barking up the > wrong tree?) > > Best wishes, > > Ray > On 02/06/2021 22:47, Terrypin wrote: > > Don’t forget the thickness is a only 2 mm. Visually, my rough guess at the > depth of the ‘jagged edge’ would be say 0.01- 0.02 mm. Far lower than the > 0.16 or 0.28 resolutions of my Ender 3 V2 at high and low quality settings > respectively. > > But I agree that perfectly straight lines would be desirable. I have yet > to try drawing those in Inkscape. But I hope that now I have determined the > dimensions more accurately I should be able to proceed exclusively in > OpenSCAD. > ------------------------------ > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> > at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Thu, Jun 3, 2021 1:27 AM

On 6/2/2021 6:02 PM, dpa wrote:

I don't understand how you can discuss this for so long.

The devil is in the details.  Indeed, importing an Inkscape drawing
isn't terribly difficult.

The original request wasn't to draw something in Inkscape and then
extrude it in OpenSCAD... it was to start with a photo and somehow turn
that into an OpenSCAD object.  The most likely process involves bringing
the photo into Inkscape, tracing it there (either with automatic trace
tools or by hand), then carrying that drawing into OpenSCAD.

Then you have to add onto that getting the scale right, which probably
involves matching up features in the scan with Inkscape rulers, and may
involve adding reference features like rulers to the scan.

Then there's questions of whether you need more than one Inkscape
drawing, and whether you want to keep those Inkscape drawings around as
part of the "source" of the model, or if you want a pure-OpenSCAD answer.

And for each of those there are multiple techniques, none of them right
or wrong, just different, each with its own advantages and disadvantages.

On 6/2/2021 6:02 PM, dpa wrote: > I don't understand how you can discuss this for so long. The devil is in the details.  Indeed, importing an Inkscape drawing isn't terribly difficult. The original request wasn't to draw something in Inkscape and then extrude it in OpenSCAD... it was to start with a photo and somehow turn that into an OpenSCAD object.  The most likely process involves bringing the photo into Inkscape, tracing it there (either with automatic trace tools or by hand), then carrying that drawing into OpenSCAD. Then you have to add onto that getting the scale right, which probably involves matching up features in the scan with Inkscape rulers, and may involve adding reference features like rulers to the scan. Then there's questions of whether you need more than one Inkscape drawing, and whether you want to keep those Inkscape drawings around as part of the "source" of the model, or if you want a pure-OpenSCAD answer. And for each of those there are multiple techniques, none of them right or wrong, just different, each with its own advantages and disadvantages.