I will work on it and tell you more in the future, but I don't think that I am capable than youpaullee 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
Connect two face and fill empty espace
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
many Thanks to your attention to use offsetWire. but it seems it has some bug! for example: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
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)
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)
Re: Connect two face and fill empty espace
ebrahim raeyat wrote: ↑Wed Dec 01, 2021 12:49 pmCode: 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...
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
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:paullee wrote: ↑Wed Dec 01, 2021 6:15 pmebrahim raeyat wrote: ↑Wed Dec 01, 2021 12:49 pmCode: 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...
Code: Select all
FreeCAD.DraftWorkingPlane.alignToPointAndAxis(FreeCAD.Vector(0.0, 0.0, 0.0), FreeCAD.Vector(0, 0, 1), -2400.0)
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
Hi @paullee. finally I finished my task for creating foundation. the concept is:
1- user draw some line (beam) with start and end points
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)
3- creating foundation shape: user can choose which base foundation must be continuous and which must be cut:
1- user draw some line (beam) with start and end points
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)
3- creating foundation shape: user can choose which base foundation must be continuous and which must be cut:
- ragohix769
- Posts: 568
- Joined: Sat Jul 18, 2020 7:04 am
- Location: Rome - Italy
Re: Connect two face and fill empty espace
Impressive Ebrahim!
If this works it's a dream that come true. Thanks a lot for sharing this idea!
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
=> Now you can find me here on #Mastodon: https://mastodon.uno/@opensoul - I hope more people do the same
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
Thanks a lot. This is main function to create foundation shape: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!
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
Re: Connect two face and fill empty espace
Congratulation!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:
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):-
- 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?
- 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?
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Connect two face and fill empty espace
Thanks @paulleepaullee 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):-
Thanks !
- 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?
- 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?
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.
Re: Connect two face and fill empty espace
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 ?)
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 ?)