Hi,
need help on creating a macro to create a Coordinate System on a sketch point and align its Y-Axis to a line in XZ-plane (turning Y-axis to 90 degrees).
(below pic shows my requirment)
in the below code, the CS point is created but alignment is not done. I am not sure how to use "Set swFeat = swFeatMgr.CreateCoordinateSystem(skPoint, sx, sy, sz)"
'******************************************************************************************************************************************
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swFeatMgr As SldWorks.FeatureManager
Dim swSelMgr As SldWorks.SelectionMgr
Dim x1, y1, z1 As Double
Dim sy As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swModel = swApp.ActiveDoc
Set swSelMgr = Part.SelectionManager
Set swFeatMgr = swModel.FeatureManager
boolstatus = Part.Extension.SelectByID2("Point1@Sketch1", "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
Dim skPoint As SketchPoint
Set skPoint = swSelMgr.GetSelectedObject6(1, -1)
boolstatus = Part.Extension.SelectByID2("Line1@Sketch1", "EXTSKETCHSEGMENT", 0, 0, 0, False, 1, Nothing, 0)
Set sy = swSelMgr.GetSelectedObject6(2, -1)
Set swFeat = swFeatMgr.CreateCoordinateSystem(skPoint, sx, sy, sz)
End Sub
'******************************************************************************************************************************************
SolidworksApi macros