# 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 .divsub .cbolt6_001 import *#line:13
from varmain .divsub .cnut6_001 import *#line:14
if not os .path .dirname (os .path .abspath (__file__ ))in sys .path :#line:18
			   sys .path .append (os .path .dirname (os .path .abspath (__file__ )))#line:19
from AX_BOXF import *#line:22
from AX_NUTS import *#line:23
@activate (Group ="Coupling",TooltipShort ="MALE THREADED NUT",TooltipLong ="MALE THREADED NUT",LengthUnit ="mm",Ports ="2")#line:26
@group ("MainDimensions")#line:27
@param (OD =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:28
@param (C =LENGTH ,TooltipShort ="Thread Dia",TooltipLong ="Thread Dia")#line:29
def AX_P1_MALE_TH_NUT (O0O00000OO00OO0OO ,OD =16.5 ,C =0.5 ,**OO0O0O0OOOOO000O0 ):#line:34
	if C ==0.5 :#line:36
		O0OO0O0OO0000OOO0 =21.0 #line:37
	elif C ==0.75 :#line:38
		O0OO0O0OO0000OOO0 =26.44 #line:39
	elif C ==1.0 :#line:40
		O0OO0O0OO0000OOO0 =33.25 #line:41
	elif C ==1.25 :#line:42
		O0OO0O0OO0000OOO0 =41.91 #line:43
	elif C ==1.5 :#line:44
		O0OO0O0OO0000OOO0 =47.80 #line:45
	elif C ==2.0 :#line:46
		O0OO0O0OO0000OOO0 =59.61 #line:47
	elif C ==2.5 :#line:48
		O0OO0O0OO0000OOO0 =75.18 #line:49
	if OD ==16.5 and C ==0.5 :#line:52
		O0000O000O0OO0OOO =23.0 #line:53
		OOOOO0O0O0O00O0OO =41.0 #line:54
		OOO0OO00OOOO00OO0 =9.5 #line:55
	elif OD ==25.0 and C ==0.5 :#line:56
		O0000O000O0OO0OOO =27.0 #line:57
		OOOOO0O0O0O00O0OO =43.0 #line:58
		OOO0OO00OOOO00OO0 =14.0 #line:59
	elif OD ==25.0 and C ==0.75 :#line:60
		O0000O000O0OO0OOO =27.0 #line:61
		OOOOO0O0O0O00O0OO =45.0 #line:62
		OOO0OO00OOOO00OO0 =14.6 #line:63
	elif OD ==25.0 and C ==1.0 :#line:64
		O0000O000O0OO0OOO =36.0 #line:65
		OOOOO0O0O0O00O0OO =49.0 #line:66
		OOO0OO00OOOO00OO0 =13.7 #line:67
	elif OD ==40.0 and C ==1.0 :#line:68
		O0000O000O0OO0OOO =41.0 #line:69
		OOOOO0O0O0O00O0OO =53.0 #line:70
		OOO0OO00OOOO00OO0 =19.7 #line:71
	elif OD ==40.0 and C ==1.25 :#line:72
		O0000O000O0OO0OOO =50.0 #line:73
		OOOOO0O0O0O00O0OO =61.0 #line:74
		OOO0OO00OOOO00OO0 =19.4 #line:75
	elif OD ==40.0 and C ==1.5 :#line:76
		O0000O000O0OO0OOO =50.0 #line:77
		OOOOO0O0O0O00O0OO =61.0 #line:78
		OOO0OO00OOOO00OO0 =19.4 #line:79
	elif OD ==40.0 and C ==2.0 :#line:80
		O0000O000O0OO0OOO =60.0 #line:81
		OOOOO0O0O0O00O0OO =65.0 #line:82
		OOO0OO00OOOO00OO0 =19.1 #line:83
	elif OD ==50.0 and C ==1.5 :#line:84
		O0000O000O0OO0OOO =65.0 #line:85
		OOOOO0O0O0O00O0OO =79.0 #line:86
		OOO0OO00OOOO00OO0 =15.1 #line:87
	elif OD ==50.0 and C ==2.0 :#line:88
		O0000O000O0OO0OOO =65.0 #line:89
		OOOOO0O0O0O00O0OO =85.0 #line:90
		OOO0OO00OOOO00OO0 =14.8 #line:91
	elif OD ==63.0 and C ==2.0 :#line:92
		O0000O000O0OO0OOO =80.0 #line:93
		OOOOO0O0O0O00O0OO =83.0 #line:94
		OOO0OO00OOOO00OO0 =12.8 #line:95
	elif OD ==63.0 and C ==2.5 :#line:96
		O0000O000O0OO0OOO =80.0 #line:97
		OOOOO0O0O0O00O0OO =87.0 #line:98
		OOO0OO00OOOO00OO0 =11.5 #line:99
	OOOOO0O0000O0O0O0 =OOOOO0O0O0O00O0OO *(3 /7 )#line:102
	OO0O000O0O00OOO00 =OOOOO0O0O0O00O0OO *(2 /7 )#line:103
	O000OOOOO0O0000O0 =OOOOO0O0O0O00O0OO -OO0O000O0O00OOO00 -OOOOO0O0000O0O0O0 #line:104
	O0O0O0O0O0OO000OO =O0000O000O0OO0OOO #line:107
	O0O000O0OOO00000O =O0O0O0O0O0OO000OO /math .sqrt (3 )#line:109
	O00OOO000O0OOO000 =2 *O0O000O0OOO00000O #line:111
	OOO0O0000OOOO0O00 =CBOLT6_001 (O0O00000OO00OO0OO ,D =O0OO0O0OO0000OOO0 ,L =O000OOOOO0O0000O0 ,W =O0000O000O0OO0OOO ,H =OO0O000O0O00OOO00 ).rotateY (90 ).translate ((0 ,0 ,O000OOOOO0O0000O0 ))#line:113
	O0OOOOOO0OOOO0O00 =AX_NUTS (O0O00000OO00OO0OO ,D =O00OOO000O0OOO000 ,O =1.0 ,T =OO0O000O0O00OOO00 /2.0 ,F =6.0 ,FI =0.0 ).rotateY (90 ).translate ((0 ,0 ,O000OOOOO0O0000O0 +OO0O000O0O00OOO00 /2.0 ))#line:114
	O000OO0O0OO000O00 =AX_NUTS (O0O00000OO00OO0OO ,D =O00OOO000O0OOO000 *1.4 ,O =1.0 ,T =OOOOO0O0000O0O0O0 ,F =6.0 ,FI =0.0 ).rotateY (90 ).rotateZ (60 ).translate ((0 ,0 ,O000OOOOO0O0000O0 +OO0O000O0O00OOO00 ))#line:115
	for OO0O0OOOOO0O00O00 in [O0OOOOOO0OOOO0O00 ,O000OO0O0OO000O00 ]:#line:116
		OOO0O0000OOOO0O00 .uniteWith (OO0O0OOOOO0O00O00 )#line:117
		OO0O0OOOOO0O00O00 .erase ()#line:118
	OO0000OOO000O00OO =CYLINDER (O0O00000OO00OO0OO ,R =(O00OOO000O0OOO000 *1.5 )/2.0 ,H =OOOOO0O0O0O00O0OO ,O =(O00OOO000O0OOO000 *1.3 )/2.0 )#line:120
	OOO0O0000OOOO0O00 .subtractFrom (OO0000OOO000O00OO )#line:121
	OO0000OOO000O00OO .erase ()#line:122
	OOO00OO0OO00O0OO0 =CYLINDER (O0O00000OO00OO0OO ,R =((O00OOO000O0OOO000 *1.3 )/2.0 )-5 ,H =OOOOO0O0O0O00O0OO ).translate ((0 ,0 ,O000OOOOO0O0000O0 +OO0O000O0O00OOO00 +1 ))#line:124
	OOO0O0000OOOO0O00 .subtractFrom (OOO00OO0OO00O0OO0 )#line:125
	OOO00OO0OO00O0OO0 .erase ()#line:126
	O0OOO0OO000O00O00 =CYLINDER (O0O00000OO00OO0OO ,R =OD /2.0 ,H =OOOOO0O0000O0O0O0 -1 ,O =(OD /2.0 )-1 ).translate ((0 ,0 ,O000OOOOO0O0000O0 +OO0O000O0O00OOO00 +1 ))#line:128
	OOO0O0000OOOO0O00 .uniteWith (O0OOO0OO000O00O00 )#line:129
	O0OOO0OO000O00O00 .erase ()#line:130
	if O0OO0O0OO0000OOO0 <OD :#line:132
		O0OO0OO00O0OOO0O0 =(O0OO0O0OO0000OOO0 /2.0 )-2 #line:133
	else :#line:134
		O0OO0OO00O0OOO0O0 =(OD /2.0 )-2 #line:135
	O00O00OOO0O0O0OOO =CYLINDER (O0O00000OO00OO0OO ,R =O0OO0OO00O0OOO0O0 ,H =OOOOO0O0O0O00O0OO )#line:136
	OOO0O0000OOOO0O00 .subtractFrom (O00O00OOO0O0O0OOO )#line:137
	O00O00OOO0O0O0OOO .erase ()#line:138
	O0O00000OO00OO0OO .setPoint ((0 ,0 ,OOOOO0O0O0O00O0OO -OOO0OO00OOOO00OO0 ),(0 ,0 ,1 ))#line:161
	O0O00000OO00OO0OO .setPoint ((0 ,0 ,0 ),(0 ,0 ,-1 ))#line:162
