Support

As evidenced by over 30 years of development history, trust-worthy Korean CAD, CADian!

FAQ · 2013.12.11
CADian VBA Sample Code - 21 [ Offset ]
object.Offset(Distance)

object:
Arc, Circle, Ellipse, Line, LightweightPolyline, Polyline, Spline, XLine
Objects which this method to be applied.

Distance:

Double; input-only
The distance to offset the object. The offset can be a positive or negative number, but it cannot equal zero. If the offset is negative, this is interpreted as being an offset to make a "smaller" curve (that is, for an arc it would offset to a radius that is "Distance less" than the starting curve""s radius). If "smaller" has no meaning, then it would offset in the direction of smaller X, Y, and Z WCS coordinates.


Remarks

For many curves, the result of this operation will be a single new curve (which may not be of the same type as the original curve). For example, offsetting an ellipse will result in a spline because the result does not fit the equation of an ellipse. In some cases it may be necessary for the offset result to be several curve



"" Create the polyline
Dim plineObj As IntelliCAD.LWPolyline
Dim plineObj2 As IntelliCAD.LWPolyline
Dim myPoints As IntelliCAD.points
Dim pt As IntelliCAD.Point

Me.Hide

Set myPoints = Library.CreatePoints
Set pt = Library.CreatePoint(1, 1, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Set pt = Library.CreatePoint(1, 2, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Set pt = Library.CreatePoint(2, 2, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Set pt = Library.CreatePoint(3, 2, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Set pt = Library.CreatePoint(4, 4, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z
Set pt = Library.CreatePoint(4, 1, 0)
myPoints.Add
myPoints(myPoints.Count).x = pt.x
myPoints(myPoints.Count).y = pt.y
myPoints(myPoints.Count).z = pt.z

Set plineObj = IntelliCAD.ActiveDocument.ModelSpace.AddLightWeightPolyline(myPoints)
plineObj.Closed = True
plineObj.Update

""Offset the polyline
Dim offsetObj As IntelliCAD.SelectionSet

Set offsetObj = plineObj.Offset(1)
offsetObj.Color = IntelliCAD.Colors.vicRed
offsetObj.Update

MsgBox "Offset completed.", , "Offset Example"

Me.Show

Added to cart.

VIEW CART

Please sign in first.

JOIN