HarunMusic
Computer
Hi, can anyone help me with creating a macro who will create axis systems from sketch. Exmlpe, i ll create sketch with points and than call macro to make Axis System, thx
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Language="VBSCRIPT"
Sub CATMain()
Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim axisSystems1 As AxisSystems
Set axisSystems1 = part1.AxisSystems
Dim axisSystem1 As AxisSystem
Set axisSystem1 = axisSystems1.Add()
axisSystem1.Name = "MyAxis"
axisSystem1.Type = catAxisSystemEulerAngles
Dim parameters1 As Parameters
Set parameters1 = part1.Parameters
str1 = CATIA.ActiveWindow.Name & "\MyAxis\EulerAngle1"
Dim angle1 As Parameter
Set angle1 = parameters1.Item(str1)
angle1.Value = 45.000000
Dim parameters2 As Parameters
Set parameters2 = part1.Parameters
str2 = CATIA.ActiveWindow.Name & "\MyAxis\EulerAngle2"
Dim angle2 As Parameter
Set angle2 = parameters2.Item(str2)
angle2.Value = 90.000000
Dim parameters3 As Parameters
Set parameters3 = part1.Parameters
str3 = CATIA.ActiveWindow.Name & "\MyAxis\EulerAngle3"
Dim angle3 As Parameter
Set angle3 = parameters3.Item(str3)
angle3.Value = 20.000000
axisSystem1.OriginType = catAxisSystemOriginByPoint
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1")
Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = hybridBody1.HybridShapes
Dim hybridShapePointCoord1 As HybridShape
Set hybridShapePointCoord1 = hybridShapes1.Item("Point.1")
Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
axisSystem1.OriginPoint = reference1
axisSystem1.XAxisType = catAxisSystemAxisSameDirection
axisSystem1.YAxisType = catAxisSystemAxisSameDirection
axisSystem1.ZAxisType = catAxisSystemAxisSameDirection
part1.UpdateObject axisSystem1
axisSystem1.IsCurrent = True
part1.Update
End Sub