Sketch to walls

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
crobar
Posts: 160
Joined: Fri Aug 29, 2014 1:26 pm

Sketch to walls

Post by crobar »

Hi All,

I am having trouble converting sketch objects to walls, often there are walls missing or strange artefacts. I think the main issues occur when you convert a sketch that has a closed shape, plus extra bits, as in the attached file. When I attempt to convert this to a wall the wall object appears in the doc tree, but nothing appears on screen.

It seems sketches are first converted to a wire, then converted to walls. Perhaps conversion of a sketch to wire in this case does not make sense as the sketch is not be a closed shape?

A temporary workaround for me is to delve into the sketch, and get the underlying line elements like so:

Code: Select all

sketch = App.ActiveDocument.getObjectsByLabel('Sketch')
subobject = sketch.__getitem__(0)
sketchgeom = subobject.Geometry
for item in sketchgeom:
   if isinstance (item, Part.Line):
        shape = item.toShape ()
        Part.show (shape)
and then convert each individual segment to a wall then fuse the result.

However, this has it's own problems.
Attachments
test_sketch_python.fcstd
(3.34 KiB) Downloaded 45 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Sketch to walls

Post by yorik »

Yes, that's indeed the problem. Walls are based on wires, so we need to extract wires from the sketches. Depending on how your sketch is done, this can be impossible or give unwanted results, because the sketcher "decides" alone which edges are part of a certain wire, depending on the constraints.

The best way to work with sketches and wall is either make separate sketches for separate walls, or make sure endpoints of different series of edges you want to group into separate wires don't coincide, btu that's not 100% guaranteed to give expected results either.
crobar
Posts: 160
Joined: Fri Aug 29, 2014 1:26 pm

Re: Sketch to walls

Post by crobar »

yorik wrote:Yes, that's indeed the problem. Walls are based on wires, so we need to extract wires from the sketches. Depending on how your sketch is done, this can be impossible or give unwanted results, because the sketcher "decides" alone which edges are part of a certain wire, depending on the constraints.
I see, thanks, I did have a look to see if there was n 'off-the-shelf' way to make walls from a collection of lined lines, but the closest I found was this which is a bit overkill.
Post Reply