# 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
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
from AX_NUTS import *#line:22
@activate (Group ="Coupling",TooltipShort ="MALE ADAPTOR - BSP TAPER",TooltipLong ="MALE ADAPTOR - BSP TAPER",LengthUnit ="mm",Ports ="2")#line:25
@group ("MainDimensions")#line:26
@param (OD =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:27
@param (C =LENGTH ,TooltipShort ="Thread Diameter",TooltipLong ="Thread Diameter")#line:28
def AX_P1_MALE_TH_ADAPTOR (OO0OO00OO000OO000 ,OD =76.0 ,C =2.5 ,**OO0OO0OO0000O0O0O ):#line:33
	if OD ==16.5 and C ==0.5 :#line:35
		OO00OOO0OO0O00OO0 =21.0 #line:36
		O0OO0OO0OO0O00OO0 =42.0 #line:37
		O0O0000O00OOO0O00 =5.0 #line:38
	elif OD ==25 and C ==0.5 :#line:40
		OO00OOO0OO0O00OO0 =21.0 #line:41
		O0OO0OO0OO0O00OO0 =49.0 #line:42
		O0O0000O00OOO0O00 =7.0 #line:43
	elif OD ==25 and C ==0.75 :#line:45
		OO00OOO0OO0O00OO0 =26.44 #line:46
		O0OO0OO0OO0O00OO0 =49.0 #line:47
		O0O0000O00OOO0O00 =7.0 #line:48
	elif OD ==25 and C ==1.0 :#line:50
		OO00OOO0OO0O00OO0 =33.25 #line:51
		O0OO0OO0OO0O00OO0 =52.0 #line:52
		O0O0000O00OOO0O00 =7.0 #line:53
	elif OD ==40 and C ==1.25 :#line:55
		OO00OOO0OO0O00OO0 =41.91 #line:56
		O0OO0OO0OO0O00OO0 =73.7 #line:57
		O0O0000O00OOO0O00 =8.0 #line:58
	elif OD ==40 and C ==1.5 :#line:60
		OO00OOO0OO0O00OO0 =47.8 #line:61
		O0OO0OO0OO0O00OO0 =75.7 #line:62
		O0O0000O00OOO0O00 =10.0 #line:63
	elif OD ==76 and C ==2.5 :#line:65
		OO00OOO0OO0O00OO0 =75.18 #line:66
		O0OO0OO0OO0O00OO0 =125 #line:67
		O0O0000O00OOO0O00 =20 #line:68
	elif OD ==76 and C ==3.0 :#line:69
		OO00OOO0OO0O00OO0 =87.88 #line:70
		O0OO0OO0OO0O00OO0 =133 #line:71
		O0O0000O00OOO0O00 =25 #line:72
	O00OO0O0OO0OOO000 =34.90 #line:74
	O00O00O00OOO0O0O0 =(OD /2.0 )+1 #line:75
	O00OOO0OO000OO000 =O0OO0OO0OO0O00OO0 *0.80 #line:76
	O0O0OO0OO0O0OO000 =O0OO0OO0OO0O00OO0 -O00OOO0OO000OO000 #line:77
	O0O0OOO0OOOO0OOOO =OO00OOO0OO0O00OO0 *1.2 #line:79
	OOO0O0000OOO0O00O =O0O0OOO0OOOO0OOOO /0.9238799999999999 #line:80
	OOO00000000OO0OOO =CYLINDER (OO0OO00OO000OO000 ,R =OD /2.0 ,H =O00OOO0OO000OO000 ).rotateY (90 ).translate ((-O00OOO0OO000OO000 /2.0 -O0O0OO0OO0O0OO000 ,0 ,0 ))#line:82
	if 16.5 <=OD <=40 :#line:83
		OOO0O0O00000OOOOO =TORUS (OO0OO00OO000OO000 ,R1 =2 ,R2 =0.5 ).rotateY (90 ).translate ((-(O0OO0OO0OO0O00OO0 /2.0 )+O00OO0O0OO0OOO000 ,0 ,0 ))#line:84
	else :#line:85
		OOO0O0O00000OOOOO =TORUS (OO0OO00OO000OO000 ,R1 =O00O00O00OOO0O0O0 -2.0 ,R2 =4.0 ).rotateY (90 ).translate ((-(O0OO0OO0OO0O00OO0 /2.0 )+O00OO0O0OO0OOO000 ,0 ,0 ))#line:86
	O000OOO0O00OO0O0O =AX_NUTS (OO0OO00OO000OO000 ,D =OOO0O0000OOO0O00O ,O =0 ,T =O0O0000O00OOO0O00 ,F =8.0 ,FI =.0 ).translate ((O0OO0OO0OO0O00OO0 /2.0 -O0O0OO0OO0O0OO000 /2.0 -O0O0OO0OO0O0OO000 ,0 ,0 ))#line:87
	if OO00OOO0OO0O00OO0 >OD :#line:90
		O0000OO0O00O00000 =OO00OOO0OO0O00OO0 +1 #line:91
	else :O0000OO0O00O00000 =OD #line:92
	O00OO000OOOO00O0O =CONE (OO0OO00OO000OO000 ,R1 =O0000OO0O00O00000 /2.0 ,R2 =OO00OOO0OO0O00OO0 /2.0 ,H =O0O0OO0OO0O0OO000 ).rotateY (90 ).translate ((O0O0OO0OO0O0OO000 ,0 ,0 ))#line:94
	for O0OO0OO0O0000O0OO in [OOO0O0O00000OOOOO ,O000OOO0O00OO0O0O ,O00OO000OOOO00O0O ]:#line:96
	    OOO00000000OO0OOO .uniteWith (O0OO0OO0O0000O0OO )#line:97
	    O0OO0OO0O0000O0OO .erase ()#line:98
	OO000000OO00O0OOO =CYLINDER (OO0OO00OO000OO000 ,R =(OD /2.0 )-2 ,H =O0OO0OO0OO0O00OO0 ).rotateY (90 ).translate ((-O0OO0OO0OO0O00OO0 /2.0 -O0O0OO0OO0O0OO000 /2.0 ,0 ,0 ))#line:100
	OOO00000000OO0OOO .subtractFrom (OO000000OO00O0OOO )#line:101
	OO000000OO00O0OOO .erase ()#line:102
	OO0OO00OO000OO000 .setPoint ((-O0OO0OO0OO0O00OO0 /2.0 -O0O0OO0OO0O0OO000 /2.0 ,0 ,0 ),(-1 ,0 ,0 ))#line:108
	OO0OO00OO000OO000 .setPoint ((O0OO0OO0OO0O00OO0 /2.0 -O0O0OO0OO0O0OO000 /2.0 ,0 ,0 ),(1 ,0 ,0 ))#line:109
