Create Face object using Edges intersections
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Create Face object using Edges intersections
I did not find any method to create such shape, maybe some experimented user could help?
- Attachments
-
- intersection.FCStd
- (10.5 KiB) Downloaded 33 times
Re: Create Face object using Edges intersections
faces require a closed profile, no intersections.
you could create points at those intersections and use Part workbench Builder tool selecting the points.
https://wiki.freecadweb.org/Part_Builder
or use a sketch, use the trim tool to trim the lines. this will automatically create coincidents on the ends of the lines. the close the sketch and use the face tool in Part or Draft.
you could create points at those intersections and use Part workbench Builder tool selecting the points.
https://wiki.freecadweb.org/Part_Builder
or use a sketch, use the trim tool to trim the lines. this will automatically create coincidents on the ends of the lines. the close the sketch and use the face tool in Part or Draft.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: Create Face object using Edges intersections
maybe is there any method to split Draft WB Lines or Sketches WB Lines, I mean break the line(s) in the intersections?
Re: Create Face object using Edges intersections
What do you mean by "break the lines"? drmacro has already described what to do to get a face from this.jtm2020hyo wrote: ↑Fri May 14, 2021 12:27 am maybe is there any method to split Draft WB Lines or Sketches WB Lines, I mean break the line(s) in the intersections?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Create Face object using Edges intersections
hi
with snippet picked in forum Making a Face from makeWire()
Configuration:
_________________________________________________
# if createWire = 0 create face
# if createWire = 1 create Line
# if createWire = 2 create point in intersection
# if createWire = 3 or other create face Line point
_________________________________________________
enjoy
mario
try this macro (ordinate the selections):jtm2020hyo wrote: ↑Fri May 14, 2021 12:27 am maybe is there any method to split Draft WB Lines or Sketches WB Lines, I mean break the line(s) in the intersections?
with snippet picked in forum Making a Face from makeWire()
Configuration:
_________________________________________________
# if createWire = 0 create face
# if createWire = 1 create Line
# if createWire = 2 create point in intersection
# if createWire = 3 or other create face Line point
_________________________________________________
Code: Select all
#Macro_D_Un_Jour_Creer_Une_Face_Entre_Intersection_Lignes.FCMacro
#https://forum.freecadweb.org/viewtopic.php?f=3&t=58619
#14/05/2021
#mario52, Chris_G
import DraftGeomUtils, Draft
sel = FreeCADGui.Selection.getSelection()
####Configuration ###########
#
createWire = 0 # if createWire = 0 create face
# if createWire = 1 create Line
# if createWire = 2 create point in intersection
# if createWire = 3 or other create face Line point
#
####Configuration ###########
try:
if createWire == 0 or createWire > 2:
points = []
verts = []
for i in range(len(sel)):
verts.append(DraftGeomUtils.findIntersection(sel[i-1].Shape.Edges[0],sel[i].Shape.Edges[0]))
points.append([verts[i][0][0], verts[i][0][1], verts[i][0][2]])
#https://forum.freecadweb.org/viewtopic.php?t=31082#p257798
#Making a Face from makeWire()
vecs = [FreeCAD.Vector(t) for t in points] # convert tuples to vectors
vecs.append(vecs[0]) # to close the wire
wire = Part.makePolygon(vecs)
face = Part.Face(wire)
Part.show(face)
App.ActiveDocument.ActiveObject.Label = "ShapeFace"
if createWire == 1 or createWire > 2:
points = []
for i in range(len(sel)):
points.append(DraftGeomUtils.findIntersection(sel[i-1].Shape.Edges[0],sel[i].Shape.Edges[0]))
for i in range(len(points)): # create Line between 2 points
try:
line = Draft.makeLine(points[i][0],points[i+1][0])
except Exception:
line = Draft.makeLine(points[i][0],points[0][0])
Draft.autogroup(line)
if createWire == 2 or createWire > 2:
points = []
for i in range(len(sel)):
points.append(DraftGeomUtils.findIntersection(sel[i-1].Shape.Edges[0],sel[i].Shape.Edges[0]))
point = Draft.makePoint(points[i][0])
Draft.autogroup(point)
except Exception:
print("Error selection or ...")
enjoy
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: Create Face object using Edges intersections
thanks to everyone for the help.
I found the trim command but do this individually was too hard when I try create a experimental custom Stair. the script pubished help a lot, is awesome is possible to modify it to work with Sketcher WB to trim multiple objects?.
... in this point, using manual trim, I found another problem here, the famous Topological naming problem attack again...
is there any method to create edit with multiple trim my Sketcher Object without modify my face objects?
normal:
after edit:
I found the trim command but do this individually was too hard when I try create a experimental custom Stair. the script pubished help a lot, is awesome is possible to modify it to work with Sketcher WB to trim multiple objects?.
... in this point, using manual trim, I found another problem here, the famous Topological naming problem attack again...
is there any method to create edit with multiple trim my Sketcher Object without modify my face objects?
normal:
after edit:
- Attachments
-
- Project-014.FCStd
- (372.27 KiB) Downloaded 31 times
Re: Create Face object using Edges intersections
No. Not in master FreeCAD.jtm2020hyo wrote: ↑Fri May 14, 2021 8:53 pm is there any method to create edit with multiple trim my Sketcher Object without modify my face objects?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: Create Face object using Edges intersections
I think this is a very problematic bug in sketcher, also is related to topological naming problem.
image-1: 1D objects
in image-1 i wish to try cut the extruded solid of the rectangle using sketcher lines like image-2
image-2: Part Design extruction
image-3: result and bug
image-3 show how i did a exploded-slice using object in image-1, but appears just 3 cuts when should be 6.
image-4: analysis
in image-4 we can apprecite that the unique correct cut appears where are 3 vertex, the others 2 errors appears where are 1 vertex attached to 1 line and zero vertex with 1 crossing between 2 lines.
Conclusion: this error does not appears using Draft WB lines, just with SKetcher. To create a Exploded-Slice is need cut our lines to create 1 vertex per line in each intersection in SKetcher, and very sure is a bug and need fix.
EDIT: tested in 0.19 and 0.20
image-1: 1D objects
in image-1 i wish to try cut the extruded solid of the rectangle using sketcher lines like image-2
image-2: Part Design extruction
image-3: result and bug
image-3 show how i did a exploded-slice using object in image-1, but appears just 3 cuts when should be 6.
image-4: analysis
in image-4 we can apprecite that the unique correct cut appears where are 3 vertex, the others 2 errors appears where are 1 vertex attached to 1 line and zero vertex with 1 crossing between 2 lines.
Conclusion: this error does not appears using Draft WB lines, just with SKetcher. To create a Exploded-Slice is need cut our lines to create 1 vertex per line in each intersection in SKetcher, and very sure is a bug and need fix.
EDIT: tested in 0.19 and 0.20
Code: Select all
OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.20.24847 (Git)
Build type: Release
Branch: master
Hash: 20e756306d9aa624fcbf465f0345d721673ce720
Python version: 3.9.2
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.1
Locale: Spanish/Peru (es_PE)
- Attachments
-
- possible-bug-sketcher.FCStd
- (23.78 KiB) Downloaded 24 times
Re: Create Face object using Edges intersections
I don't see anything wrong in Sketcher here. It may be discussed though, if the interpretation of the sketch by the slice command is correct.
Can you add a second object to your model with the working draft based slice?
Can you add a second object to your model with the working draft based slice?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
-
- Posts: 594
- Joined: Wed Aug 12, 2020 1:24 am
Re: Create Face object using Edges intersections
here another test:
in this test, this error appears in Draft WB and Sketcher WB
image-5: I used circles and rectangles with my fixed (right) and unfixed Sketchers/Draft objects (left)
for the fixed Sketcher/Draft objects (right) I just separated each line and vertex and was mentioned in image-4
image 6:
I did extrude + exploded-Slice and the fixed Sketcher WB and Draft WB objects work correctly
edit:
conclusion: this is a general error/bug in FreeCAD, probably appears in all other WB
edit2:
i forget mention that in the image5 and image6 the Sketcher objects are top and Draft objects are bottom
in this test, this error appears in Draft WB and Sketcher WB
image-5: I used circles and rectangles with my fixed (right) and unfixed Sketchers/Draft objects (left)
for the fixed Sketcher/Draft objects (right) I just separated each line and vertex and was mentioned in image-4
image 6:
I did extrude + exploded-Slice and the fixed Sketcher WB and Draft WB objects work correctly
edit:
conclusion: this is a general error/bug in FreeCAD, probably appears in all other WB
edit2:
i forget mention that in the image5 and image6 the Sketcher objects are top and Draft objects are bottom
Code: Select all
OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 0.20.24847 (Git)
Build type: Release
Branch: master
Hash: 20e756306d9aa624fcbf465f0345d721673ce720
Python version: 3.9.2
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.1
Locale: Spanish/Peru (es_PE)
- Attachments
-
- possible-bug-sketcher1.FCStd
- (89.28 KiB) Downloaded 23 times