cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

offset2D on a text produces no output but no warning either

Open MoonCactus opened this issue 2 years ago • 4 comments

I find no way to reduce the weight of a text.

import cadquery

wires2d= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires()
show_object(wires2d, "wires")

offset= wires2d.offset2D(-0.1)
show_object(offset, "offset")

I have no error, but I have no output either ! Is there something wrong or unexpected ?

Nb: I also tried to revert to fillet on the 3D shape of the text (uh), but then I get an explicit error that is is not implemented.

MoonCactus avatar Jun 27 '22 13:06 MoonCactus

You either need wires2d= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires().toPending() or wires2d= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires().vals()

The first one will push the wires in pending mode so you can use Workplane methods with them, the second one will give you a list of Wire objects for which you can call the offset2D method (which isn't the same as the Workplane one)

Jojain avatar Jun 27 '22 16:06 Jojain

Thanks a lot ! I keep on stumbling on little things like these.

Actually I did try wires2d= cq.Workplane().text("TEST", 1, 1).faces("<Z").toPending().wires() Actually I am often trying without really knowing what I am doing, which is a bit frustrating :)

Luckily there are pretty reactive & knowledgeable people like you :+1:

MoonCactus avatar Jun 27 '22 20:06 MoonCactus

Now I get a weird extrusion with this:

import cadquery
txt= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires().toPending().offset2D(-0.03)
show_object(txt.extrude(1.5), "offset")

It looks as if the original shape is still there (the thinned text protrudes from the original thick one)

The following works though, but it gets super verbose (why all these toPending() ?)

from cadquery import *
edges = wires2d= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires().vals()
wires= cq.Workplane('XY').newObject(edges).toPending().wire()
extr = wires.offset2D(-0.03).toPending().extrude(1)
show_object(extr, "whoa")

MoonCactus avatar Jun 27 '22 20:06 MoonCactus

You could try the following.

import cadquery
txt= cq.Workplane().text("TEST", 1, 1).faces("<Z").wires().toPending().offset2D(-0.03)
show_object(txt.extrude(1.5, combine=False), "offset")

jmwright avatar Jun 28 '22 13:06 jmwright