integration between ose-piping-workbench and flamingo-wb

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
Kunda1
Posts: 5783
Joined: Thu Jan 05, 2017 9:03 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby Kunda1 » Mon Apr 02, 2018 3:53 pm

rus wrote:
Mon Apr 02, 2018 3:49 pm
I made a short video tutorial how to use flamingo with OSE-pipe-workbench
https://youtu.be/1FBudfRcQv4
Very cool!
FYI, Feel free to use the [video] tag for this exact purpose
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Mon Apr 02, 2018 3:56 pm

Kunda1 wrote:
Mon Apr 02, 2018 3:53 pm
Very cool!
FYI, Feel free to use the [video] tag for this exact purpose
Thanks for the hint! I edited the corresponding post, and it works :) .
oddtopus
Posts: 125
Joined: Tue Sep 20, 2016 6:17 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby oddtopus » Sun Apr 08, 2018 12:10 pm

Is there a particular reason to have flat parts in x-y plane? How can I rotate them to move them within Elbow.execute into x-z plane?
Each rule to build the Shape of the parts is intended to make the commands apply in the same way on similar objects. For example when using "spin by 45" I want to rotate a flange around the axis. Also to make coding easier: when I want to move a curve, generally it's to put it at the intersection of two axis, which correspond to its Placement.Base.
I see an advatage to put the center of the fitting into intersection of the x-y axis. When I made the weep elbow I took it in account. When ask guys from our development team how they would project a 2D dawing, they will project them into x-z plane.
Dear @rus, I just pulled the last commit of your repo and found that elbows in flamingo "flavour" are no more compatible.
The matter is how the shape is drawn respect to the x-y-z axis. In fact you have changed the orientation of shape and that choice has a backdraw: it makes flamingo not recognize the correct alignment of the elbow and so each command that deals with part orientation fails. Below is an example of the current result of "Fit one elbow" command.
elbowJoinFailed.png
elbowJoinFailed.png (68.35 KiB) Viewed 625 times
How to code the shape of a part it's not a matter of the preferred plane to project one curve (despite what says your development team, in 20 years of piping design I never heard such rule) but to make things congruent among different workbenches.
So, with reference only to the parts of type "flamingo", please restore the shape so that the Z axis is orthogonal to the ports of the elbow and the origin is at the intersections of ports, like this .
flElbowOrientation.png
flElbowOrientation.png (7.18 KiB) Viewed 625 times
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Sun Apr 08, 2018 2:52 pm

oddtopus wrote:
Sun Apr 08, 2018 12:10 pm
Dear @rus, I just pulled the last commit of your repo and found that elbows in flamingo "flavour" are no more compatible.
The matter is how the shape is drawn respect to the x-y-z axis. In fact you have changed the orientation of shape and that choice has a backdraw: it makes flamingo not recognize the correct alignment of the elbow and so each command that deals with part orientation fails. Below is an example of the current result of "Fit one elbow" command.elbowJoinFailed.png
How to code the shape of a part it's not a matter of the preferred plane to project one curve (despite what says your development team, in 20 years of piping design I never heard such rule) but to make things congruent among different workbenches.
So, with reference only to the parts of type "flamingo", please restore the shape so that the Z axis is orthogonal to the ports of the elbow and the origin is at the intersections of ports, like this .flElbowOrientation.png
Dear @oddtopus,

Thank you for your feedback.

I see your important point about congruence. But this should not stop us from improving things and we should not keep less effective choice for compatibility reasons :D . For example I added "PSize", changed from "pipe outer diameter+pipe inner diameter" to "pipe outer diameter + wall thickness" and put the 0.0.0 point into intersection of the port axis -- because I see advantages in your API. But I do not know reasoning for your elbow orientation.

* What is the logic behind your choice of the x-y plane?
* And why the elbow is symmetric to the (1,1,0) line?
* Is there any convention?
* Other reasons?

The logic behind my choice is following:
* I expect that the an elbow with 0 bending point would look like a coupling, which in following our conventions is along the z axis.
* I expect that one part of the elbow (with port[1] in your drawing) to be fixed to one axis. In the same way an elbow is represented in a catalog of aetna-plastics. See attached image.
Attachments
elbow-symmetry.png
elbow-symmetry.png (41.39 KiB) Viewed 613 times
oddtopus
Posts: 125
Joined: Tue Sep 20, 2016 6:17 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby oddtopus » Sun Apr 08, 2018 4:14 pm

The reason is the algorithm to place one elbow, whatever is the angle, between 2 pipes or edges.
0. the elbow BendAngle is changed to the angle between pipes or edges
1. the elbow is translated to the intersection of two pipes or edges : that's the reason of Placement.Base choice
2. then the Z axis of the elbow is aligned with the cross product of the two versors of the intersecting things (edges or pipe axis): it's not only a convenction but it deals also with how the commands of flamingo interacts with the Arch.Structure objects. Can't change that.
3. finally the (1,1,0) vector of elbow's shape is aligned with the bisect of the versors of the edges or pipes' axis: that's why elbows are symetric respect to the (1,1,0) vector in flamingo

So you can notice how the choices of construction of the Shape facilitate these steps.
It would create to much entropy to change this now because this procedure is extensively used.
Frankly speaking, I prefer to make new features rather than re-coding all that. :?
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Sun Apr 08, 2018 5:07 pm

oddtopus wrote:
Sun Apr 08, 2018 4:14 pm
The reason is the algorithm to place one elbow, whatever is the angle, between 2 pipes or edges.
0. the elbow BendAngle is changed to the angle between pipes or edges
1. the elbow is translated to the intersection of two pipes or edges : that's the reason of Placement.Base choice
2. then the Z axis of the elbow is aligned with the cross product of the two versors of the intersecting things (edges or pipe axis): it's not only a convenction but it deals also with how the commands of flamingo interacts with the Arch.Structure objects. Can't change that.
3. finally the (1,1,0) vector of elbow's shape is aligned with the bisect of the versors of the edges or pipes' axis: that's why elbows are symetric respect to the (1,1,0) vector in flamingo
Thank you for the explanations.

0. I see. Initially I made the workbench for PVC-fittings with not-adjustable bend angle. This is a weak point of my implementation. I need to think about it.
1. OK.
2. I need to analyze Arch.Structure. It make sense to keep the parts compatible across multiple workbenches. (Now I need to know why the Acrh-developers chose this :roll: orientation. )
3. I think this can be adjusted.

0, 1, 3 can be adjusted to any fitting with two ports. Independent on their orientation. But point 2 is an different one, because of Arch.Structure .... I need to check this connection more in details

After your explanations, I realized that it is not always possible to join two pipes with my elbow. This will not work when:
* the pipes do NOT lie in the same plane
* the angle between the pipes is larger than 90°
So you can notice how the choices of construction of the Shape facilitate these steps.
It would create to much entropy to change this now because this procedure is extensively used.
Frankly speaking, I prefer to make new features rather than re-coding all that. :?
I understand. I think it is possible to make a command to put an elbow between the pipe which will work both with your elbow and my elbow. All the important informations are in ports. When the port vectors are non-zero, then a command for putting an elbow between two pipes could be:

1) Calculate bending angle.
2) Translate elbow into the intersection of pipe axis.
3) Determine the plane of the elbow and rotate it until it is co-planar with the pipes.
4) Rotate the elbow around the crossproduct of the ports

But before I will try to implement this universal command, I need to think about point 2.
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Sun Apr 08, 2018 5:53 pm

Add flamingo implementation of a cross fitting.
Attachments
cross-calculations.png
cross-calculations.png (5.96 KiB) Viewed 595 times
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Sun Apr 29, 2018 9:36 am

@oddtopus What is a PSize value for fittings with different pipe sizes: reducing fittings and bushings.
alberich
Posts: 48
Joined: Thu Aug 17, 2017 2:09 pm
Location: Texas

Re: integration between ose-piping-workbench and flamingo-wb

Postby alberich » Thu May 03, 2018 2:31 pm

Inspired by this thread and the need to lay out electrical conduit,
compressed air piping, and dust collection piping for a workshop, I
decided to take the OSE-Piping-Workbench for a test drive. Results were
mixed.

With this FreeCAD install:

Code: Select all

OS: Ubuntu 16.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13519 (Git) AppImage
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 1a8b868018f45ea486c0023fdbfeb06febc1fb89
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)
I tried placing some piping components. In each case I started FreeCAD
anew and with a new document.

Here are some observations:

1. Adding a pipe - nothing happens when I press OK in the selector dialog.
No message in Report View, no nothing.

2. I can successfully add all other components offered in the toolbar.

3. I do get an error msg when adding a coupling:

Code: Select all

Trying to load CSV file with dimensions: /home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/tables/coupling.csv
Traceback (most recent call last):
  File "/home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/flCoupling.py", line 51, in onChanged
    obj.Ports = self.getPorts(obj)
  File "/home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/flCoupling.py", line 176, in getPorts
    SL = (obj.L-obj.N)/2 # Inner socket length.
<type 'exceptions.AttributeError'>: 'FeaturePython' object has no attribute 'N'
The coupling table is present. I do get a coupling added. The coupling table does have an 'N' entry.

4. Elbows are added with the bend segment solid. That is, you cannot see through them.

In each case I find the same behavior regardless of Output Type selected.

I hope these observations are helpful to you. I look forward to using the OSE-Piping and Flamingo WBs.
User avatar
rus
Posts: 69
Joined: Wed Feb 22, 2017 6:37 pm

Re: integration between ose-piping-workbench and flamingo-wb

Postby rus » Fri May 04, 2018 6:45 pm

Dear alberich,

thank you for the detailed report. Now I am redesigning the workbench to make it more similar to Flamingo and fix some previous design mistakes. I am going to complete the redesign in two weeks. Then I will check if these bugs exist.
alberich wrote:
Thu May 03, 2018 2:31 pm
Inspired by this thread and the need to lay out electrical conduit,
compressed air piping, and dust collection piping for a workshop, I
decided to take the OSE-Piping-Workbench for a test drive.
Great!
alberich wrote:
Thu May 03, 2018 2:31 pm
Results were
mixed.
Thank you for being polite :lol: . I hope that in couple of weeks the results will be better :) .
alberich wrote:
Thu May 03, 2018 2:31 pm
I tried placing some piping components. In each case I started FreeCAD
anew and with a new document.

Here are some observations:

1. Adding a pipe - nothing happens when I press OK in the selector dialog.
No message in Report View, no nothing.
I have similar problems. Thank you to point to it.
alberich wrote:
Thu May 03, 2018 2:31 pm
2. I can successfully add all other components offered in the toolbar.
Cool.
alberich wrote:
Thu May 03, 2018 2:31 pm
3. I do get an error msg when adding a coupling:

Code: Select all

Trying to load CSV file with dimensions: /home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/tables/coupling.csv
Traceback (most recent call last):
  File "/home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/flCoupling.py", line 51, in onChanged
    obj.Ports = self.getPorts(obj)
  File "/home/mac_aodh/.FreeCAD/Mod/ose-piping-workbench/flCoupling.py", line 176, in getPorts
    SL = (obj.L-obj.N)/2 # Inner socket length.
<type 'exceptions.AttributeError'>: 'FeaturePython' object has no attribute 'N'
The coupling table is present. I do get a coupling added. The coupling table does have an 'N' entry.
Thank you for the report. (Background info: function onChanged needs dimension N to calculate port, but it is called before I assign the dimension N. It is also called after I assign the dimension N, that is why a coupling still work.) I will put the bug fix in the master branch within two weeks.
alberich wrote:
Thu May 03, 2018 2:31 pm
4. Elbows are added with the bend segment solid. That is, you cannot see through them.

In each case I find the same behavior regardless of Output Type selected.
The bent segment is a sweep part. How a sweep works (or does not work) is magic to me :? . I still learn how to use it. I will try to replicate it later with the new version.
alberich wrote:
Thu May 03, 2018 2:31 pm
I hope these observations are helpful to you. I look forward to using the OSE-Piping and Flamingo WBs.
They help. Thank you!