Connect two face and fill empty espace

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

paullee wrote: Mon Oct 18, 2021 5:19 pm You are welcome. In fact, I want to make a remark in last post but it turn out disappeared - ' it works in most cases but sometime it does not work as ideal". That's some cases I want to attack when there is more time later, or someone more capable can resolve it ? Good luck :)

p.s. The test you did somehow tell you how the ArchWall underlying algorithm works, and fails :lol:
I will work on it and tell you more in the future, but I don't think that I am capable than you :D
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

paullee wrote: Thu Oct 14, 2021 5:08 pm Not a direct answer to problem :

ArchWall build wall base on wire. It use DraftGeomUtils.offsetWire to offset each segment of wire, and connect each offset segment to form the baseplate, similar to effect you are looking for.

Check getExtrusionData(self,obj) in https://github.com/FreeCAD/FreeCAD/blob ... rchWall.py
many Thanks to your attention to use offsetWire. but it seems it has some bug! for example:

Code: Select all

import Part
import DraftGeomUtils

def get_left_right_offset_wire_and_shape(wire, left_width, right_width):
	normal = FreeCAD.Vector(0, 0, 1)
	dvec = DraftGeomUtils.vec(wire.Edges[0]).cross(normal)
	dvec.normalize()
	dvec.multiply(right_width)
	right_wire = DraftGeomUtils.offsetWire(wire,dvec)
	# right_wire = remove_null_edges_from_wire(right_wire)
	dvec = DraftGeomUtils.vec(wire.Edges[0]).cross(normal)
	dvec.normalize()
	dvec = dvec.negative()
	dvec.multiply(left_width)
	left_wire = DraftGeomUtils.offsetWire(wire,dvec)
	# left_wire = remove_null_edges_from_wire(left_wire)
	shape = DraftGeomUtils.bind(left_wire, right_wire)
	return shape, left_wire, right_wire


xyz = [(-2833.707275390625, 1849.1832275390625, 0.0), (0.0, 1600.0, -2400.0), (4740.0, 1600.0, -2400.0), (7640.0, 1600.0, -2400.0), (13180.0, 1600.0, -2400.0), (20930.0, 1600.0, -2400.0), (28500.0, 1600.0, -2400.0), (31550.0, 1600.0, -2400.0), (35510.0, 1600.0, -2400.0), (42239.84765625, 1604.4844970703125, 0.0)]
edges = []
for p1, p2 in zip(xyz[:-1], xyz[1:]):
    p1 = App.Vector(p1)
    p2 = App.Vector(p2)
    e = Part.makeLine(p1, p2)
    edges.append(e)
wire = Part.Wire(edges)
sh, lw, rw = get_left_right_offset_wire_and_shape(wire, 500, 500)
run this code, the main wire has 9 Edges, while both left and right wire has 10 edges and bind method can't bind them.
offsetWire.png
offsetWire.png (21.83 KiB) Viewed 3503 times

Code: Select all

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Connect two face and fill empty espace

Post by paullee »

ebrahim raeyat wrote: Wed Dec 01, 2021 12:49 pm

Code: Select all

xyz = [(-2833.707275390625, 1849.1832275390625, 0.0), (0.0, 1600.0, -2400.0), (4740.0, 1600.0, -2400.0), (7640.0, 1600.0, -2400.0), (13180.0, 1600.0, -2400.0), (20930.0, 1600.0, -2400.0), (28500.0, 1600.0, -2400.0), (31550.0, 1600.0, -2400.0), (35510.0, 1600.0, -2400.0), (42239.84765625, 1604.4844970703125, 0.0)]

Code seems right, seem no clue where is the problem and would suggest you try the latest 0.20_pre code, but...

.. seem you have in the xyz list, the 1st and last point z-coordinate at 0.0, while others at -2400.0.



Haven't tried but thought the code only work on co-planar wire :)

Try make the 2 points z-coordinate at -2400 first...
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

paullee wrote: Wed Dec 01, 2021 6:15 pm
ebrahim raeyat wrote: Wed Dec 01, 2021 12:49 pm

Code: Select all

xyz = [(-2833.707275390625, 1849.1832275390625, 0.0), (0.0, 1600.0, -2400.0), (4740.0, 1600.0, -2400.0), (7640.0, 1600.0, -2400.0), (13180.0, 1600.0, -2400.0), (20930.0, 1600.0, -2400.0), (28500.0, 1600.0, -2400.0), (31550.0, 1600.0, -2400.0), (35510.0, 1600.0, -2400.0), (42239.84765625, 1604.4844970703125, 0.0)]

Code seems right, seem no clue where is the problem and would suggest you try the latest 0.20_pre code, but...

.. seem you have in the xyz list, the 1st and last point z-coordinate at 0.0, while others at -2400.0.



Haven't tried but thought the code only work on co-planar wire :)

Try make the 2 points z-coordinate at -2400 first...
Oh, yes, that's right. All lines imported from another model data and only first and last lines that I added , had z = 0. The problem is that I must change the working plane offset:

Code: Select all

FreeCAD.DraftWorkingPlane.alignToPointAndAxis(FreeCAD.Vector(0.0, 0.0, 0.0), FreeCAD.Vector(0, 0, 1), -2400.0)
thank you so much paullee
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

Hi @paullee. finally I finished my task for creating foundation. the concept is:

1- user draw some line (beam) with start and end points
beams.png
beams.png (6.3 KiB) Viewed 3263 times
2- user can create automatically the continuous base shape of foundation. I categorize this in x and y direction with red and blue color (say it wall)
base.png
base.png (21.73 KiB) Viewed 3263 times

3- creating foundation shape: user can choose which base foundation must be continuous and which must be cut:
foundation.png
foundation.png (19.41 KiB) Viewed 3263 times
x_continuous.png
x_continuous.png (20.01 KiB) Viewed 3263 times
y_cut.png
y_cut.png (20.12 KiB) Viewed 3263 times
User avatar
ragohix769
Posts: 565
Joined: Sat Jul 18, 2020 7:04 am
Location: Rome - Italy

Re: Connect two face and fill empty espace

Post by ragohix769 »

Impressive Ebrahim!

If this works it's a dream that come true. Thanks a lot for sharing this idea!
After #ElonMuskBuyTwitter I'm no more on Twitter, that's really enough :-(
=> Now you can find me here on #Mastodon: https://mastodon.uno/@opensoul - I hope more people do the same :-)
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

ragohix769 wrote: Sun Dec 05, 2021 10:26 am Impressive Ebrahim!

If this works it's a dream that come true. Thanks a lot for sharing this idea!
Thanks a lot. This is main function to create foundation shape:

https://github.com/ebrahimraeyat/Civil/ ... cs.py#L590

This function is for finding continuous edges respect to angle between them:

https://github.com/ebrahimraeyat/Civil/ ... cs.py#L962
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Connect two face and fill empty espace

Post by paullee »

ebrahim raeyat wrote: Sun Dec 05, 2021 4:26 am Hi @paullee. finally I finished my task for creating foundation. the concept is:

3- creating foundation shape: user can choose which base foundation must be continuous and which must be cut:
Congratulation! :D

If you try with the ArchWall tool, just set the Height as the 'thickness' of the beam, it is basically the same thing right?


Try select the Wires (or Sketches?) and click Arch Wall.


Just curious about 2 things without examining your codes (too advanced for me):-
  1. Are the outermost wires on left, top, and right separate or continuous in your example? If they are separate, how do the code know they should be connected?
  2. The Arch Wall tool has Align and Offset attribute to tell how the Wall should be created relative to the underlying Base edges (like 'wall axis'). Seem your code do the same thing?
Thanks !
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Connect two face and fill empty espace

Post by ebrahim raeyat »

paullee wrote: Mon Dec 06, 2021 6:06 pm
If you try with the ArchWall tool, just set the Height as the 'thickness' of the beam, it is basically the same thing right?


Try select the Wires (or Sketches?) and click Arch Wall.


Just curious about 2 things without examining your codes (too advanced for me):-
  1. Are the outermost wires on left, top, and right separate or continuous in your example? If they are separate, how do the code know they should be connected?
  2. The Arch Wall tool has Align and Offset attribute to tell how the Wall should be created relative to the underlying Base edges (like 'wall axis'). Seem your code do the same thing?
Thanks !
Thanks @paullee

The beam objects don't not have thickness or height property, only start_point and end_point. in my model the base foundation shapes have all needed properties to create the foundation shape, like layer (A, B), height, beams, left_width, right_width, width, fix_width_from (left, right, center), ...

if i select the beams and click the arch wall, each beam create a separate wall. I know the algorithem for Arch wall. but I wanted some extra property:

1- I written an algorithm for recognize continuous beams in model. It gets a list of beams and an angle. angle is the largest acceptable angle between two beams to be consider as continuous.

https://github.com/ebrahimraeyat/Civil/ ... s.py#L1014

2- my base foundations objects, have width, left_width, right_width and fix_width_from (left, right, center). if for example user choose to align from left, setting fix_width_from = left, program gets left_width as left width and right_width = width - left_width and ignore right_width the user input.

https://github.com/ebrahimraeyat/Civil/ ... on.py#L176

Thanks for your attention.
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: Connect two face and fill empty espace

Post by paullee »

Thanks for explanation.

One more thought, maybe you can ping @bernd / @yorik to see how your object can include some structural modelling elements (structural axis ?) to facilitate structural analysis ? (FEM ?)
Post Reply