# 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:13
if not os .path .dirname (os .path .abspath (__file__ ))in sys .path :#line:16
			   sys .path .append (os .path .dirname (os .path .abspath (__file__ )))#line:17
from AX_BOXF import *#line:20
from AX_P1_BRACKET_FTH import *#line:21
from AX_NUTS import *#line:22
from AX_HANDLEVERS import *#line:23
@activate (Group ="Olet",TooltipShort ="QA Bracket w Ball Valve",TooltipLong ="QA Bracket w Ball Valve",LengthUnit ="mm",Ports ="2")#line:26
@group ("MainDimensions")#line:27
@param (DN =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:28
@param (C =LENGTH ,TooltipShort ="Thread Diameter",TooltipLong ="Thread Diameter")#line:29
@param (AA =LENGTH ,TooltipShort ="Rotation Angle",TooltipLong ="Rotation Angle")#line:30
def AX_P1_BRACKET_BALLVALVE (OOO0000OOOOO00O00 ,DN =25 ,C =0.5 ,AA =0 ,**O0O00OO0OO0OOO0OO ):#line:35
	if 25 <=DN <=40 :#line:37
		OO0O00O0000O0O0OO =16.5 #line:38
	elif 50 <=DN <=63 :#line:39
		OO0O00O0000O0O0OO =25.0 #line:40
	if DN ==25 and C ==0.5 :#line:43
		O0OOOOOO0O0OO0000 =40.0 #line:44
		O0OO0O0O0O00OO000 =256.0 #line:45
		O00OOOO0O0OO0OOOO =32.0 #line:46
		O0OOOO0O0O00O00O0 =155.0 #line:47
		O0OOOO000OO0O00O0 =20.95 #line:48
		O0OO000OO0O0O00OO =97.0 #line:49
	elif DN ==40 and C ==0.5 :#line:50
		O0OOOOOO0O0OO0000 =45.0 #line:51
		O0OO0O0O0O00OO000 =271.0 #line:52
		O00OOOO0O0OO0OOOO =39.0 #line:53
		O0OOOO0O0O00O00O0 =162.0 #line:54
		O0OOOO000OO0O00O0 =20.95 #line:55
		O0OO000OO0O0O00OO =104.0 #line:56
	elif DN ==40 and C ==0.75 :#line:57
		O0OOOOOO0O0OO0000 =45.0 #line:58
		O0OO0O0O0O00OO000 =304.0 #line:59
		O00OOOO0O0OO0OOOO =39.0 #line:60
		O0OOOO0O0O00O00O0 =176.0 #line:61
		O0OOOO000OO0O00O0 =26.44 #line:62
		O0OO000OO0O0O00OO =113.0 #line:63
	elif DN ==50 and C ==0.5 :#line:64
		O0OOOOOO0O0OO0000 =87.0 #line:65
		O0OO0O0O0O00OO000 =249.0 #line:66
		O00OOOO0O0OO0OOOO =46.0 #line:67
		O0OOOO0O0O00O00O0 =133.5 #line:68
		O0OOOO000OO0O00O0 =20.95 #line:69
		O0OO000OO0O0O00OO =75.0 #line:70
	elif DN ==50 and C ==0.75 :#line:71
		O0OOOOOO0O0OO0000 =94.0 #line:72
		O0OO0O0O0O00OO000 =282.0 #line:73
		O00OOOO0O0OO0OOOO =46.0 #line:74
		O0OOOO0O0O00O00O0 =147.5 #line:75
		O0OOOO000OO0O00O0 =26.44 #line:76
		O0OO000OO0O0O00OO =84.0 #line:77
	elif DN ==63 and C ==0.5 :#line:78
		O0OOOOOO0O0OO0000 =87.0 #line:79
		O0OO0O0O0O00OO000 =265.0 #line:80
		O00OOOO0O0OO0OOOO =55.0 #line:81
		O0OOOO0O0O00O00O0 =141.0 #line:82
		O0OOOO000OO0O00O0 =20.95 #line:83
		O0OO000OO0O0O00OO =82.0 #line:84
	elif DN ==63 and C ==0.75 :#line:85
		O0OOOOOO0O0OO0000 =94.0 #line:86
		O0OO0O0O0O00OO000 =297.0 #line:87
		O00OOOO0O0OO0OOOO =55.0 #line:88
		O0OOOO0O0O00O00O0 =155.0 #line:89
		O0OOOO000OO0O00O0 =26.44 #line:90
		O0OO000OO0O0O00OO =91.0 #line:91
	OOO0O00OOOO0OO000 =O0OOOO0O0O00O00O0 -O0OO000OO0O0O00OO #line:94
	O000O0OOOOO0O0000 =OOO0O00OOOO0OO000 *0.30 #line:95
	OO00O00OO0O00O000 =O0OO0O0O0O00OO000 -O00OOOO0O0OO0OOOO -O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )#line:96
	O000OO00O0O00O00O =37.5 #line:97
	if 25 <=DN <=40 :#line:99
		OOO00OO00O000O0OO =O0OOOOOO0O0OO0000 *0.80 #line:100
	else :OOO00OO00O000O0OO =O0OOOOOO0O0OO0000 *0.30 #line:101
	O000O0O00OOO0O0O0 =AX_P1_BRACKET_FTH (OOO0000OOOOO00O00 ,D1 =DN ,D2 =OO0O00O0000O0O0OO ,C =C )#line:103
	O000OOO00000O000O =CYLINDER (OOO0000OOOOO00O00 ,R =O0OOOO000OO0O00O0 /2.0 ,H =OOO0O00OOOO0OO000 ).rotateY (180 ).translate ((0 ,0 ,-O0OO000OO0O0O00OO ))#line:105
	OO0O00OOOOO000O0O =CYLINDER (OOO0000OOOOO00O00 ,R =(O0OOOO000OO0O00O0 /2.0 )*1.7 ,H =O000O0OOOOO0O0000 ).translate ((0 ,0 ,-(O000O0OOOOO0O0000 /2.0 )-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )))#line:106
	O00O000OO00O0000O =CYLINDER (OOO0000OOOOO00O00 ,R =(O0OOOO000OO0O00O0 /2.0 )*1.8 ,H =OOO0O00OOOO0OO000 *0.05 ).translate ((0 ,0 ,-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 ))#line:107
	OOOO000O00OOOO0O0 =CYLINDER (OOO0000OOOOO00O00 ,R =(O0OOOO000OO0O00O0 /2.0 )*1.85 ,H =OOO0O00OOOO0OO000 *0.08 ).translate ((0 ,0 ,-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 +OOO0O00OOOO0OO000 *0.05 ))#line:108
	O00000OO0000OOO0O =AX_NUTS (OOO0000OOOOO00O00 ,D =O0OOOO000OO0O00O0 +8.0 ,O =O0OOOO000OO0O00O0 ,T =OOO0O00OOOO0OO000 *0.09 ,F =6.0 ,FI =.0 ).rotateY (90 ).translate ((0 ,0 ,-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 +OOO0O00OOOO0OO000 *0.05 +OOO0O00OOOO0OO000 *0.08 ))#line:109
	OOO0000OOO0OO000O =CYLINDER (OOO0000OOOOO00O00 ,R =O000O0OOOOO0O0000 /2.0 ,H =OOO00OO00O000O0OO ).rotateY (90 ).translate ((0 ,0 ,-(O000O0OOOOO0O0000 /2.0 )-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 ))#line:111
	O00000O0OOOO0OOO0 =AX_HANDLEVERS (OOO0000OOOOO00O00 ,W =O0OOOO000OO0O00O0 *0.90 ,LE =OO00O00OO0O00O000 ,TH =3.0 ,HT =O0OOOOOO0O0OO0000 *0.20 ,T =1.0 ).rotateY (90 ).rotateX (AA ).translate ((OOO00OO00O000O0OO ,0 ,-(O000O0OOOOO0O0000 /2.0 )-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 ))#line:112
	OO0OOOO0O000O0O00 =AX_NUTS (OOO0000OOOOO00O00 ,D =O0OOOO000OO0O00O0 +8.0 ,O =O0OOOO000OO0O00O0 ,T =OOO0O00OOOO0OO000 *0.35 ,F =6.0 ,FI =.0 ).rotateY (90 ).translate ((0 ,0 ,-O0OOOO0O0O00O00O0 ))#line:114
	OOOO0O00O0OOOO000 =CPC (OOO0000OOOOO00O00 ,D =((O0OOOO000OO0O00O0 /2.0 )*1.7 )*2.0 ,L =OOO0O00OOOO0OO000 *0.10 ,L1 =1 ,DISP =0 ,OF =-1.0 ).rotateY (90 ).translate ((0 ,0 ,-O0OO000OO0O0O00OO -OOO0O00OOOO0OO000 *0.65 ))#line:115
	OO0O0O0OOOO000OOO =AX_NUTS (OOO0000OOOOO00O00 ,D =O0OOOO000OO0O00O0 *0.60 ,O =O0OOOO000OO0O00O0 *0.20 ,T =5 ,F =6.0 ,FI =.0 ).rotateY (180 ).translate ((OOO00OO00O000O0OO +4.0 ,0 ,-(O000O0OOOOO0O0000 /2.0 )-O0OO000OO0O0O00OO -(OOO0O00OOOO0OO000 /2.0 )+O000O0OOOOO0O0000 /2.0 ))#line:118
	for OOO0O0O0O0O0O00O0 in [OO0O00OOOOO000O0O ,O00O000OO00O0000O ,OOOO000O00OOOO0O0 ,O00000OO0000OOO0O ,OOO0000OOO0OO000O ,O00000O0OOOO0OOO0 ,OO0OOOO0O000O0O00 ,OOOO0O00O0OOOO000 ,OO0O0O0OOOO000OOO ]:#line:120
		O000OOO00000O000O .uniteWith (OOO0O0O0O0O0O00O0 )#line:121
		OOO0O0O0O0O0O00O0 .erase ()#line:122
	if 50 <=DN <=63 :#line:124
		O000OOO00000O000O .translate ((O000OO00O0O00O00O ,0 ,0 ))#line:125
	O000O0O00OOO0O0O0 .uniteWith (O000OOO00000O000O )#line:127
	O000OOO00000O000O .erase ()#line:128
	OOO0000OOOOO00O00 .setPoint ((0 ,0 ,0 ),(0 ,0 ,0 ))#line:131
	if 25 <=DN <=40 :#line:132
		OOO0000OOOOO00O00 .setPoint ((0 ,0 ,-O0OOOO0O0O00O00O0 +8.0 ),(0 ,0 ,-1 ))#line:133
	else :OOO0000OOOOO00O00 .setPoint ((O000OO00O0O00O00O ,0 ,-O0OOOO0O0O00O00O0 +10.0 ),(0 ,0 ,-1 ))#line:134
