Manual B-Spline 'Text' as Hollow Numbers

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Lukeyson
Posts: 9
Joined: Thu May 20, 2021 9:36 am

Manual B-Spline 'Text' as Hollow Numbers

Post by Lukeyson »

I am quite new to Freecad and struggling with a particular project.

I currently have some stainless steel numbers near my letterbox - 1 and 6 - each about 20cm in height. I would like to create a clear hollow 'box' under each letter in the shape of each letter, 20mm high, install a 12V led strip, and re-attach the numbers on top of this. Effectively an 'illuminated stand-off'. This is therefore a 3D print project using clear PETG.

I have taken an accurate photo of each number, and in FreeCad traced an outline of each number using unconstrained b-splines. A quick print of a 1mm pad of each confirms I have my size and shape just about right.

From there I thought it would be a simple matter of extruding or padding and using the thickness tool to hollow out each letter - but with an 'inward' or negative thickness since I need the letter to be the outline. Indeed the 1 works perfectly fine. But the 6 I cannot get to work - even if I remove the 'hole' in the middle of the 6, I can't get the padded/extruded 6 to create a thickness at all. Ideally I'd prefer the 'hole' in the six if I could.

Is there any other approach I could or should use to create the custom numbers 1 and 6 as hollow open-bottom boxes for my project? (I am running build 24894)


Luke Plaizier
Attachments
Illuminated Letterbox Numbers v0.1.FCStd
(107.49 KiB) Downloaded 25 times
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by chrisb »

Thickness frequently fails if B-splines are involved. You can try to work with Part->2DOffset with filling the gap.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by chrisb »

Thickness works if I replace th B-Splines by a tesselation made from arcs.
Are you sure that the inner part of the 6 shouldn't be just a circle?
Attachments
Letterbox_cb.FCStd
(91.06 KiB) Downloaded 23 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Lukeyson
Posts: 9
Joined: Thu May 20, 2021 9:36 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by Lukeyson »

Perfect! Thankyou.

The 2D offset is somewhat more manual, but at least it gives me an option to create one slightly smaller and cut it out. Yet another tool learned!

The inner hole in the 6 might be a circle if I'm lucky, but the whole letter itself does not conform to any known font and to me seems like it has been made skewed in some areas, so if it is indeed a circle I might need to buy a lottery ticket.




Thankyou for your help.
Last edited by Lukeyson on Thu May 20, 2021 11:34 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by chrisb »

This is the macro I used for the tesselation. I downgraded the "6" which yielded several wires. With the macro I created one sketch for each. Finally I merged the sketches into one and used the sketch validation tool to connect the remaining open vertices.

Code: Select all

# Use cleanedges formerly in PathUtils for the approxiamtion
''' Approxamation of wires containing bezier curves by arcs '''

import FreeCAD
from DraftGeomUtils import geomType
import Draft

def cleanedges(splines, precision):
    '''cleanedges([splines],precision). Convert BSpline curves, Beziers, to arcs that can be used for cnc paths.
    Returns Lines as is. Filters Circle and Arcs for over 180 degrees. Discretizes Ellipses. Ignores other geometry. '''
    edges = []
    for spline in splines:
        if geomType(spline) == "BSplineCurve":
            arcs = spline.Curve.toBiArcs(precision)
            for i in arcs:
                edges.append(Part.Edge(i))

        elif geomType(spline) == "BezierCurve":
            newspline = spline.Curve.toBSpline()
            arcs = newspline.toBiArcs(precision)
            for i in arcs:
                edges.append(Part.Edge(i))

        elif geomType(spline) == "Ellipse":
            edges = curvetowire(spline, 1.0)  # fixme hardcoded value

        elif geomType(spline) == "Circle":
            # arcs = PathUtils.filterArcs(spline)
            # for i in arcs:
            #     edges.append(Part.Edge(i))
            edges.append(spline)

        elif geomType(spline) == "Line":
            edges.append(spline)

        elif geomType(spline) == "LineSegment":
            edges.append(spline)

        else:
            pass

    return edges

def shape2Sketch(shape):
  # replace shape.edges with arcs
  global test
  newEdges = cleanedges(shape.Edges,0.2)
  wire = Part.Wire([Part.Edge(i) for i in newEdges])
  sketch = Draft.makeSketch(wire,autoconstraints=True,delete=True)
  
selection = FreeCADGui.Selection.getSelectionEx()
for s in selection:
  shape2Sketch(s.Object.Shape)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by jmaustpc »

Another related tip, may not help in this exact case but is related...

In the Draft WB there is a tool "Shape from Text" which will create a shape from text defined by the font you then select. This toll is compatible with PartDesign WB so it can be used within a Body as a feature. It can also be used in Part WB etc.

It is a really useful tool particularly if you know which font to select or if you can find one similar enough. Being fully parametric, you can simply select a different font and compare the difference etc.

Not all fonts will be compatible, since they have to be of a type where a face can be defined from them.

I am not saying that you need to use it in this case but I thought I would mention it since it is relevant to this sort of project in a general sense. :)

Jim

Here is a screen shot of the tool in the menu in FreeCAD 0.19.
Screenshot_20210521_091450.png
Screenshot_20210521_091450.png (75.49 KiB) Viewed 1493 times
Lukeyson
Posts: 9
Joined: Thu May 20, 2021 9:36 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by Lukeyson »

I wish it did match a font. I tried to do that first using places like whatthefont or whatfontis. i've worked with text in objects before. The 1 comes very close to a match, and the bottom part of the six kind of matches some known fonts, but the upper part of the six appears to have been manually modified by whoever manufactured it.


Luke
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by jmaustpc »

I was reading your topic thinking what a good idea, I should to do something like that. It is hard to spot my driveway at night, particularly if a car is coming the other way so you have to dip your lights, that doesn't happy very often out here though. Not much traffic in the bush. But even with the lights on high beam, on a dark night at 100km/hr, some random spot in the middle of nowhere about half an hour out of town, it is easy to miss the driveway, on a couple of occasions I almost did miss it. :)

Are you intending to power it with a solar panel? I am assuming that the number is on your mail box at the road side, but perhaps you are in a city and the number might be on your house where you can connect it to the power from your house? My number is on my mail box that is at the road side at the end of my driveway only about 200m from the house. My cousin's mail box also down his driveway at the road side as well but that is 5km from his house. I suppose Outback Australia is on a different scale to where some of you live. It's common around here for parents to let their children drive a car down their driveway to catch the school bus. Might sound odd but if you do the maths and see how much time and fuel you use per week just taking your kids to the school bus, it can add up. As a parent, you have to do the round trip twice a day so at first you think it's only 5km but times 4 that is 20km or 100km per week, if the kid drives themselves you halve the distance since they just leave the car all day in the paddock at the end of their driveway. Save a lot of time and and fuel over a year or so. Anyway I am drifting way off topic. :)

Jim
User avatar
Roy_043
Veteran
Posts: 8455
Joined: Thu Dec 27, 2018 12:28 pm

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by Roy_043 »

chrisb wrote: Thu May 20, 2021 11:14 pm This is the macro
Is that available in the wiki?
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Manual B-Spline 'Text' as Hollow Numbers

Post by chrisb »

Roy_043 wrote: Fri May 21, 2021 7:33 am
chrisb wrote: Thu May 20, 2021 11:14 pm This is the macro
Is that available in the wiki?
No not yet. What do I have to do to integrate it there?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply