Community
I tried to edit the supplied example from the API help for moving objects to scale a sketch. Not sure how to do this. This method only moves the object and does not scale. Any ideas how to solve this?
Is Scaleby the appropriate method? It only seems to scale the vector of movement.
Public Sub MoveAndSkaleSketchObjects() ' Check to make sure a sketch is open. If Not TypeOf ThisApplication.ActiveEditObject Is sketch Then MsgBox "A sketch must be active." Exit Sub End If ' Set a reference to the active sketch. Dim oSketch As sketch Set oSketch = ThisApplication.ActiveEditObject ' Create a vector along the x-axis. Dim oVec As Vector2d Set oVec = ThisApplication.TransientGeometry.CreateVector2d(0.1, 0) Call oVec.ScaleBy(5) 'scale this vector by 5 Dim oSketchObjects As ObjectCollection Set oSketchObjects = ThisApplication.TransientObjects.CreateObjectCollection ' Get all entities in the sketch Dim oSketchEntity As SketchEntity For Each oSketchEntity In oSketch.SketchEntities oSketchObjects.Add oSketchEntity Next ' Move all sketch objects along x-axis by 5 units. ' This will move all the text boxes and images in ' the sketch as well since these have sketch lines ' as boundary geometry or a sketch point as an ' origin point. Call oSketch.MoveSketchObjects(oSketchObjects, oVec) End Sub
Inventor HSM and Fusion 360 CAM trainer and postprocessor builder in the Netherlands and Belgium.
Unfortunately we have not the Scale function for sketch entities exposed to API yet, and I don't see any workaround for it.