View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002777 | PartDesign | Bug | public | 2016-11-18 14:24 | 2020-07-16 02:56 |
| Reporter | huskier | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Platform | Windows | OS | Windows | OS Version | 10 |
| Product Version | 0.15 | ||||
| Summary | 0002777: Part.Wire two individual edges (wires) | ||||
| Description | When I execute the following code in FreeCAD's python console >>> from FreeCAD import Base >>> e1 = Part.makeCircle(1.6, Base.Vector(-23.5,0,0), Base.Vector(0,0,1)) >>> e2 = Part.makeCircle(1.6, Base.Vector(23.5,0,0), Base.Vector(0,0,1)) >>> ws = Part.Wire([e1,e2]) The system gives error as following: Traceback (most recent call last): File "<input>", line 1, in <module> Part.OCCError: BRep_API: command not done | ||||
| Steps To Reproduce | Just following the description's code. | ||||
| Tags | No tags attached. | ||||
| FreeCAD Information | |||||
|
|
e1 and e2 are not connected. what result were you expecting? |
|
|
Thanks @wandererfan. I expect that e1 and e2 are combined into a wire group or a whole wire with two individual wires. For the next step, I want to extrude ws. >>> ws = Part.Wire([e1,e2]) |
|
|
A wire group or a wire containing two wires isn't possible and doesn't make any sense. According to OpenCascade a wire is defined as either a set of connected edges or a single edge. If you want to have a group of wires you must use a compound: ws = Part.Compound([Part.Wire(e1.Edges), Part.Wire(e2.Edges)]) |
|
|
Thanks @wmayer. Suppose that there are a list of edges, and the edges could form several independent connected edges, but we do not know which edges form which connected edges. In this case, how do we get a group of wires? In a simple way, how do we determine that which edges could form a closed wires? |
|
|
<<In a simple way, how do we determine that which edges could form a closed wires?>> This is a hard problem. In version 0.15, there is no easy solution. TopoShapeCompound has a connectEdgesToWires() method that tries to connect edges into the longest possible wires, but if you are looking for closed regions, you may not be happy with the results. In v0.17 there is TechDraw.edgeWalker which looks for closed wires in a pile of edges which may be closer to what you are looking for. |
|
|
ws = ... # is a compound of a list of edges comp_wires = ws.connectEdgesToWires() # returns a new compound with a list of wires comp_wires.Wires # check each wire in this list if it's closed |
|
|
Thanks, @wandererfan. Both connectEdgesToWires() and TechDraw.edgeWalker are useful for me, and I would try them first. |
|
|
@wmayer For the following code, three independent wires are expected after "connectEdgesToWires operation". However, comp_wires.Wires command returns ten wires. [<Wire object at 0ED1DE98>, <Wire object at 0ED1E0B8>, <Wire object at 0ED1DF78>, <Wire object at 0ED1DEF8>, <Wire object at 0ED1DF18>, <Wire object at 0ED1DE78>, <Wire object at 0ED1DDB8>, <Wire object at 0ED1E0D8>, <Wire object at 0ED1DF38>, <Wire object at 0ED1E0F8>] Is this OK with the "connectEdgesToWires" function? "connectEdgesToWires() method that tries to connect edges into the longest possible wires" ****************************The Code*************************************** from FreeCAD import Base e1 = Part.makeCircle(1.6, Base.Vector(-23.5,0,0), Base.Vector(0,0,1)) e2 = Part.makeCircle(1.6, Base.Vector(23.5,0,0), Base.Vector(0,0,1)) e3 = Part.Arc(Base.Vector(-17.038896,-5.7,0),Base.Vector(-19.44306,-4.70416,0),Base.Vector(-20.438896,-2.3,0)) e3 = e3.toShape() e4 = Part.makeLine(Base.Vector(-20.438896,-2.3,0),Base.Vector(-21.25,2.3,0)) e5 = Part.Arc(Base.Vector(-21.25,2.3,0),Base.Vector(-20.25416,4.70416,0),Base.Vector(-17.85,5.7,0)) e5 = e5.toShape() e6 = Part.makeLine(Base.Vector(-17.85,5.7,0),Base.Vector(17.85,5.7,0)) e7 = Part.Arc(Base.Vector(17.85,5.7,0),Base.Vector(20.25416,4.70416,0),Base.Vector(21.25,2.3,0)) e7 = e7.toShape() e8 = Part.makeLine(Base.Vector(21.25,2.3,0),Base.Vector(20.438896,-2.3,0)) e9 = Part.Arc(Base.Vector(20.438896,-2.3,0),Base.Vector(19.44306,-4.70416,0),Base.Vector(17.038896,-5.7,0)) e9 = e9.toShape() e10 = Part.makeLine(Base.Vector(17.038896,-5.7,0),Base.Vector(-17.038896,-5.7,0)) ws = Part.Compound([e1, e2, e3, e4, e5, e6, e7, e8, e9, e10]) comp_wires = ws.connectEdgesToWires() *********************************The Code******************************** |
|
|
Here is the documentation of the corresponding OCC function:
So, since the shapes are created separately they don't share any vertexes and thus this function won't connect them. So, you have to use the function as: |
|
|
Thank you very much,@wmayer and @wandererfan.You are the best! My problem solved! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2016-11-18 14:24 | huskier | New Issue | |
| 2016-11-19 13:07 | wandererfan | Note Added: 0007466 | |
| 2016-11-19 13:08 | wandererfan | Status | new => feedback |
| 2016-11-19 14:28 | huskier | Note Added: 0007467 | |
| 2016-11-19 14:28 | huskier | Status | feedback => new |
| 2016-11-19 14:54 | wmayer | Note Added: 0007469 | |
| 2016-11-19 14:54 | wmayer | Status | new => feedback |
| 2016-11-19 15:17 | huskier | Note Added: 0007470 | |
| 2016-11-19 15:17 | huskier | Status | feedback => new |
| 2016-11-19 15:18 | huskier | Note Edited: 0007467 | |
| 2016-11-19 15:21 | huskier | Note Edited: 0007470 | |
| 2016-11-19 15:22 | huskier | Note Edited: 0007470 | |
| 2016-11-19 15:44 | wandererfan | Note Added: 0007471 | |
| 2016-11-19 15:45 | wmayer | Note Added: 0007472 | |
| 2016-11-19 15:57 | huskier | Note Added: 0007473 | |
| 2016-11-19 16:47 | huskier | Note Added: 0007474 | |
| 2016-11-19 16:49 | huskier | Note Edited: 0007474 | |
| 2016-11-19 16:49 | huskier | Note Edited: 0007474 | |
| 2016-11-19 16:51 | huskier | Note Edited: 0007474 | |
| 2016-11-19 16:59 | wmayer | Note Added: 0007475 | |
| 2016-11-19 17:10 | huskier | Note Added: 0007476 | |
| 2016-11-19 17:29 | wmayer | Status | new => closed |
| 2016-11-19 17:29 | wmayer | Resolution | open => no change required |
FreeCAD