By Adam Nagy
We have a function on the PlanarSketch object called RotateSketchObjects which takes a collection of SketchEntity's and rotates them around a given point. It seems that if I also pass in all the entities including the sketch points that the sketch curves depend on then it does not work, but if I omit the points and only pass in the sketch curves, that works fine:
Sub RotateSketchEntities() Const PI = 3.14159265358979 ' Make sure that the Sketch is active in the UI ' before running the code Dim sk As PlanarSketch Set sk = ThisApplication.ActiveEditObject Dim tro As TransientObjects Set tro = ThisApplication.TransientObjects Dim oc As ObjectCollection Set oc = tro.CreateObjectCollection Dim pt As SketchEntity For Each pt In sk.SketchEntities ' Omit points If Not TypeOf pt Is SketchPoint Then Call oc.Add(pt) End If Next Dim trg As TransientGeometry Set trg = ThisApplication.TransientGeometry ' Rotate them 90 degrees around origin point Call sk.RotateSketchObjects( _ oc, trg.CreatePoint2d(), PI / 2#) End Sub