Register
 
DoubleCAD XT v5 has released

PPM script modification (PRO only)
Read 2708 times
* May 17, 2009, 05:56:33 AM
I have not ever done this before, but encouraged by William and Brian  I decided to try it. I modified script "Flanged Lateral Fitting 45" and wrote a script from which we can obtain a reduction or  straight fitting(d1=d2) (to a collection PPM Fittings). Well, that is so much examples,because only from there I can see how and what features to use. Now I have  two questions.
1. Is there a function in the PPM "mirror copy"
2.How to change the unit in PPM - in my case were inches and I could not change that

Here script

pd =  Parameter("Pipe Diameter1", 1, LINEAR, Interval(1,24));
fd =  Parameter("Flange Diameter1", 4.25, LINEAR, Interval(4.25, 32));
pd1 =  Parameter("Pipe Diameter2", 1.5, LINEAR, Interval(1, 24));
fd1 =  Parameter("Flange Diameter2", 4.75, LINEAR, Interval(4.25, 32));
wt =  Parameter("Wall thickness", 0.25, LINEAR, Interval(0.25, 9/16));
ft =  Parameter("Flange thickness", 7/16, LINEAR, Interval(7/16, 1+7/8));
offset =  Parameter("Offset", 7/16, LINEAR, Interval(7/16,1+7/8));
EE = Parameter("EE", 5.25, LINEAR, Interval(5.25, 40.5));
FF = Parameter("FF", 1.75, LINEAR, Interval(1.75, 9));

rfillet = Parameter("rFillet", 0.5, LINEAR, Interval(0.25, 0.5));


xb = 0;
yb = 0;

P0 = Point(xb + pd/2 + wt, yb + offset);
P1 = Point(PointX(P0) + (fd/2 - pd/2 - wt), PointY(P0));
P2 = Point(PointX(P1), PointY(P1) + ft);
P3 = Point(PointX(P2) - fd, PointY(P2));
P4 = Point(PointX(P3), PointY(P3) - ft);
P5 = Point(PointX(P4) + (fd/2 - pd/2 - wt), PointY(P4));
P6 = Point(PointX(P5), PointY(P5) - offset);
P7 = Point(PointX(P6) + pd + 2*wt, PointY(P6));
pOffset1 = Polyline(P0, P7, P6, P5, P0);
pFlange1 = Polyline(P1, P2, P3, P4, P1);



P8 = Point(xb + pd1/2 + wt, yb + offset);
P9 = Point(PointX(P8) + (fd1/2 - pd1/2 - wt), PointY(P8));
P10 = Point(PointX(P9), PointY(P9) + ft);
P11 = Point(PointX(P10) - fd1, PointY(P10));
P12 = Point(PointX(P11), PointY(P11) - ft);
P13 = Point(PointX(P12) + (fd1/2 - pd1/2 - wt), PointY(P12));
P14 = Point(PointX(P13), PointY(P13) - offset);
P15 = Point(PointX(P14) + pd1 + 2*wt, PointY(P14));
pOffset2 = Polyline(P8, P15, P14, P13, P8);
pFlange2 = Polyline(P9, P10, P11, P12, P9);




pOffset22 = RotateZ(pOffset2, 180, xb, yb + offset + ft );
pFlange22= RotateZ(pFlange2, 180, xb, yb + offset + ft );

pOffset3 = Move(pOffset22, 0, EE + FF - 2*(offset + ft));
pFlange3 = Move(pFlange22, 0, EE + FF - 2*(offset + ft));




pLine = Polyline(Point(xb - pd/2 - wt, yb + offset + ft), Point(PointX(P12) + (fd1/2 - pd1/2 - wt), yb + EE + FF - (offset + ft)));
pref = RefPoint(xb, yb);
Output(pref);

pLine2 = Polyline(Point(xb + pd/2 + wt, yb + offset + ft), Point(PointX(P14) + pd1 + 2*wt, yb + EE + FF - (offset + ft)));
pref = RefPoint(xb, yb);
Output(pref);

Output(pOffset1, pFlange1, pOffset3, pFlange3, pLine, pLine2);
« Last Edit: May 17, 2009, 07:25:19 AM by Marek »

Logged


May 19, 2009, 08:58:41 AM
#1
Marek


Very cool - sorry for the delay in reply I was taking a short vacation.

Logged