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
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

I converted the normal elbow to the flamingo elbow. The middle part of the elbow is not shown correctly. I do not know how to fix it.
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

oddtopus wrote: Sun Apr 08, 2018 12:10 pm ...
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
@oddtopus
I oriented elbow in flamingo style. The connection between the pipe works now!

phpBB [video]
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

Made sweep-elbows compatible with Flamingo.
Added bend angle to sweep elbows.
Attachments
test-sweep-elbow-screenshot.png
test-sweep-elbow-screenshot.png (33 KiB) Viewed 2268 times
oddtopus
Posts: 142
Joined: Tue Sep 20, 2016 6:17 pm

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

Post by oddtopus »

Thank you @rus for your effort. With this change now it's even simpler to join two pipes with the elbows or move the tees and other fittings. See the attached video, for instance.
exampleOSE_Flamingo.mp4.zip
(378.18 KiB) Downloaded 68 times
Also I spent some time improving the mate-edges command: now it's easier to use with objects derived from the pypeType() class because it automatically detects the nearest port next to the geometry selected in the viewport.
This is possible with 2 new functions defined in the pipeCmd module:
* placeThePype(), which is able to join the pype parts giving simply their ports numbers,
* nearestPort(), to simplify the selection in the viewport.

It would be useful and time-saving if the OSE parts could be placed directly on the selected edge or pipe instead of placing it in the origin and afterward move it where desired.
Maybe that's not your target but using the above functions, it could be simple to implement.

P.S. Just review the definition of Ports of the bushings: it seems they don't join perfectly as tees and sweeped elbows.
bushing.png
bushing.png (79.46 KiB) Viewed 2209 times
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

oddtopus wrote: Fri Jun 15, 2018 4:37 pm Thank you @rus for your effort. With this change now it's even simpler to join two pipes with the elbows or move the tees and other fittings. See the attached video, for instance.
exampleOSE_Flamingo.mp4.zip
Thank you for your support. Your Video looks greate!
oddtopus wrote: Fri Jun 15, 2018 4:37 pm Also I spent some time improving the mate-edges command: now it's easier to use with objects derived from the pypeType() class because it automatically detects the nearest port next to the geometry selected in the viewport.
This is possible with 2 new functions defined in the pipeCmd module:
* placeThePype(), which is able to join the pype parts giving simply their ports numbers,
* nearestPort(), to simplify the selection in the viewport.

It would be useful and time-saving if the OSE parts could be placed directly on the selected edge or pipe instead of placing it in the origin and afterward move it where desired.
Maybe that's not your target but using the above functions, it could be simple to implement.
Actually, preciselly THIS is my target. I will try to figure it out, how to use the your new functions.
oddtopus wrote: Fri Jun 15, 2018 4:37 pm P.S. Just review the definition of Ports of the bushings: it seems they don't join perfectly as tees and sweeped elbows.
bushing.png
Thanks for the comment. I do not know where to put the port of the outer pipe. That is why I make it in the same place as the inner port.
It there a special dimension for it?
Attachments
bushing-port-screenshot.png
bushing-port-screenshot.png (9.88 KiB) Viewed 2185 times
oddtopus
Posts: 142
Joined: Tue Sep 20, 2016 6:17 pm

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

Post by oddtopus »

rus wrote: Sat Jun 16, 2018 1:11 pm Actually, preciselly THIS is my target. I will try to figure it out, how to use the your new functions.
I guess that the full version of the snippet could be like this:

Code: Select all

[..]
part=builder.create(feature)
try:
    target=Gui.Selection.getSelectionEx()[0].Object
    sub=Gui.Selection.getSelectionEx()[0].SubObjects[0]
    pipeCmd.placeThePype(part,0,target,pipeCmd.nearestPort(target,sub.CenterOfMass)[0])
except:
    pass
Anyway there is a shortcut because last 3 parameters of the function are optional, with default values:

Code: Select all

[..]
part=builder.create(feature)
try:
    pipeCmd.placeThePype(part)
except:
    pass
If you don't want to make a dependency upon pipeCmd, you may copy+paste the code of those functions directly in your files.

I think I'm going to add these methods also directly in the pypeType class because they're handy and I will use them several times in future. In that way it will be possible to perform what above in a more elegant way: for example...

Code: Select all

[..]
part=builder.create(feature)
part.place()
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

oddtopus wrote: Sun Jun 17, 2018 8:38 am Actually, preciselly THIS is my target. I will try to figure it out, how to use the your new functions.

I guess that the full version of the snippet could be like this:
...
Thank you for the code snippets!
oddtopus wrote: Sun Jun 17, 2018 8:38 am I think I'm going to add these methods also directly in the pypeType class because they're handy and I will use them several times in future. In that way it will be possible to perform what above in a more elegant way: for example...
This looks like a good Idea to me. Then I will get all the nice features in Flamingo-Fittings for free :D .
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

I started to implement new positioning feature with pipeCmd. Placing of Fittings works but placing of not yet. I modified your snippet a little, because my builder.create does creates python objects without Ports.

Code: Select all

    @staticmethod
    def moveFlamingoPartToSelection(document, part):
        # Check if something is selected:
        import pipeCmd

        if (len(FreeCADGui.Selection.getSelectionEx()) > 0
                and len(FreeCADGui.Selection.getSelectionEx()[0].SubObjects) > 0):
            obj_of_part = document.getObject(part.Name)
            target = FreeCADGui.Selection.getSelectionEx()[0].Object
            sub = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
            try:
                pipeCmd.placeThePype(obj_of_part, 0, target, pipeCmd.nearestPort(
                    target, sub.CenterOfMass)[0])
            except Exception as e:
                FreeCAD.Console.PrintMessage(
                    "Positioning of Flamingo parts failed: " + str(e))
User avatar
rus
Posts: 73
Joined: Wed Feb 22, 2017 6:37 pm

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

Post by rus »

oddtopus wrote: Sun Jun 17, 2018 8:38 am
rus wrote: Sat Jun 16, 2018 1:11 pm Actually, preciselly THIS is my target. I will try to figure it out, how to use the your new functions.
I guess that the full version of the snippet could be like this:
....
I impement the code but I have problem with rotations. The Ports fits but the moved part is rotated by the rong end. See my video below:

phpBB [video]

Do we need an additional information for the ports, like a normal vector?
Or an additional parameter to pipeCmd.placeThePype() ? For a coupling I could precisely specify from which side the pipe must be isnerted.
oddtopus
Posts: 142
Joined: Tue Sep 20, 2016 6:17 pm

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

Post by oddtopus »

rus wrote: Sat Aug 04, 2018 7:23 am
Do we need an additional information for the ports, like a normal vector?
Or an additional parameter to pipeCmd.placeThePype() ? For a coupling I could precisely specify from which side the pipe must be isnerted.
Hi @rus, I think you can refer to functions pipeCmd.portsDir(o) and pipeCmd.portsPos(o), that return an array of Vectors of ports' directions and positions respectively of object "o", respect to the ActiveDocument general origin.
Here directions are defined according the object shape orientation, from the origin of the Shape to the relative position of the port.
If I remember well how I did it, I guess that to place one object respect to a port you can assign to it a

Code: Select all

Placement.Base=pipeCmd.portsPos(o)[i] 
and a

Code: Select all

Placement.Rotation=App.Rotation(<your-reference-direction-vector>,pipeCmd.portsDir(o)[i])
or something like that.

By the way, did you see the last feature "Insert Any Shape"? It can insert any object from a step file (or iges or brep) and assign to it ports like a native pype object.
Try to insert a ball valve from the samples and then use the "Join pypes" tool... ;)
Post Reply