I wrote the code (used sample code) to move the sketch according to the following code. Is there any way to move one point not the whole sketch?
Private Sub CommandButton1_Click()
'VBA CODE add a reference to microsoft excel xx.0 Object library
Dim opartDoc As PartDocument
Set opartDoc = ThisApplication.ActiveDocument
Dim opartcompdef As PartComponentDefinition
Set opartcompdef = opartDoc.ComponentDefinition
' 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_active As Sketch
Set oSketch_active = ThisApplication.ActiveEditObject
' Create a vector along the x-axis.
Dim oVec As Vector2d
Set oVec = ThisApplication.TransientGeometry.CreateVector2d(-5, 0)
Dim oSketchObjects As ObjectCollection
Set oSketchObjects = ThisApplication.TransientObjects.CreateObjectCollection
' Get all entities in the sketch
Dim oSketchEntity As SketchEntity
For Each oSketchEntity In oSketch_active.SketchEntities
oSketchObjects.Add oSketchEntity
Next
Call oSketch_active.MoveSketchObjects(oSketchObjects, oVec)
End Sub
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Maybe this will help.
Here is another method of sketch creation with a different workflow that might help. https://forums.autodesk.com/t5/inventor-customization/setting-a-vba-sketch-profiles-problem/td-p/103...
Can't find what you're looking for? Ask the community or share your knowledge.