MoveSketchObjects method moves sketch by doubling its vector value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I got problem with MoveSketchObjects method. Here below I shared just part of the code that I believe we can find solution from. Otherwise it would be too long to share whole code.
Program draws rectangle side by side and makes coolinear their sides then collects currently drawn rectangle and drag to location where before-rectangle corner located. And does this to each rectangle one by one as shown below. ( Also other features I have but its not our case right now)
Problem here is that MoveSketchObjects method moves first rectangle by 1 mm on each do loop to down and this is actually want I want. But at the second and following rectangle, it moves by 2 mm on each do loop. Why Im seeing this behavior? anyone faced anything like this before ?
'' Code here...
Dim SketchforBoyunduruk As PlanarSketch = oPartCompDef.Sketches.Add(oPartCompDef.WorkPlanes.Item(2))
Dim oVec As Vector2d = g_inventorApplication.TransientGeometry.CreateVector2d(0, -0.1)
Dim oSketchObjects As ObjectCollection = g_inventorApplication.TransientObjects.CreateObjectCollection
Dim oSketchEntity As SketchEntity = Nothing
'' Code here...
Dim tolerance As Double = 0.001
Dim cornerPositionofFirstRect As Double = firstPointofSecondLine.Geometry.Y
Dim yPositionofFirstPointofSecondLine As Double = firstPointofSecondLine.Geometry.Y
'' Code here...
Dim currentRectangleLines As SketchEntitiesEnumerator = SketchingTool.DrawRectangle(SketchforBoyunduruk, adjustedLength, adjustedWidth, emptiedRectCheck)
'' Code here...
For Each oSketchEntity In currentRectangleLines
oSketchObjects.Add(oSketchEntity)
Next
Do While Math.Abs(cornerPositionofFirstRect -yPositionofFirstPointofSecondLine) > tolerance
SketchforBoyunduruk.MoveSketchObjects(oSketchObjects, oVec)
yPositionofFirstPointofSecondLine = firstPointofSecondLine.Geometry.Y
MessageBox.Show($"Value1: {yPositionofFirstPointofSecondLine}, Value2: {cornerPositionofFirstRect}")
Loop
'' Code here...