Hi s1concept,
Here is a quick ilogic example that draws a rectangle and then offsets it the distance and number of times that are specified by user input.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Exit Sub
End If
' a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject
' a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry
' Create a rectangle
Dim oRectangleLines As SketchEntitiesEnumerator
oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(10, -10))
' Create a new object collection
Dim oCollection As ObjectCollection
oCollection = ThisApplication.TransientObjects.CreateObjectCollection
' Add the first sketch line of the rectangle to the collection
oCollection.Add(oRectangleLines.Item(1))
' Get the sketch normal
Dim oNormalVector As UnitVector
oNormalVector = oSketch.PlanarEntityGeometry.Normal
' Get the direction of the sketch line being offset
Dim oLineDir As UnitVector2d
oLineDir = oRectangleLines.Item(1).Geometry.Direction
Dim oLineVector As UnitVector
oLineVector = oTransGeom.CreateUnitVector(oLineDir.X, oLineDir.Y, 0)
' The cross product of these vectors is the
' natural offdirection for the sketch line.
Dim oOffsetVector As UnitVector
oOffsetVector = oLineVector.CrossProduct(oNormalVector)
' Get the desired offvector (the +ve y-axis)
Dim oDesiredVector As UnitVector
oDesiredVector = oTransGeom.CreateUnitVector(0, 1, 0)
Dim bNaturalOffsetDir As Boolean
If oOffsetVector.IsEqualTo(oDesiredVector) Then
bNaturalOffsetDir = True
Else
bNaturalOffsetDir = False
End If
oOffset = InputBox("Enter an offset distance (in centimeters).", "iLogic", "5")
oCount = InputBox("Enter the number of offsets.", "iLogic", "1")
i = 1
Do Until i = oCount+1
oDistance = oOffset*i
Call oSketch.OffsetSketchEntitiesUsingDistance _
(oCollection, oDistance, bNaturalOffsetDir, True)
i = i + 1
Loop
