Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Move one point not the hole sketch

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
325 Views, 1 Reply

Move one point not the hole sketch

elei0947_0-1624691485480.png

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

1 REPLY 1
Message 2 of 2
A.Acheson
in reply to: Anonymous

Maybe this will help.

https://forums.autodesk.com/t5/inventor-customization/create-fixed-workpoints-and-move-their-positio...

 

 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...

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report