# 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 .arcsub .cpbsub .cpb_plpl import *#line:13
if not os .path .dirname (os .path .abspath (__file__ ))in sys .path :#line:20
			   sys .path .append (os .path .dirname (os .path .abspath (__file__ )))#line:21
from AX_BOXF import *#line:24
@activate (Group ="Elbow",TooltipShort ="Elbow 45",TooltipLong ="Fittings Union Elbow 45",LengthUnit ="mm",Ports ="2")#line:27
@group ("MainDimensions")#line:28
@param (DN =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:29
@param (CT =LENGTH ,TooltipShort ="Connection Type",TooltipLong ="Connection Type")#line:32
def AX_P1_ELBOW_45 (O00O0OOOOO00O000O ,DN =25 ,CT =0 ,**O0O0OOO0O00OO0O0O ):#line:43
	if DN ==25 :#line:46
		O000OOO0O0OOOO0O0 =25.0 #line:47
		OOOOOOOO00000000O =44.5 #line:48
		OOOOO0O000000O0O0 =61.5 #line:49
		OOO00000O0OOOOO00 =32.5 #line:50
	elif DN ==40 :#line:51
		O000OOO0O0OOOO0O0 =40.0 #line:52
		OOOOOOOO00000000O =67.0 #line:53
		OOOOO0O000000O0O0 =90.0 #line:54
		OOO00000O0OOOOO00 =45.0 #line:55
	elif DN ==50 :#line:56
		O000OOO0O0OOOO0O0 =50.0 #line:57
		OOOOOOOO00000000O =80.0 #line:58
		OOOOO0O000000O0O0 =98.0 #line:59
		OOO00000O0OOOOO00 =38.0 #line:60
	elif DN ==63 :#line:61
		O000OOO0O0OOOO0O0 =63.0 #line:62
		OOOOOOOO00000000O =91.0 #line:63
		OOOOO0O000000O0O0 =100.0 #line:64
		OOO00000O0OOOOO00 =37.0 #line:65
	elif DN ==76 :#line:68
		O000OOO0O0OOOO0O0 =76.0 #line:69
		O000OO00000O0O0O0 =236.0 #line:70
		O0O0OO00O0OO00O00 =151.0 #line:71
		OOO00000O0OOOOO00 =122.0 #line:72
		OOO0OO00O00O000OO =87.10 #line:73
	elif DN ==100 :#line:74
		O000OOO0O0OOOO0O0 =100.0 #line:75
		O000OO00000O0O0O0 =271.0 #line:76
		O0O0OO00O0OO00O00 =184.0 #line:77
		OOO00000O0OOOOO00 =138.0 #line:78
		OOO0OO00O00O000OO =103.83 #line:79
	elif DN ==168 :#line:80
		O000OOO0O0OOOO0O0 =168.0 #line:81
		O000OO00000O0O0O0 =294.0 #line:82
		O0O0OO00O0OO00O00 =241.0 #line:83
		OOO00000O0OOOOO00 =137.0 #line:84
		OOO0OO00O00O000OO =101.0 #line:85
	if DN <76 :#line:90
		OOOOOOOOOO00O0000 =(O000OOO0O0OOOO0O0 /2.0 )+2.0 #line:92
		OOOOO0O0000OOOO0O =OOOOO0O000000O0O0 -(OOO00000O0OOOOO00 /2.0 )#line:93
		O0OO000O0O00O00O0 =(O000OOO0O0OOOO0O0 /2.0 )*1.1 #line:94
		OO0O0O0O0000O0O00 =CPB_PLPL (O00O0OOOOO00O000O ,D =O0OO000O0O00O00O0 *2.0 ,D2 =0.0 ,R =1 ,A =45.0 ,OF =-1.0 ,L1 =OOO00000O0OOOOO00 ,L2 =OOO00000O0OOOOO00 )#line:97
		OO0OO0O00000OO0OO =CONE (O00O0OOOOO00O000O ,R1 =OOOOOOOOOO00O0000 ,R2 =OOOOOOOO00000000O /2.0 ,H =OOOOO0O0000OOOO0O *0.30 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 ,0 ,0 ))#line:99
		OOOO0O00O00O00O0O =CYLINDER (O00O0OOOOO00O000O ,R =OOOOOOOO00000000O /2.0 ,H =OOOOO0O0000OOOO0O *0.60 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 -OOOOO0O0000OOOO0O *0.30 ,0 ,0 ))#line:100
		OO000O00O0000000O =CONE (O00O0OOOOO00O000O ,R1 =OOOOOOOO00000000O /2.0 ,R2 =O0OO000O0O00O00O0 ,H =OOOOO0O0000OOOO0O *0.10 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 -OOOOO0O0000OOOO0O *0.90 ,0 ,0 ))#line:101
		for O0O000O0O0OO0OO00 in [OOOO0O00O00O00O0O ,OO000O00O0000000O ]:#line:102
		    OO0OO0O00000OO0OO .uniteWith (O0O000O0O0OO0OO00 )#line:103
		    O0O000O0O0OO0OO00 .erase ()#line:104
		OO0O000O000O00O0O =CONE (O00O0OOOOO00O000O ,R1 =OOOOOOOOOO00O0000 ,R2 =OOOOOOOO00000000O /2.0 ,H =OOOOO0O0000OOOO0O *0.30 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 ,0 ,0 ))#line:107
		OO000OO0OO0O0O00O =CYLINDER (O00O0OOOOO00O000O ,R =OOOOOOOO00000000O /2.0 ,H =OOOOO0O0000OOOO0O *0.60 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 -OOOOO0O0000OOOO0O *0.30 ,0 ,0 ))#line:108
		OOOO00O000OOOO0OO =CONE (O00O0OOOOO00O000O ,R1 =OOOOOOOO00000000O /2.0 ,R2 =O0OO000O0O00O00O0 ,H =OOOOO0O0000OOOO0O *0.10 ).rotateY (-90 ).translate ((OOOOO0O000000O0O0 -OOOOO0O0000OOOO0O *0.90 ,0 ,0 ))#line:109
		for O0O000O0O0OO0OO00 in [OO000OO0OO0O0O00O ,OOOO00O000OOOO0OO ]:#line:110
		    OO0O000O000O00O0O .uniteWith (O0O000O0O0OO0OO00 )#line:111
		    O0O000O0O0OO0OO00 .erase ()#line:112
		OO0O000O000O00O0O .rotateZ (135 )#line:113
		if CT ==0 :#line:115
			O00O0OO0O00O0OO00 =[OO0O000O000O00O0O ,OO0OO0O00000OO0OO ]#line:116
		elif CT ==1 :#line:117
			O00O0OO0O00O0OO00 =[OO0OO0O00000OO0OO ]#line:118
			OO0O000O000O00O0O .erase ()#line:119
		elif CT ==2 :#line:120
			O00O0OO0O00O0OO00 =[OO0O000O000O00O0O ]#line:121
			OO0OO0O00000OO0OO .erase ()#line:122
		for O0O000O0O0OO0OO00 in O00O0OO0O00O0OO00 :#line:124
		    OO0O0O0O0000O0O00 .uniteWith (O0O000O0O0OO0OO00 )#line:125
		    O0O000O0O0OO0OO00 .erase ()#line:126
		O00O00OOOO00OOO0O =CYLINDER (O00O0OOOOO00O000O ,R =O000OOO0O0OOOO0O0 /2.0 ,H =OOOOO0O000000O0O0 -OOO00000O0OOOOO00 ).rotateY (90 ).translate ((OOO00000O0OOOOO00 ,0 ,0 ))#line:128
		OO0O0O0O0000O0O00 .subtractFrom (O00O00OOOO00OOO0O )#line:129
		O00O00000OOOOO00O =CYLINDER (O00O0OOOOO00O000O ,R =O000OOO0O0OOOO0O0 /2.0 ,H =OOOOO0O000000O0O0 -OOO00000O0OOOOO00 ).rotateY (90 ).translate ((OOO00000O0OOOOO00 ,0 ,0 )).rotateZ (135 )#line:130
		OO0O0O0O0000O0O00 .subtractFrom (O00O00000OOOOO00O )#line:131
		O00O0OOOOO00O000O .setPoint ((OOO00000O0OOOOO00 ,0 ,0 ),(1 ,0 ,0 ))#line:133
		O000OOOOO0OOOO00O =math .radians (45 )#line:135
		O0OO00OOO00000000 =OOO00000O0OOOOO00 #line:136
		OOO0OO00O0O000000 =O0OO00OOO00000000 *math .sin (O000OOOOO0OOOO00O )#line:137
		O000O0000O00OOOOO =math .sqrt (O0OO00OOO00000000 **2 -OOO0OO00O0O000000 **2 )#line:138
		O00O0OOOOO00O000O .setPoint ((-OOO0OO00O0O000000 ,O000O0000O00OOOOO ,0 ),(-1 ,1 ,0 ))#line:139
	elif DN >=76 :#line:142
		O0OO000O0O00O00O0 =(O000OOO0O0OOOO0O0 /2.0 )*1.1 #line:144
		OOOO00OOOO0OOO0OO =OOO00000O0OOOOO00 -34.90 #line:145
		O0O0O0O0OO0OOO00O =O000OOO0O0OOOO0O0 /2.0 +1.0 #line:146
		OO0O0O0O0000O0O00 =CPB_PLPL (O00O0OOOOO00O000O ,D =O0O0O0O0OO0OOO00O *2.0 ,D2 =0.0 ,R =1 ,A =45.0 ,OF =-1.0 ,L1 =OOO00000O0OOOOO00 ,L2 =OOO00000O0OOOOO00 )#line:148
		O0000OO000O0OO000 =TORUS (O00O0OOOOO00O000O ,R1 =O0O0O0O0OO0OOO00O -3.0 ,R2 =4.0 ).rotateY (90 ).translate ((OOOO00OOOO0OOO0OO ,0 ,0 ))#line:150
		OOO0OOOOO0OO0OOO0 =TORUS (O00O0OOOOO00O000O ,R1 =O0O0O0O0OO0OOO00O -3.0 ,R2 =4.0 ).rotateY (90 ).translate ((OOOO00OOOO0OOO0OO ,0 ,0 )).rotateZ (135 )#line:151
		for O0O000O0O0OO0OO00 in [O0000OO000O0OO000 ,OOO0OOOOO0OO0OOO0 ]:#line:153
		    OO0O0O0O0000O0O00 .uniteWith (O0O000O0O0OO0OO00 )#line:154
		    O0O000O0O0OO0OO00 .erase ()#line:155
		O00O00OOOO00OOO0O =CYLINDER (O00O0OOOOO00O000O ,R =O000OOO0O0OOOO0O0 /2.0 ,H =OOO00000O0OOOOO00 /2.0 ).rotateY (90 ).translate ((OOO00000O0OOOOO00 /2.0 ,0 ,0 ))#line:157
		OO0O0O0O0000O0O00 .subtractFrom (O00O00OOOO00OOO0O )#line:158
		O00O00000OOOOO00O =CYLINDER (O00O0OOOOO00O000O ,R =O000OOO0O0OOOO0O0 /2.0 ,H =OOO00000O0OOOOO00 /2.0 ).rotateY (90 ).translate ((OOO00000O0OOOOO00 /2.0 ,0 ,0 )).rotateZ (135 )#line:159
		OO0O0O0O0000O0O00 .subtractFrom (O00O00000OOOOO00O )#line:160
		O00O0OOOOO00O000O .setPoint ((OOO00000O0OOOOO00 ,0 ,0 ),(1 ,0 ,0 ))#line:162
		O000OOOOO0OOOO00O =math .radians (45 )#line:164
		O0OO00OOO00000000 =OOO00000O0OOOOO00 #line:165
		OOO0OO00O0O000000 =O0OO00OOO00000000 *math .sin (O000OOOOO0OOOO00O )#line:166
		O000O0000O00OOOOO =math .sqrt (O0OO00OOO00000000 **2 -OOO0OO00O0O000000 **2 )#line:167
		O00O0OOOOO00O000O .setPoint ((-OOO0OO00O0O000000 ,O000O0000O00OOOOO ,0 ),(-1 ,1 ,0 ))#line:168
