# By Axelerator AB All rights reserved
# Author Marcus Isaksson
from varmain .primitiv import *#line:5
from varmain .custom import *#line:6
from varmain .var_basic import *#line:7
from varmain .dummy_var import *#line:8
from aqa .math import *#line:9
import math #line:10
import sys ,os #line:11
from varmain .capsub .cpc_pl import *#line:14
if not os .path .dirname (os .path .abspath (__file__ ))in sys .path :#line:17
			   sys .path .append (os .path .dirname (os .path .abspath (__file__ )))#line:18
from AX_BOXF import *#line:21
@activate (Group ="Tee,Lateral",TooltipShort ="Reducing Tee",TooltipLong ="Reducing Tee",LengthUnit ="mm",Ports ="3")#line:24
@group ("MainDimensions")#line:25
@param (OD1 =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:26
@param (OD2 =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:27
@param (CT =LENGTH ,TooltipShort ="Connection Type",TooltipLong ="Connection Type")#line:28
def AX_P1_REDUCING_TEE (O0O0OO0OOOOO0OO00 ,OD1 =50 ,OD2 =25 ,CT =0 ,**O00O0O000O0000O00 ):#line:37
	if OD1 ==50 and OD2 ==25 :#line:39
	    O000OOOOO0O00O0O0 =80.0 #line:40
	    O0OO00O00O0O0OO00 =138.0 #line:41
	    O00O0OOOOOO00OO00 =231.0 #line:42
	    O000OOO0000O0O000 =56.0 #line:43
	    O0OO000O0OO0O0OOO =111.0 #line:44
	elif OD1 ==50 and OD2 ==40 :#line:45
	    O000OOOOO0O00O0O0 =80.0 #line:46
	    O0OO00O00O0O0OO00 =157.0 #line:47
	    O00O0OOOOOO00OO00 =231.0 #line:48
	    O000OOO0000O0O000 =56.0 #line:49
	    O0OO000O0OO0O0OOO =107.0 #line:50
	elif OD1 ==63 and OD2 ==40 :#line:51
	    O000OOOOO0O00O0O0 =91.0 #line:52
	    O0OO00O00O0O0OO00 =166.0 #line:53
	    O00O0OOOOOO00OO00 =249.0 #line:54
	    O000OOO0000O0O000 =61.0 #line:55
	    O0OO000O0OO0O0OOO =116.0 #line:56
	elif OD1 ==63 and OD2 ==50 :#line:57
	    O000OOOOO0O00O0O0 =91.0 #line:58
	    O0OO00O00O0O0OO00 =177.0 #line:59
	    O00O0OOOOOO00OO00 =249.0 #line:60
	    O000OOO0000O0O000 =61.0 #line:61
	    O0OO000O0OO0O0OOO =117.0 #line:62
	elif OD1 ==76 and OD2 ==40 :#line:66
	    O00O0OOOOOO00OO00 =292 #line:67
	    O000OOO0000O0O000 =146 #line:68
	    O0OO000O0OO0O0OOO =105 #line:69
	elif OD1 ==76 and OD2 ==50 :#line:70
	    O00O0OOOOOO00OO00 =292 #line:71
	    O000OOO0000O0O000 =146 #line:72
	    O0OO000O0OO0O0OOO =160 #line:73
	elif OD1 ==76 and OD2 ==63 :#line:74
	    O00O0OOOOOO00OO00 =292 #line:75
	    O000OOO0000O0O000 =146 #line:76
	    O0OO000O0OO0O0OOO =164 #line:77
	elif OD1 ==100 and OD2 ==40 :#line:78
	    O00O0OOOOOO00OO00 =312 #line:79
	    O000OOO0000O0O000 =156 #line:80
	    O0OO000O0OO0O0OOO =118 #line:81
	elif OD1 ==100 and OD2 ==50 :#line:82
	    O00O0OOOOOO00OO00 =312 #line:83
	    O000OOO0000O0O000 =156 #line:84
	    O0OO000O0OO0O0OOO =173 #line:85
	elif OD1 ==100 and OD2 ==63 :#line:86
	    O00O0OOOOOO00OO00 =312 #line:87
	    O000OOO0000O0O000 =156 #line:88
	    O0OO000O0OO0O0OOO =177 #line:89
	elif OD1 ==100 and OD2 ==76 :#line:90
	    O00O0OOOOOO00OO00 =312 #line:91
	    O000OOO0000O0O000 =156 #line:92
	    O0OO000O0OO0O0OOO =136 #line:93
	elif OD1 ==168 and OD2 ==63 :#line:94
	    O00O0OOOOOO00OO00 =360 #line:95
	    O000OOO0000O0O000 =180 #line:96
	    O0OO000O0OO0O0OOO =220 #line:97
	elif OD1 ==168 and OD2 ==76 :#line:98
	    O00O0OOOOOO00OO00 =360 #line:99
	    O000OOO0000O0O000 =180 #line:100
	    O0OO000O0OO0O0OOO =185 #line:101
	elif OD1 ==168 and OD2 ==100 :#line:102
	    O00O0OOOOOO00OO00 =360 #line:103
	    O000OOO0000O0O000 =180 #line:104
	    O0OO000O0OO0O0OOO =185 #line:105
	if 50 <=OD1 <=63 :#line:111
		OOOOOOO0OOO0000O0 =(OD1 /2.0 )+2.0 #line:113
		O0OO0O0O0O0O00OOO =(OD1 /2.0 )*1.1 #line:114
		O0O0O0OOO0OOOO000 =((O00O0OOOOOO00OO00 /2.0 )-O000OOO0000O0O000 )*1.2 #line:115
		OO0OOOOOOOO00O0OO =O000OOO0000O0O000 *2.0 #line:116
		OOO00OO0O0OO0O0O0 =(OD2 /2.0 )+2.0 #line:118
		OO0000000O000OO0O =(OD2 /2.0 )*1.1 #line:119
		OOOO00OOO0OOO0O0O =(O0OO00O00O0O0OO00 -O0OO000O0OO0O0OOO )*1.2 #line:120
		O0O0O0OOO0OOO0O00 =(OD2 +30.0 )/2.0 #line:121
		OO0OOOO0O0OOOOOO0 =O0OO000O0OO0O0OOO #line:122
		OOO0O0OOOOOO00OOO =CYLINDER (O0O0OO0OOOOO0OO00 ,R =O0OO0O0O0O0O00OOO ,H =OO0OOOOOOOO00O0OO ).rotateY (-90 ).translate ((OO0OOOOOOOO00O0OO /2.0 ,0 ,0 ))#line:124
		OO0O00OOOOOOOO000 =CYLINDER (O0O0OO0OOOOO0OO00 ,R =OO0000000O000OO0O *1.4 ,H =OO0OOOO0O0OOOOOO0 ).rotateY (-180 )#line:125
		OOO0O0OOOOOO00OOO .uniteWith (OO0O00OOOOOOOO000 )#line:126
		OO0O00OOOOOOOO000 .erase ()#line:127
		OO0OOOOO0OO0OO0O0 =CONE (O0O0OO0OOOOO0OO00 ,R1 =OOOOOOO0OOO0000O0 ,R2 =O000OOOOO0O00O0O0 /2.0 ,H =O0O0O0OOO0OOOO000 *0.20 ).rotateY (-90 ).translate ((O00O0OOOOOO00OO00 /2.0 ,0 ,0 ))#line:130
		O00000O0000O0OO0O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =O000OOOOO0O00O0O0 /2.0 ,H =O0O0O0OOO0OOOO000 *0.70 ).rotateY (-90 ).translate (((O00O0OOOOOO00OO00 /2.0 )-O0O0O0OOO0OOOO000 *0.20 ,0 ,0 ))#line:131
		O0OOO0O00OOOOOOOO =CONE (O0O0OO0OOOOO0OO00 ,R1 =O000OOOOO0O00O0O0 /2.0 ,R2 =O0OO0O0O0O0O00OOO *1.1 ,H =O0O0O0OOO0OOOO000 *0.10 ).rotateY (-90 ).translate (((O00O0OOOOOO00OO00 /2.0 )-O0O0O0OOO0OOOO000 *0.90 ,0 ,0 ))#line:132
		for O0OO000O0O000OOOO in [O00000O0000O0OO0O ,O0OOO0O00OOOOOOOO ]:#line:133
		    OO0OOOOO0OO0OO0O0 .uniteWith (O0OO000O0O000OOOO )#line:134
		    O0OO000O0O000OOOO .erase ()#line:135
		O0000O0OO00O000O0 =CONE (O0O0OO0OOOOO0OO00 ,R1 =OOOOOOO0OOO0000O0 ,R2 =O000OOOOO0O00O0O0 /2.0 ,H =O0O0O0OOO0OOOO000 *0.20 ).rotateY (-90 ).translate ((O00O0OOOOOO00OO00 /2.0 ,0 ,0 ))#line:137
		OO000O0000OO0O0OO =CYLINDER (O0O0OO0OOOOO0OO00 ,R =O000OOOOO0O00O0O0 /2.0 ,H =O0O0O0OOO0OOOO000 *0.70 ).rotateY (-90 ).translate (((O00O0OOOOOO00OO00 /2.0 )-O0O0O0OOO0OOOO000 *0.20 ,0 ,0 ))#line:138
		O0OO000O0O0OOO000 =CONE (O0O0OO0OOOOO0OO00 ,R1 =O000OOOOO0O00O0O0 /2.0 ,R2 =O0OO0O0O0O0O00OOO *1.1 ,H =O0O0O0OOO0OOOO000 *0.10 ).rotateY (-90 ).translate (((O00O0OOOOOO00OO00 /2.0 )-O0O0O0OOO0OOOO000 *0.90 ,0 ,0 ))#line:139
		for O0OO000O0O000OOOO in [OO000O0000OO0O0OO ,O0OO000O0O0OOO000 ]:#line:140
		    O0000O0OO00O000O0 .uniteWith (O0OO000O0O000OOOO )#line:141
		    O0OO000O0O000OOOO .erase ()#line:142
		O0000O0OO00O000O0 .rotateY (180 )#line:143
		OO0O00O00O000O0OO =CONE (O0O0OO0OOOOO0OO00 ,R1 =OOO00OO0O0OO0O0O0 ,R2 =O0O0O0OOO0OOO0O00 ,H =OOOO00OOO0OOO0O0O *0.20 ).rotateY (-90 ).translate ((O0OO00O00O0O0OO00 ,0 ,0 ))#line:145
		O0000O00OOO0O0O0O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =O0O0O0OOO0OOO0O00 ,H =OOOO00OOO0OOO0O0O *0.70 ).rotateY (-90 ).translate ((O0OO00O00O0O0OO00 -OOOO00OOO0OOO0O0O *0.20 ,0 ,0 ))#line:146
		OOO00OOO0O00OOO0O =CONE (O0O0OO0OOOOO0OO00 ,R1 =O0O0O0OOO0OOO0O00 ,R2 =OO0000000O000OO0O *1.1 ,H =OOOO00OOO0OOO0O0O *0.10 ).rotateY (-90 ).translate ((O0OO00O00O0O0OO00 -OOOO00OOO0OOO0O0O *0.90 ,0 ,0 ))#line:147
		for O0OO000O0O000OOOO in [O0000O00OOO0O0O0O ,OOO00OOO0O00OOO0O ]:#line:148
		    OO0O00O00O000O0OO .uniteWith (O0OO000O0O000OOOO )#line:149
		    O0OO000O0O000OOOO .erase ()#line:150
		OO0O00O00O000O0OO .rotateY (90 )#line:151
		if CT ==0 :#line:153
			O0000O00OO0O00OO0 =[O0000O0OO00O000O0 ,OO0OOOOO0OO0OO0O0 ,OO0O00O00O000O0OO ]#line:154
		elif CT ==1 :#line:155
			O0000O00OO0O00OO0 =[OO0OOOOO0OO0OO0O0 ,OO0O00O00O000O0OO ]#line:156
			O0000O0OO00O000O0 .erase ()#line:157
		elif CT ==2 :#line:158
			O0000O00OO0O00OO0 =[O0000O0OO00O000O0 ,OO0O00O00O000O0OO ]#line:159
			OO0OOOOO0OO0OO0O0 .erase ()#line:160
		elif CT ==3 :#line:161
			O0000O00OO0O00OO0 =[O0000O0OO00O000O0 ,OO0OOOOO0OO0OO0O0 ]#line:162
			OO0O00O00O000O0OO .erase ()#line:163
		for O0OO000O0O000OOOO in O0000O00OO0O00OO0 :#line:165
		    OOO0O0OOOOOO00OOO .uniteWith (O0OO000O0O000OOOO )#line:166
		    O0OO000O0O000OOOO .erase ()#line:167
		OO0OOOO0000OO00OO =CYLINDER (O0O0OO0OOOOO0OO00 ,R =OD1 /2.0 ,H =O00O0OOOOOO00OO00 ).rotateY (-90 ).translate ((O00O0OOOOOO00OO00 /2.0 ,0 ,0 ))#line:169
		OO000OO00OO000O0O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =OD2 /2.0 ,H =O0OO00O00O0O0OO00 ).rotateY (180 )#line:170
		for O0OO000O0O000OOOO in [OO0OOOO0000OO00OO ,OO000OO00OO000O0O ]:#line:172
		    OOO0O0OOOOOO00OOO .subtractFrom (O0OO000O0O000OOOO )#line:173
		    O0OO000O0O000OOOO .erase ()#line:174
		O0O0OO0OOOOO0OO00 .setPoint ((O000OOO0000O0O000 ,0 ,0 ),(1 ,0 ,0 ))#line:176
		O0O0OO0OOOOO0OO00 .setPoint ((-O000OOO0000O0O000 ,0 ,0 ),(-1 ,0 ,0 ))#line:177
		O0O0OO0OOOOO0OO00 .setPoint ((0 ,0 ,-O0OO000O0OO0O0OOO ),(0 ,0 ,-1 ))#line:178
	elif 76 <=OD1 <=168 :#line:188
		O000OO0O0OOO0O0OO =O00O0OOOOOO00OO00 /2.0 -34.90 #line:190
		OO00O00O00000000O =O0OO000O0OO0O0OOO -34.90 #line:191
		O00O00OO00O0O000O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =OD1 /2.0 ,H =O00O0OOOOOO00OO00 ).rotateY (-90 ).translate ((O00O0OOOOOO00OO00 /2.0 ,0 ,0 ))#line:193
		O00O0OOOOO00O0O0O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =OD2 /2.0 ,H =O0OO000O0OO0O0OOO ).rotateX (90 )#line:194
		O00O000OO0O00O000 =TORUS (O0O0OO0OOOOO0OO00 ,R1 =OD1 /2.0 -2.0 ,R2 =4.0 ).rotateY (90 ).translate ((O000OO0O0OOO0O0OO ,0 ,0 ))#line:196
		O00O00O0OOO00OO00 =TORUS (O0O0OO0OOOOO0OO00 ,R1 =OD1 /2.0 -2.0 ,R2 =4.0 ).rotateY (90 ).translate ((-O000OO0O0OOO0O0OO ,0 ,0 ))#line:197
		O00OOOO0OOO0OO000 =TORUS (O0O0OO0OOOOO0OO00 ,R1 =OD2 /2.0 -2.0 ,R2 =4.0 ).rotateY (90 ).rotateZ (90 ).translate ((0 ,-OO00O00O00000000O ,0 ))#line:198
		for O0OO000O0O000OOOO in [O00O0OOOOO00O0O0O ,O00O000OO0O00O000 ,O00O00O0OOO00OO00 ,O00OOOO0OOO0OO000 ]:#line:200
		    O00O00OO00O0O000O .uniteWith (O0OO000O0O000OOOO )#line:201
		    O0OO000O0O000OOOO .erase ()#line:202
		OO0OOOO0000OO00OO =CYLINDER (O0O0OO0OOOOO0OO00 ,R =(OD1 /2.0 )-2 ,H =O00O0OOOOOO00OO00 ).rotateY (-90 ).translate ((O00O0OOOOOO00OO00 /2.0 ,0 ,0 ))#line:204
		OO000OO00OO000O0O =CYLINDER (O0O0OO0OOOOO0OO00 ,R =(OD2 /2.0 )-2 ,H =O0OO000O0OO0O0OOO ).rotateX (90 )#line:205
		for O0OO000O0O000OOOO in [OO0OOOO0000OO00OO ,OO000OO00OO000O0O ]:#line:206
		    O00O00OO00O0O000O .subtractFrom (O0OO000O0O000OOOO )#line:207
		    O0OO000O0O000OOOO .erase ()#line:208
		O0O0OO0OOOOO0OO00 .setPoint ((O000OOO0000O0O000 ,0 ,0 ),(1 ,0 ,0 ))#line:223
		O0O0OO0OOOOO0OO00 .setPoint ((-O000OOO0000O0O000 ,0 ,0 ),(-1 ,0 ,0 ))#line:224
		O0O0OO0OOOOO0OO00 .setPoint ((0 ,-O0OO000O0OO0O0OOO ,0 ),(0 ,-1 ,0 ))#line:225
