View Issue Details

IDProjectCategoryView StatusLast Update
0002542PartBugpublic2017-05-10 19:57
Reportersliptonic Assigned Tosliptonic  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version0.17 
Target Version0.17 
Summary0002542: Part.Wire.makeoffset() doesn't handle circles correctly.
DescriptionIf I have a wire from an irregular shape and perform a Part.Wire.makeoffset(-1), it returns a shape object with a list of wires and list of edges.

However, if I start with a wire from a circular face, the offset returns a list of edges but the wire list is empty. I can use DraftGeomUtils.findwire() to join them, but my expectation is that makeoffset would act consistently in both cases.

 
Steps To ReproduceAttached screenshot shows what I mean, reproduced in the console.
Additional InformationOS: Linux Mint 17.3 Rosa
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7514 +17 (Git)
Build type: Unknown
Branch: pathimprove
Hash: f20a1ed9055f09880b26e00fa841b062bf679c7d
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
TagsPart
FreeCAD Information

Relationships

related to 0002541 closed FreeCAD Part.Wire.makeoffset() doesn't offset single edge. 

Activities

sliptonic

2016-05-10 22:29

manager  

Selection_029.png (Attachment missing)

wmayer

2016-05-11 08:45

administrator   ~0007078

When trying to offset a wire from a circle or circular face the result is again a wire. Maybe it's related to your model that it doesn't work. Would it be possible to upload a model where it fails?

sliptonic

2016-05-11 12:38

manager  

circleoffsettest.FCMacro (Attachment missing)

sliptonic

2016-05-11 12:39

manager  

offsettest.fcstd (Attachment missing)

sliptonic

2016-05-11 12:43

manager  

Selection_030.png (Attachment missing)

sliptonic

2016-05-11 12:48

manager  

circleoffsettest2.fcmacro (Attachment missing)

sliptonic

2016-05-11 12:52

manager   ~0007080

I've uploaded a simple model and a screenshot of a run using the macro circleoffsettest2. (Please ignore circleoffsettest. It's bad and I can't figure out how to delete a file from mantis)

The results first show selection of the top face, then the flat circular face. You can see that the wire list is empty in the second.

It's also worth noting that if I select either of the cylindrical faces and run the offset test, FreeCAD crashes with a segmentation violation.

sliptonic

2016-05-11 13:25

manager   ~0007081

Last edited: 2016-05-11 13:26

Some more weirdness:
I rewrote my test macro like below. If I offset the top face, the new edge length is the same as the old edge length as though it doesn't offset at all. If I set the offset value to a negative number, then it offsets inward and the new length is shorter as expected. But using the negative offset value on the circular face, it offsets outward and the new edge gets longer. Summarized resullts are:

                Circle | Irregular
         =========== | ==============
-1 | offset outward | offset inward
1 | offset inward | unchanged


import DraftGeomUtils as DGU
o = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
print "original edge len " + str(o.Edges[0].Length)
for i in range (0,10):
    n = o.makeOffset(1) #change to negative value
    print n
    print n.Wires
    print n.Edges
    print "newedge len: " + str(o.Edges[0].Length)
    o = DGU.findWires(n.Edges)[0]

wmayer

2016-05-11 21:11

administrator   ~0007083

I think the crash happens because the face is not planar. The class documentation of BRepOffsetAPI_MakeOffset it says:
//! Describes algorithms for offsetting wires from a set of
//! wires contained in a planar face.

So it should be checked if the face/wire is planar and raise an error if needed.

Kunda1

2017-01-11 18:14

administrator   ~0007638

@sliptonic per wmayer
> So it should be checked if the face/wire is planar and raise an error if needed.

sliptonic

2017-03-02 19:05

manager   ~0008521

I'm looking for a way to test from Python if a face is planar. I haven't found anything yet.

Kunda1

2017-03-21 12:44

administrator   ~0008677

Last edited: 2017-03-21 12:44

> I'm looking for a way to test from Python if a face is planar. I haven't found anything yet.

@DeepSOIC would you mind weighing in on this?

DeepSOIC

2017-03-21 17:54

developer   ~0008682

@sliptonic
type(face.Surface) is Part.Plane

Kunda1

2017-05-02 13:29

administrator   ~0008853

Yikes this ticket didn't save the attachments after the backup. @sliptonic is that going to be a problem?

sliptonic

2017-05-02 13:54

manager   ~0008854

The issue is a year old. I don't have the files anymore and I can't even remember the context. Let's close this.

sliptonic

2017-05-02 13:55

manager   ~0008855

Context is no longer relevant and work-around is possible.

Related Changesets

FreeCAD: master c21888af

2016-05-12 19:03:23

wmayer

Details Diff
+ issue 0002542: Part.Wire.makeoffset() doesn't handle circles correctly. Affected Issues
0002542
mod - src/Mod/Part/App/TopoShapeFacePyImp.cpp Diff File
mod - src/Mod/Part/App/TopoShapeWirePyImp.cpp Diff File

Issue History

Date Modified Username Field Change
2016-05-10 22:29 sliptonic New Issue
2016-05-10 22:29 sliptonic File Added: Selection_029.png
2016-05-11 08:45 wmayer Note Added: 0007078
2016-05-11 12:38 sliptonic File Added: circleoffsettest.FCMacro
2016-05-11 12:39 sliptonic File Added: offsettest.fcstd
2016-05-11 12:43 sliptonic File Added: Selection_030.png
2016-05-11 12:48 sliptonic File Added: circleoffsettest2.fcmacro
2016-05-11 12:52 sliptonic Note Added: 0007080
2016-05-11 13:25 sliptonic Note Added: 0007081
2016-05-11 13:26 sliptonic Note Edited: 0007081
2016-05-11 13:26 sliptonic Note Edited: 0007081
2016-05-11 21:11 wmayer Note Added: 0007083
2016-05-12 17:03 wmayer Changeset attached => FreeCAD Master master c21888af
2017-01-11 18:14 Kunda1 Note Added: 0007638
2017-01-11 18:14 Kunda1 Status new => feedback
2017-01-18 01:06 Kunda1 Relationship added related to 0002541
2017-03-02 19:05 sliptonic Note Added: 0008521
2017-03-02 19:05 sliptonic Status feedback => new
2017-03-21 12:44 Kunda1 Note Added: 0008677
2017-03-21 12:44 Kunda1 Note Edited: 0008677
2017-03-21 12:45 Kunda1 Product Version => 0.17
2017-03-21 12:45 Kunda1 Target Version => 0.17
2017-03-21 17:54 DeepSOIC Note Added: 0008682
2017-03-21 18:11 Kunda1 Assigned To => sliptonic
2017-03-21 18:11 Kunda1 Status new => feedback
2017-05-02 13:26 Kunda1 Tag Attached: Part
2017-05-02 13:29 Kunda1 Note Added: 0008853
2017-05-02 13:54 sliptonic Note Added: 0008854
2017-05-02 13:55 sliptonic Status feedback => closed
2017-05-02 13:55 sliptonic Resolution open => no change required
2017-05-02 13:55 sliptonic Note Added: 0008855
2017-05-10 19:57 Kunda1 Project FreeCAD => Part