I am needing to create horizontal lines tangent to all the valleys and mountains of a spline. I have vertical lines spaced evenly on the spline to dictate "intervals". In each interval I create my horizontal line. My steps below are as follows.
Code outside of the loop
1) Create a copy of the spline and set swSpCopy equal to it.
2) Trim outside swSpCopy using the left and right vertical lines as boundaries.
3) Add a tangent constraint on the horizontal line to the spline.
4) Create a sketch point and add a constraint to be coincident to the horizontal line and another constraint coincident to the spline.
5) Set Tanx = swTanPoint.X and Tany = swTanPoint.Y
This code works fine for the first interval. The problem arises when I need to select my original spline to make a copy for the second interval and so on. How do I go about redrawing the full spline and selecting it without using swModel.SelectByID("Spline2", "SKETCHSEGMENT", 0#,0#,0#)? In my loop, Spline2 will never be the copy of the whole spline. I would need to set a variable equal to the copied spline. How do I use this code to set a variable equal to it swModel.Extension.MoveOrCopy True, 1, False, 0, 0, 0, 0, 0, 0? I was hoping to use Set swSpCopy = swModel.Extension.MoveOrCopy(True, 1, False, 0, 0, 0, 0, 0, 0) but this does not work.
SolidworksApi macros