Over a period of time, I have created a complex VBA script that creates quite complex geometry quickly (it saves something like 45 minutes per design), but I can't get one part to work how I want it to.
Without posting the complete vba script here, all I need it to do is model a centerline along the Z axis in a 3D sketch. I can get it to work in the X and Y axis (in both positive and negative directions), but not in Z.
Even recording a macro where I'm able to create a centerline in the Z axis, fails to re-create it when run.
The recorded macro code is as follows: -
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim skSegment As Object
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0#, 0#, 0.113622, 0#, 0#)
Dim mySketch As Object
Set mySketch = Part.GetActiveSketch2()
boolstatus = mySketch.SetWorkingPlaneOrientation(0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
Set skSegment = Part.SketchManager.CreateCenterLine(0#, 0#, 0.137771, 0#, 0#, 0.237771)
This is not a 'deal breaker' as i have an untidy workaround, but i would like to understand why it doesn't work
Currently running Solidworks Premium 2018 SP5.0
Thanks in advance for your help.