Part.Wire misses some Edges

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
bernd
Posts: 9853
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Part.Wire misses some Edges

Postby bernd » Fri May 19, 2017 5:07 am

I would like to make ONE Wire out of ALL Edges from the Screen and file attached. For some reason some Edges are missing (pink in the second screen is the wire). What I did:

Code: Select all

Part.show(Part.Wire(App.ActiveDocument.Compound.Shape.Edges))
Does someone has an idea how to make an wire out of the edges with OCCT >= 6.9 or how to trackle down the problem of the missing Edges.

BTW: Is it called non-manifold wire or is this term only used on faces and shells?
nonmanifold_wire.fcstd
(46.99 KiB) Downloaded 17 times
screen.jpg
screen.jpg (70.27 KiB) Viewed 979 times
screen1.jpg
screen1.jpg (97.18 KiB) Viewed 979 times
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Part.Wire misses some Edges

Postby microelly2 » Fri May 19, 2017 6:07 am

What happens when you first order the edges so that consecutive ones have common endpoints?
It will happen that you need to add some edges more than once because your figures is not a euler graph.
chrisb
Posts: 24392
Joined: Tue Mar 17, 2015 9:14 am

Re: Part.Wire misses some Edges

Postby chrisb » Fri May 19, 2017 6:16 am

Which FreeCAD version do you use?
chrisb
Posts: 24392
Joined: Tue Mar 17, 2015 9:14 am

Re: Part.Wire misses some Edges

Postby chrisb » Fri May 19, 2017 6:36 am

(Seems to independent from the current FreeCAD versions.)
microcelly2 is right: If you select arbitrary paths through your network without having more than 2 lines at one vertex, the upgrade tool creates a path wire. If I connect several of these wires I get a block.

Edit in blue
Last edited by chrisb on Fri May 19, 2017 3:55 pm, edited 1 time in total.
User avatar
tanderson69
Posts: 1531
Joined: Thu Feb 18, 2010 1:07 am

Re: Part.Wire misses some Edges

Postby tanderson69 » Fri May 19, 2017 1:19 pm

bernd wrote:I would like to make ONE Wire out of ALL Edges from the Screen and file attached.
What are your plans for this wire?

I can't speak for freecads python api, but you won't find much algorithmic support in occt for such a wire.
User avatar
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Part.Wire misses some Edges

Postby DeepSOIC » Fri May 19, 2017 5:22 pm

nonmanifold_wire_DeepSOIC.fcstd
(49.17 KiB) Downloaded 15 times
How to:
1. BooleanFragments
2. w = Part.Wire(booleanfragments.Shape.Edges)
3. for e in booleanfragments.Shape.Edges: w.add(e)

After step 2, I got a wire with some edges missing. Re-adding them to the wire seems to have worked.
User avatar
bernd
Posts: 9853
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Part.Wire misses some Edges

Postby bernd » Fri May 19, 2017 5:42 pm

tanderson69 wrote:
bernd wrote:I would like to make ONE Wire out of ALL Edges from the Screen and file attached.
What are your plans for this wire?
If all Edges are connecte a Edgemesh generated with GMSH has connected Edges and is appropriate for an FEM calculation. It is like the CompSolids but just not in 3D (Solids vs CompSolids) but 1D instead (Edges vs. Wire). Same with Face and Shell you may remember we had a looooong discussion about the Shell some time ago before the BooleanFragments where available in FreeCAD.

@DeepSonic :D :mrgreen: works great here too!

BTW: with OCCT < 6.9 this could be made with a Fusion, good too know with OCCT >= 6.9 it could be made with the BooleanFragments :-)
nonmanifold_wire_DeepSOIC_FEM.fcstd
(107.78 KiB) Downloaded 19 times
screen.jpg
screen.jpg (181 KiB) Viewed 914 times
User avatar
tanderson69
Posts: 1531
Joined: Thu Feb 18, 2010 1:07 am

Re: Part.Wire misses some Edges

Postby tanderson69 » Fri May 19, 2017 7:05 pm

Curious, what does gmsh do with a compound of 'connected' edges?
User avatar
bernd
Posts: 9853
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Part.Wire misses some Edges

Postby bernd » Sun May 21, 2017 7:18 pm

tanderson69 wrote:Curious, what does gmsh do with a compound of 'connected' edges?
Same what GMSH meshes if you pass a Compound of "connected" Solids instead of one CompSolid or if you pass a Compound of "connected" Faces instead of one Shell or a Compound of "connected" Edges instead of one Wire. GMSH will mesh them in one big mesh but will not connect them means for the connected Edges in the mesh there will be at a vertex where 3 Edges meat there will be three nodes. Each Edge will have his own node, thus the Edges are not connected. If you pass one wire GMSH will make one Vertex at the point where the three edges are connected. GMSH just meshes what it gets. Means you need to pass the wire as brep.

bernd
User avatar
bernd
Posts: 9853
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Part.Wire misses some Edges

Postby bernd » Tue May 23, 2017 8:47 pm

DeepSOIC wrote: How to:
1. BooleanFragments
2. w = Part.Wire(booleanfragments.Shape.Edges)
3. for e in booleanfragments.Shape.Edges: w.add(e)
.
All in Python. Load nonmanifold_wire.fcstd from first topic post

Code: Select all

import BOPTools.SplitFeatures
import Part
j = BOPTools.SplitFeatures.makeBooleanFragments(name='BooleanFragments')
j.Objects = App.ActiveDocument.Compound
j.Proxy.execute(j)
j.purgeTouched()
for obj in j.ViewObject.Proxy.claimChildren():
    obj.ViewObject.hide()

w = Part.Wire(j.Shape.Edges)
for e in j.Shape.Edges:
    w.add(e)

j.ViewObject.hide()
Part.show(w)