Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I am faced with the following problem. I have sample code for Sketch. There is a Boolean Copy parameter, if this parameter is enabled, the method works, but if it is disabled, an Unknown error occurs. I need to move it without a copy. I'm just taking the sketch as a circle.
' 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 oSketch = ThisApplication.ActiveEditObject ' Create a vector along the x-axis. Dim oVec As Vector2d oVec = ThisApplication.TransientGeometry.CreateVector2d(5, 0) Dim oSketchObjects As ObjectCollection 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, False)
Solved! Go to Solution.