Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CommandsPolar.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def Activated(self):
FreeCADGui.Control.showDialog(fe_ChEDL.dpCalcDialog())

def GetResources(self):
return{'Pixmap':os.path.join(os.path.dirname(os.path.abspath(__file__)),"icons","delta.svg"),'MenuText':'Pressure loss calculator','ToolTip':'Calculate pressure loss in "pypes" using ChEDL libraries.\n See __doc__ of the module for futher information.'}
return{'Pixmap':os.path.join(os.path.dirname(os.path.abspath(__file__)),"icons","delta.svg"),'MenuText':'Pressure loss calculator','ToolTip':'Calculate pressure loss in "pypes" using ChEDL libraries.\n See __doc__ of the module for further information.'}

class selectSolids:

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For convenience Flamingo tools are grouped in three toolbars/menus + one utility
![screenshot1](https://www.freecadweb.org/wiki/images/9/9e/Flamingos_frame2.jpg)

It's a simple toolbox of 12 commands to arrange frames, trusses and similar to using the Structure objects in FreeCAD's Arch module.
Read [tutorialFrame.pdf](https://github.com/oddtopus/flamingo/blob/master/tutorials/tutorialFrame.pdf) for more informations. Code is in `CommandsFrame.py`
Read [tutorialFrame.pdf](https://github.com/oddtopus/flamingo/blob/master/tutorials/tutorialFrame.pdf) for more information. Code is in `CommandsFrame.py`

### PypeTools toolbar
![screenshot1](https://www.freecadweb.org/wiki/images/0/06/Flamingos_pype2.jpg)
Expand All @@ -23,11 +23,11 @@ The logical continuation of the frame tool since it deals with creating pipeline
Read [tutorialPype2.pdf](https://github.com/oddtopus/flamingo/blob/master/tutorials/tutorialPype2.pdf) for more specific features. Code is in `CommandsPipe.py`

### EagleTools toolbar
This toolbar is mantained only for historical reasons. "Eagle tools": are basically an addition and shortcut to the very fine [FreeCAD-PCB workbench](https://github.com/marmni/FreeCAD-PCB) (available via the [FreeCAD addon manager](https://github.com/FreeCAD/FreeCAD-addons)) to import position of objects from a .brd Eagle's file on a PCB drawn in FreeCAD with the a.m. workbench relating only on their names. It's also the origin, by extension, of the name of the entire workbench.
This toolbar is maintained only for historical reasons. "Eagle tools": are basically an addition and shortcut to the very fine [FreeCAD-PCB workbench](https://github.com/marmni/FreeCAD-PCB) (available via the [FreeCAD addon manager](https://github.com/FreeCAD/FreeCAD-addons)) to import position of objects from a .brd Eagle's file on a PCB drawn in FreeCAD with the a.m. workbench relating only on their names. It's also the origin, by extension, of the name of the entire workbench.

> "If the parts in the group Parts of the .FCStd file have the same name of the parts in the .brd file, they will be moved to the position of the PCB specified in the .brd file."

Read [tutorialEagle.pdf](https://github.com/oddtopus/flamingo/blob/master/tutorials/tutorialEagle.pdf) for more informations. Code is in `CommandsEagle.py`
Read [tutorialEagle.pdf](https://github.com/oddtopus/flamingo/blob/master/tutorials/tutorialEagle.pdf) for more information. Code is in `CommandsEagle.py`

### Utils toolbar
![screenshot1](https://www.freecadweb.org/wiki/images/d/d2/Flamingos_utils.jpg)
Expand Down
4 changes: 2 additions & 2 deletions examples/board6.brd
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ www.panasonic.com<p>
www.kemet.com<p>
http://www.secc.co.jp/pdf/os_e/2004/e_os_all.pdf <b>(SANYO)</b>
<p>
for trimmer refence see : <u>www.electrospec-inc.com/cross_references/trimpotcrossref.asp</u><p>
for trimmer reference see : <u>www.electrospec-inc.com/cross_references/trimpotcrossref.asp</u><p>

<table border=0 cellspacing=0 cellpadding=0 width="100%" cellpaddding=0>
<tr valign="top">
Expand Down Expand Up @@ -1640,7 +1640,7 @@ Extended by Federico Battaglin <author><federico.rd@fdpinternationa
</library>
<library name="optocoupler">
<description>&lt;b&gt;Opto Couplers&lt;/b&gt;&lt;p&gt;
Siemens, Hewlett-Packard, Texas Instuments, Sharp, Motorola&lt;p&gt;
Siemens, Hewlett-Packard, Texas Instruments, Sharp, Motorola&lt;p&gt;
&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>
<packages>
<package name="DIL06">
Expand Down
28 changes: 14 additions & 14 deletions frameCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,29 @@ def intersectionCLines(thing1=None, thing2=None):
else:
FreeCAD.Console.PrintError('No intersection found\n')
return None


def intersectionLines(p1=None,v1=None,p2=None,v2=None): # OBSOLETE: replaced with intersectionCLines
'''
intersectionLines(p1,v1,p2,v2)
If exist, returns the intersection (vector) between two lines
If exist, returns the intersection (vector) between two lines
p1,v1: the reference point and direction of first line
p2,v2: the reference point and direction of second line
'''

if None in [p1,p2,v1,v2]:
eds=edges()[:2]
p1,p2=[e.valueAt(0) for e in eds]
v1,v2=[e.tangentAt(0) for e in eds]
if not isParallel(v1,v2):
if not isParallel(v1,v2):
dist=p1-p2
import numpy
#M=numpy.matrix([list(v1),list(v2),list(dist)]) # does not work: it seems for lack of accuracy of FreeCAD.Base.Vector operations!
rowM1=[round(x,2) for x in v1]
rowM2=[round(x,2) for x in v2]
rowM3=[round(x,2) for x in dist]
M=numpy.matrix([rowM1,rowM2,rowM3])
if numpy.linalg.det(M)==0:
if numpy.linalg.det(M)==0:
#3 equations, 2 unknowns => 1 eq. must be dependent
a11,a21,a31=list(v1)
a12,a22,a32=list(v2*-1)
Expand Down Expand Up @@ -146,7 +146,7 @@ def intersectionPlane(base=None,v=None,face=None):
base (vector): the base point to be projected
v (vector): the direction of the line that intersect the plane
face (Face): the face that defines the plane to be intersect
'''
'''
# only for quick testing:
if base==v==face==None:
face = faces()[0]
Expand Down Expand Up @@ -219,7 +219,7 @@ def beamAx(beam, vShapeRef=None):
return beam.Placement.Rotation.multVec(vShapeRef).normalize()

def getDistance(shapes=None):
'measure the lenght of an edge or the distance of two shapes'
'measure the length of an edge or the distance of two shapes'
if not shapes:
shapes=[y for x in FreeCADGui.Selection.getSelectionEx() for y in x.SubObjects if hasattr(y,'ShapeType')]
if len(shapes)==1 and shapes[0].ShapeType=='Edge':
Expand All @@ -245,7 +245,7 @@ def bisect(w1=None,w2=None):
for i in range(3):
b[i]=(w1[i]+w2[i])/2
return b.normalize()

def ortho(w1=None,w2=None):
'''
ortho(w1=None,w2=None)
Expand Down Expand Up @@ -280,7 +280,7 @@ def edgeName(obj=None,edge=None):
return obj,"Edge"+str(i)
i+=1
return None

############ COMMANDS #############

def spinTheBeam(beam, angle): # OBSOLETE: replaced by rotateTheTubeAx
Expand Down Expand Up @@ -340,7 +340,7 @@ def pivotTheBeam(ang=90, edge=None, beam=None): #OBSOLETE: replaced with rotateT
edgePost=edges()[0] #save position for revert
dist=edge.CenterOfMass-edgePost.CenterOfMass
beam.Placement.move(dist)

def rotateTheBeamAround(b,e,ang=90): # for rotation around an axis
'''
rotateTheBeamAround(b,e,ang=90): rotates any Body around an edge
Expand All @@ -355,11 +355,11 @@ def rotateTheBeamAround(b,e,ang=90): # for rotation around an axis
P1=O+rot.multVec(P0.Point-O)
b.Placement.Rotation=rot.multiply(b.Placement.Rotation)
b.Placement.Base=P1 #rot.multVec(b.Placement.Base)

def stretchTheBeam(beam,L):
if beam!=None and beam.TypeId=="Part::FeaturePython" and hasattr(beam,"Height"):
beam.Height=L

def extendTheBeam(beam,target):
'''arg1=beam, arg2=target: extend the beam to a plane, normal to its axis, defined by target.
If target is a Vertex or a Vector, the plane is the one that includes the point defined by target.
Expand Down Expand Up @@ -390,7 +390,7 @@ def extendTheBeam(beam,target):
beam.Height+=FreeCAD.Units.Quantity(str(abs(distTop))+"mm")
else:
beam.Height+=FreeCAD.Units.Quantity(str(abs(distBase))+"mm")
vMove=vBeam.normalize().multiply(-distBase)
vMove=vBeam.normalize().multiply(-distBase)
beam.Placement.move(vMove)
else:
if abs(distBase)>abs(distTop):
Expand All @@ -400,7 +400,7 @@ def extendTheBeam(beam,target):
vMove=vBeam.normalize().multiply(-distBase)
beam.Placement.move(vMove)
#FreeCAD.activeDocument().recompute()

def rotjoinTheBeam(beam=None,e1=None,e2=None):
if not (beam and e1 and e2):
beam=beams()[1]
Expand Down
2 changes: 1 addition & 1 deletion pipeCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def getElbowPort(elbow, portId=0):
def rotateTheElbowPort(curve=None, port=0, ang=45):
'''
rotateTheElbowPort(curve=None, port=0, ang=45)
Rotates one curve aroud one of its circular edges.
Rotates one curve around one of its circular edges.
'''
if curve==None:
try:
Expand Down
57 changes: 28 additions & 29 deletions pipeFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def execute(self, fp):
def nearestPort (self,point=None):
'''
nearestPort (point=None)
Returns the Port nearest to point
Returns the Port nearest to point
or to the selected geometry.
(<portNr>, <portPos>, <portDir>)
'''
Expand Down Expand Up @@ -155,7 +155,7 @@ def execute(self, fp):
else:
fp.Shape=sol
super(Elbow,self).execute(fp) # perform common operations

class Flange(pypeType):
'''Class for object PType="Flange"
Flange(obj,[PSize="DN50",FlangeType="SO", D=160, d=60.3,df=132, f=14 t=15,n=4, trf=0, drf=0, twn=0, dwn=0, ODp=0])
Expand All @@ -168,9 +168,9 @@ class Flange(pypeType):
f (float): bolts holes diameter
t (float): flange thickness
n (int): nr. of bolts
trf (float): raised-face thikness
trf (float): raised-face thickness
drf (float): raised-face diameter
twn (float): welding-neck thikness
twn (float): welding-neck thickness
dwn (float): welding-neck diameter
ODp (float): outside diameter of pipe for wn flanges
'''
Expand Down Expand Up @@ -250,7 +250,7 @@ def __init__(self, obj,DN="DN50",OD=60.3,OD2=48.3,thk=3, thk2=None, H=None, conc
obj.thk2=thk
else:
obj.thk2=thk2
obj.addProperty("App::PropertyBool","calcH","Reduct","Make the lenght variable")
obj.addProperty("App::PropertyBool","calcH","Reduct","Make the length variable")
obj.addProperty("App::PropertyLength","Height","Reduct","Length of reduct")
if not H:
obj.calcH=True
Expand Down Expand Up @@ -288,7 +288,7 @@ def execute(self, fp):
fp.Shape=sol
fp.Ports=[FreeCAD.Vector(),FreeCAD.Vector((fp.OD-fp.OD2)/2,0,float(fp.Height))]
super(Reduct,self).execute(fp) # perform common operations

class Cap(pypeType):
'''Class for object PType="Cap"
Cap(obj,[PSize="DN50",OD=60.3,thk=3])
Expand Down Expand Up @@ -326,25 +326,25 @@ def execute(self, fp):
fp.Shape = cap
fp.Ports=[FreeCAD.Vector()]
super(Cap,self).execute(fp) # perform common operations

class PypeLine2(pypeType):
'''Class for object PType="PypeLine2"
This object represent a collection of objects "PType" that are updated with the
This object represent a collection of objects "PType" that are updated with the
methods defined in the Python class.
At present time it creates, with the method obj.Proxy.update(,obj,[edges]), pipes and curves over
At present time it creates, with the method obj.Proxy.update(,obj,[edges]), pipes and curves over
the given edges and collect them in a group named according the object's .Label.
PypeLine2 features also the optional attribute ".Base":
- Base can be a Wire or a Sketch or any object which has edges in its Shape.
- Running "obj.Proxy.update(obj)", without any [edges], the class attempts to render the pypeline
(Pipe and Elbow objects) on the "obj.Base" edges: for well defined geometries
- Running "obj.Proxy.update(obj)", without any [edges], the class attempts to render the pypeline
(Pipe and Elbow objects) on the "obj.Base" edges: for well defined geometries
and open paths, this usually leads to acceptable results.
- Running "obj.Proxy.purge(obj)" deletes from the model all Pipes and Elbows
that belongs to the pype-line.
- It's possible to add other objects afterwards (such as Flange, Reduct...)
using the relevant insertion dialogs but remember that these won't be updated
- Running "obj.Proxy.purge(obj)" deletes from the model all Pipes and Elbows
that belongs to the pype-line.
- It's possible to add other objects afterwards (such as Flange, Reduct...)
using the relevant insertion dialogs but remember that these won't be updated
when the .Base is changed and won't be deleted if the pype-line is purged.
- If Base is None, PypeLine2 behaves like a bare container of objects,
with possibility to group them automatically and extract the part-list.
- If Base is None, PypeLine2 behaves like a bare container of objects,
with possibility to group them automatically and extract the part-list.
'''
def __init__(self, obj,DN="DN50",PRating="SCH-STD",OD=60.3,thk=3,BR=None, lab=None):
# initialize the parent class
Expand Down Expand Up @@ -469,8 +469,8 @@ def __init__(self,obj,L=800,W=400,H=500,thk1=6, thk2=8):
obj.addProperty("App::PropertyLength","L","Tank","Tank's length").L=L
obj.addProperty("App::PropertyLength","W","Tank","Tank's width").W=W
obj.addProperty("App::PropertyLength","H","Tank","Tank's height").H=H
obj.addProperty("App::PropertyLength","thk1","Tank","Thikness of tank's shell").thk1=thk1
obj.addProperty("App::PropertyLength","thk2","Tank","Thikness of tank's top").thk2=thk2
obj.addProperty("App::PropertyLength","thk1","Tank","Thickness of tank's shell").thk1=thk1
obj.addProperty("App::PropertyLength","thk2","Tank","Thickness of tank's top").thk2=thk2
def onChanged(self, fp, prop):
return None
def execute(self, fp):
Expand Down Expand Up @@ -546,7 +546,7 @@ def execute(self, fp):
fp.Shape = v
fp.Ports=[FreeCAD.Vector(),FreeCAD.Vector(0,0,float(fp.Height))]
super(Valve,self).execute(fp) # perform common operations

class PypeBranch2(pypeType): # use AttachExtensionPython
'''Class for object PType="PypeBranch2"
Single-line pipe branch linked to its center-line using AttachExtensionPython
Expand All @@ -570,7 +570,7 @@ def __init__(self, obj,base,DN="DN50",PRating="SCH-STD",OD=60.3,thk=3,BR=None):
obj.addProperty("App::PropertyStringList","Tubes","PypeBranch","The tubes of the branch.")
obj.addProperty("App::PropertyStringList","Curves","PypeBranch","The curves of the branch.")
obj.addProperty("App::PropertyLink","Base","PypeBranch","The path.")
if hasattr(base,"Shape") and base.Shape.Edges:
if hasattr(base,"Shape") and base.Shape.Edges:
obj.Base=base
else:
FreeCAD.Console.PrintError('Base not valid\n')
Expand Down Expand Up @@ -605,18 +605,18 @@ def execute(self, fp):
if i<len(fp.Curves):
c=FreeCAD.ActiveDocument.getObject(fp.Curves[i])
v1,v2=[e.tangentAt(0) for e in fp.Base.Shape.Edges[i:i+2]]
pipeCmd.placeTheElbow(c,v1,v2)
pipeCmd.placeTheElbow(c,v1,v2)
alfa=float(v1.getAngle(v2))/2
L-=float(R*tan(alfa))
L-=float(R*tan(alfa))
# adjust the pipes
if i:
if i:
v1,v2=[e.tangentAt(0) for e in fp.Base.Shape.Edges[i-1:i+1]]
alfa=float(v1.getAngle(v2))/2
tang=float(R*tan(alfa))
tang=float(R*tan(alfa))
L-=tang
FreeCAD.ActiveDocument.getObject(fp.Tubes[i]).AttachmentOffset.Base=FreeCAD.Vector(0,0,tang)
FreeCAD.ActiveDocument.getObject(fp.Tubes[i]).Height=L
def redraw(self,fp):
def redraw(self,fp):
from math import tan, degrees
tubes=list()
curves=list()
Expand All @@ -627,11 +627,11 @@ def redraw(self,fp):
R=float(fp.BendRadius)
offset=0
#---Create the tube---
if i>0:
if i>0:
alfa=e.tangentAt(0).getAngle(fp.Base.Shape.Edges[i-1].tangentAt(0))/2
L-=R*tan(alfa)
offset=R*tan(alfa)
if i<(len(fp.Base.Shape.Edges)-1):
if i<(len(fp.Base.Shape.Edges)-1):
alfa=e.tangentAt(0).getAngle(fp.Base.Shape.Edges[i+1].tangentAt(0))/2
L-=R*tan(alfa)
eSupport='Edge'+str(i+1)
Expand Down Expand Up @@ -668,4 +668,3 @@ def purge(self,fp):
fp.removeObjects([FreeCAD.ActiveDocument.getObject(name) for name in fp.Curves])
for name in fp.Curves: FreeCAD.ActiveDocument.removeObject(name)
fp.Curves=[]

2 changes: 1 addition & 1 deletion pipeForms.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ class insertUboltForm(protopypeForm):
For position and orientation you can select
- one or more circular edges,
- nothing.
In case one pipe is selected, its properties are aplied to the U-bolt.
In case one pipe is selected, its properties are applied to the U-bolt.
Available one button to reverse the orientation of the last or selected tubes.
'''
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion polarUtilsCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from frameForms import prototypeDialog

def cerchio(R=1, nseg=8):
'arg1=R, arg2=nseg: returns a list of 3-uple for nseg+1 coordintates on the semi-circle centered in (0,0,0)'
'arg1=R, arg2=nseg: returns a list of 3-uple for nseg+1 coordinates on the semi-circle centered in (0,0,0)'
teta=[i*2*math.pi/nseg for i in range(nseg+1)]
return [polar2xy(R,t) for t in teta]

Expand Down