# 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
@activate (Group ="Cross",TooltipShort ="EQUAL CROSS",TooltipLong ="EQUAL CROSS",LengthUnit ="mm",Ports ="4")#line:24
@group ("MainDimensions")#line:25
@param (OD1 =LENGTH ,TooltipShort ="Nominal Diameter",TooltipLong ="Nominal Diameter")#line:26
@param (TYP =LENGTH ,TooltipShort ="Cross Type",TooltipLong ="Cross Type")#line:27
def AX_P1_EQUAL_CROSS (OOOO0000OO00OO000 ,OD1 =40 ,TYP =0 ,**OO0OOO0O0OO0O0OO0 ):#line:35
	if TYP ==0 :#line:37
		if OD1 ==40 :#line:38
			OOOOOOOOO0OOO00O0 =252.0 #line:39
			O0O0O0O00OOO0O00O =112.0 #line:40
		elif OD1 ==50 :#line:41
			OOOOOOOOO0OOO00O0 =356.0 #line:42
			O0O0O0O00OOO0O00O =161.0 #line:43
		elif OD1 ==63 :#line:44
			OOOOOOOOO0OOO00O0 =364.0 #line:45
			O0O0O0O00OOO0O00O =167.5 #line:46
		elif OD1 ==76 :#line:47
			OOOOOOOOO0OOO00O0 =298.0 #line:48
			O0O0O0O00OOO0O00O =149.0 #line:49
		elif OD1 ==100 :#line:50
			OOOOOOOOO0OOO00O0 =322.0 #line:51
			O0O0O0O00OOO0O00O =161.0 #line:52
		elif OD1 ==168 :#line:53
			OOOOOOOOO0OOO00O0 =382.0 #line:54
			O0O0O0O00OOO0O00O =191.0 #line:55
	elif TYP ==1 :#line:57
		if OD1 ==76 :#line:58
			OOO00OOO000OO0OO0 =80 #line:59
			OOOOOOO00OOO0OO00 =200.0 #line:60
			OOOOOOOOO0OOO00O0 =356.0 #line:61
			OOO00OOO0O000OOO0 =414.0 #line:62
			O0OOO0OOO0O0O0OOO =24.6 #line:63
			OOO00O000OO0OOOO0 =201.4 #line:64
			OO0O00O00OO0000OO =149.0 #line:65
			O0OO0OO00O0O0O00O =18.0 #line:66
			O000O000OOO000O00 =160 -O0OO0OO00O0O0O00O *2.0 #line:67
			OO0OO000OO00O0000 =160 #line:68
		elif OD1 ==100 :#line:70
			OOO00OOO000OO0OO0 =100 #line:71
			OOOOOOO00OOO0OO00 =220.0 #line:72
			OOOOOOOOO0OOO00O0 =380.0 #line:73
			OOO00OOO0O000OOO0 =438.0 #line:74
			O0OOO0OOO0O0O0OOO =24.6 #line:75
			OOO00O000OO0OOOO0 =213.4 #line:76
			OO0O00O00OO0000OO =161.0 #line:77
			O0OO0OO00O0O0O00O =18.0 #line:78
			O000O000OOO000O00 =180 -O0OO0OO00O0O0O00O *2.0 #line:79
			OO0OO000OO00O0000 =180 #line:80
		elif OD1 ==168 :#line:81
			OOO00OOO000OO0OO0 =150 #line:82
			OOOOOOO00OOO0OO00 =285.0 #line:83
			OOOOOOOOO0OOO00O0 =448.7 #line:84
			OOO00OOO0O000OOO0 =515.0 #line:85
			O0OOO0OOO0O0O0OOO =26.1 #line:86
			OOO00O000OO0OOOO0 =257.7 #line:87
			OO0O00O00OO0000OO =191.0 #line:88
			O0OO0OO00O0O0O00O =22.0 #line:89
			O000O000OOO000O00 =240 -O0OO0OO00O0O0O00O *2.0 #line:90
			OO0OO000OO00O0000 =240 #line:91
	elif TYP ==2 :#line:92
		if OD1 ==76 :#line:93
			OOO00OOO000OO0OO0 =80 #line:94
			OOOOOOO00OOO0OO00 =200.0 #line:95
			OOO00OOO0O000OOO0 =356.0 #line:96
			O0OOO0OOO0O0O0OOO =24.6 #line:97
			O0O0O0O00OOO0O00O =149.0 #line:98
		elif OD1 ==100 :#line:99
			OOO00OOO000OO0OO0 =100 #line:100
			OOOOOOO00OOO0OO00 =220.0 #line:101
			OOO00OOO0O000OOO0 =380.0 #line:102
			O0OOO0OOO0O0O0OOO =24.6 #line:103
			O0O0O0O00OOO0O00O =161.0 #line:104
		elif OD1 ==168 :#line:105
			OOO00OOO000OO0OO0 =150 #line:106
			OOOOOOO00OOO0OO00 =285.0 #line:107
			OOO00OOO0O000OOO0 =448.7 #line:108
			O0OOO0OOO0O0O0OOO =26.1 #line:109
			O0O0O0O00OOO0O00O =191.0 #line:110
	if TYP ==0 :#line:112
		OO0000O00OOOO0000 =(OOOOOOOOO0OOO00O0 /2.0 )-34.90 #line:113
		OO0O0OO00O0OOOO00 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 ))#line:115
		OOOOOOOOO0OO0O0O0 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 )).rotateZ (90 )#line:116
		OO0OOOO0O00OO0O00 =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )+1 ,H =OOOOOOOOO0OOO00O0 /2.0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /4.0 ,0 ,0 ))#line:118
		OOOOO00OOO0OOOO0O =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )+1 ,H =OOOOOOOOO0OOO00O0 /2.0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /4.0 ,0 ,0 )).rotateZ (90 )#line:119
		if 40 <=OD1 <=63 :#line:121
			for O00O00000OOO0O00O in [OOOOOOOOO0OO0O0O0 ,OO0OOOO0O00OO0O00 ,OOOOO00OOO0OOOO0O ]:#line:122
				OO0O0OO00O0OOOO00 .uniteWith (O00O00000OOO0O00O )#line:123
				O00O00000OOO0O00O .erase ()#line:124
		elif OD1 >=76 :#line:126
			O00000O0OOO0O000O =TORUS (OOOO0000OO00OO000 ,R1 =(OD1 /2.0 )-2.0 ,R2 =4.0 ).rotateY (90 ).translate ((OO0000O00OOOO0000 ,0 ,0 ))#line:127
			O0OOO0OOO00OOOO0O =TORUS (OOOO0000OO00OO000 ,R1 =(OD1 /2.0 )-2.0 ,R2 =4.0 ).rotateY (90 ).translate ((-OO0000O00OOOO0000 ,0 ,0 ))#line:128
			OOO00O0O0O000000O =TORUS (OOOO0000OO00OO000 ,R1 =(OD1 /2.0 )-2.0 ,R2 =4.0 ).rotateY (90 ).translate ((OO0000O00OOOO0000 ,0 ,0 )).rotateZ (90 )#line:130
			OOOOOOO000OO0O00O =TORUS (OOOO0000OO00OO000 ,R1 =(OD1 /2.0 )-2.0 ,R2 =4.0 ).rotateY (90 ).translate ((-OO0000O00OOOO0000 ,0 ,0 )).rotateZ (90 )#line:131
			for O00O00000OOO0O00O in [OOOOOOOOO0OO0O0O0 ,OO0OOOO0O00OO0O00 ,OOOOO00OOO0OOOO0O ,O00000O0OOO0O000O ,O0OOO0OOO00OOOO0O ,OOO00O0O0O000000O ,OOOOOOO000OO0O00O ]:#line:133
				OO0O0OO00O0OOOO00 .uniteWith (O00O00000OOO0O00O )#line:134
				O00O00000OOO0O00O .erase ()#line:135
		OOO0000OOOOO0OO00 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 -2 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 ))#line:138
		O0OOOOOO00O0O0O00 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 -2 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 )).rotateZ (90 )#line:139
		for O00O00000OOO0O00O in [OOO0000OOOOO0OO00 ,O0OOOOOO00O0O0O00 ]:#line:140
			OO0O0OO00O0OOOO00 .subtractFrom (O00O00000OOO0O00O )#line:141
			O00O00000OOO0O00O .erase ()#line:142
		OOOO0000OO00OO000 .setPoint ((OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 ),(1 ,0 ,0 ))#line:144
		OOOO0000OO00OO000 .setPoint ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 ),(-1 ,0 ,0 ))#line:145
		OOOO0000OO00OO000 .setPoint ((0 ,OOOOOOOOO0OOO00O0 /2.0 ,0 ),(0 ,1 ,0 ))#line:146
		OOOO0000OO00OO000 .setPoint ((0 ,-OOOOOOOOO0OOO00O0 /2.0 ,0 ),(0 ,-1 ,0 ))#line:147
	elif TYP ==1 :#line:155
		OO0000O00OOOO0000 =(OOOOOOOOO0OOO00O0 /2.0 )-34.90 #line:156
		O00000OOOOOOOO0OO =(OD1 /2.0 )+((OOOOOOO00OOO0OO00 /2.0 )-(OD1 /2.0 ))/2.0 #line:157
		OO0O0OO00O0OOOO00 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 ,H =OOO00OOO0O000OOO0 ).rotateY (90 ).translate ((-OOO00OOO0O000OOO0 /2.0 ,0 ,0 ))#line:158
		OOOOOOOOO0OO0O0O0 =CYLINDER (OOOO0000OO00OO000 ,R =OD1 /2.0 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 )).rotateZ (90 )#line:159
		OO0OOOO0O00OO0O00 =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )+1 ,H =OOO00OOO0O000OOO0 /2.0 ).rotateY (90 ).translate ((-OOO00OOO0O000OOO0 /4.0 ,0 ,0 ))#line:161
		OOOOO00OOO0OOOO0O =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )+1 ,H =OOOOOOOOO0OOO00O0 /2.0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /4.0 ,0 ,0 )).rotateZ (90 )#line:162
		O00000O0OOO0O000O =TORUS (OOOO0000OO00OO000 ,R1 =(OD1 /2.0 )-2.0 ,R2 =4.0 ).rotateY (90 ).translate ((OO0000O00OOOO0000 ,0 ,0 )).rotateZ (90 )#line:164
		for O00O00000OOO0O00O in [OOOOOOOOO0OO0O0O0 ,OO0OOOO0O00OO0O00 ,OOOOO00OOO0OOOO0O ,O00000O0OOO0O000O ]:#line:165
			OO0O0OO00O0OOOO00 .uniteWith (O00O00000OOO0O00O )#line:166
			O00O00000OOO0O00O .erase ()#line:167
		OOO0OOOOO0O0OOOOO =CYLINDER (OOOO0000OO00OO000 ,R =OOOOOOO00OOO0OO00 /2.0 ,H =O0OOO0OOO0O0O0OOO -2 ).rotateY (90 ).translate ((-(OOO00OOO0O000OOO0 /2.0 )+2 ,0 ,0 ))#line:169
		O0O00OOOO0OO0OO0O =CYLINDER (OOOO0000OO00OO000 ,R =OOOOOOO00OOO0OO00 /2.0 ,H =O0OOO0OOO0O0O0OOO -2 ).rotateY (-90 ).translate (((OOO00OOO0O000OOO0 /2.0 )-2 ,0 ,0 ))#line:170
		O0O0O00OO0OO000OO =CYLINDER (OOOO0000OO00OO000 ,R =OOOOOOO00OOO0OO00 /2.0 ,H =O0OOO0OOO0O0O0OOO -2 ).rotateX (-90 ).translate ((0 ,-(OOOOOOOOO0OOO00O0 /2.0 )+2 ,0 ))#line:171
		OOO0O0OO0OOO00O00 =CYLINDER (OOOO0000OO00OO000 ,R =O000O000OOO000O00 /2.0 ,H =2 ).rotateY (90 ).translate ((-OOO00OOO0O000OOO0 /2.0 ,0 ,0 ))#line:173
		OOOO0O00OO00OO0OO =CYLINDER (OOOO0000OO00OO000 ,R =O000O000OOO000O00 /2.0 ,H =2 ).rotateY (-90 ).translate ((OOO00OOO0O000OOO0 /2.0 ,0 ,0 ))#line:174
		OO0OOO0OOOOOO0O0O =CYLINDER (OOOO0000OO00OO000 ,R =O000O000OOO000O00 /2.0 ,H =2 ).rotateX (-90 ).translate ((0 ,-OOOOOOOOO0OOO00O0 /2.0 ,0 ))#line:175
		OOOO00O00OO00O0OO =CONE (OOOO0000OO00OO000 ,R1 =O00000OOOOOOOO0OO ,R2 =OD1 /2.0 ,H =O0OOO0OOO0O0O0OOO /2.0 ).rotateY (90 ).translate ((-(OOO00OOO0O000OOO0 /2.0 )+O0OOO0OOO0O0O0OOO ,0 ,0 ))#line:177
		OOO00000OOO0O0OOO =CONE (OOOO0000OO00OO000 ,R1 =O00000OOOOOOOO0OO ,R2 =OD1 /2.0 ,H =O0OOO0OOO0O0O0OOO /2.0 ).rotateY (-90 ).translate (((OOO00OOO0O000OOO0 /2.0 )-O0OOO0OOO0O0O0OOO ,0 ,0 ))#line:178
		O000OOO000OOOOO00 =CONE (OOOO0000OO00OO000 ,R1 =O00000OOOOOOOO0OO ,R2 =OD1 /2.0 ,H =O0OOO0OOO0O0O0OOO /2.0 ).rotateX (-90 ).translate ((0 ,-(OOOOOOOOO0OOO00O0 /2.0 )+O0OOO0OOO0O0O0OOO ,0 ))#line:179
		for O00O00000OOO0O00O in [O0O00OOOO0OO0OO0O ,O0O0O00OO0OO000OO ,OOO0O0OO0OOO00O00 ,OOOO0O00OO00OO0OO ,OO0OOO0OOOOOO0O0O ,OOOO00O00OO00O0OO ,OOO00000OOO0O0OOO ,O000OOO000OOOOO00 ]:#line:180
			OOO0OOOOO0O0OOOOO .uniteWith (O00O00000OOO0O00O )#line:181
			O00O00000OOO0O00O .erase ()#line:182
		O0OO0O0OO0OO00O0O =math .degrees (((math .pi )*2.0 )/8 )#line:186
		OO0OO00O0OOOO0O0O =O0OO0O0OO0OO00O0O /2 #line:187
		O0OO0OO0OO0OOO0O0 =0 #line:188
		OO0O00000O00OO000 =OO0OO00O0OOOO0O0O #line:189
		while (O0OO0OO0OO0OOO0O0 <8 ):#line:190
			O0O0O0000OO0OO00O =CYLINDER (OOOO0000OO00OO000 ,R =O0OO0OO00O0O0O00O /2.0 ,H =OOO00OOO0O000OOO0 ).rotateY (90 ).translate ((-OOO00OOO0O000OOO0 /2.0 ,0 ,OO0OO000OO00O0000 /2.0 )).rotateX (OO0O00000O00OO000 )#line:191
			OOO0OOOOO0O0OOOOO .subtractFrom (O0O0O0000OO0OO00O )#line:192
			O0O0O0000OO0OO00O .erase ()#line:193
			OO00O00OO0OOO000O =CYLINDER (OOOO0000OO00OO000 ,R =O0OO0OO00O0O0O00O /2.0 ,H =OOO00OOO0O000OOO0 ).rotateX (-90 ).translate ((0 ,-OOOOOOOOO0OOO00O0 /2.0 ,OO0OO000OO00O0000 /2.0 )).rotateY (OO0O00000O00OO000 )#line:195
			OOO0OOOOO0O0OOOOO .subtractFrom (OO00O00OO0OOO000O )#line:196
			OO00O00OO0OOO000O .erase ()#line:197
			OO0O00000O00OO000 =OO0O00000O00OO000 +O0OO0O0OO0OO00O0O #line:199
			O0OO0OO0OO0OOO0O0 =O0OO0OO0OO0OOO0O0 +1 #line:200
		OO0O0OO00O0OOOO00 .uniteWith (OOO0OOOOO0O0OOOOO )#line:202
		OOO0OOOOO0O0OOOOO .erase ()#line:203
		OOO0000OOOOO0OO00 =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )-2 ,H =OOO00OOO0O000OOO0 ).rotateY (90 ).translate ((-OOO00OOO0O000OOO0 /2.0 ,0 ,0 ))#line:205
		O0OOOOOO00O0O0O00 =CYLINDER (OOOO0000OO00OO000 ,R =(OD1 /2.0 )-2 ,H =OOOOOOOOO0OOO00O0 ).rotateY (90 ).translate ((-OOOOOOOOO0OOO00O0 /2.0 ,0 ,0 )).rotateZ (90 )#line:206
		for O00O00000OOO0O00O in [OOO0000OOOOO0OO00 ,O0OOOOOO00O0O0O00 ]:#line:207
			OO0O0OO00O0OOOO00 .subtractFrom (O00O00000OOO0O00O )#line:208
			O00O00000OOO0O00O .erase ()#line:209
		OOOO0000OO00OO000 .setPoint ((OOO00OOO0O000OOO0 /2.0 ,0 ,0 ),(1 ,0 ,0 ))#line:212
		OOOO0000OO00OO000 .setPoint ((-OOO00OOO0O000OOO0 /2.0 ,0 ,0 ),(-1 ,0 ,0 ))#line:213
		OOOO0000OO00OO000 .setPoint ((0 ,OOOOOOOOO0OOO00O0 /2.0 ,0 ),(0 ,1 ,0 ))#line:214
		OOOO0000OO00OO000 .setPoint ((0 ,-OOOOOOOOO0OOO00O0 /2.0 ,0 ),(0 ,-1 ,0 ))#line:215
