Using Barcode creation for Reporting Service Control to generate, create GS1 - 12 image in Reporting Service applications.

www.OnBarcode.com

Figure 10-3 shows an object moved from one place to another.

Figure 10-3. A moved object

The following example shows how to implement this method. The user first picks a selection of objects to be moved and specifies the translation vector on the screen.

CHAPTER 10 EDITING OBJECTS

Public Sub MoveObjects() Dim varPoint1 As Variant Dim varPoint2 As Variant Dim objSelectionSet As AcadSelectionSet Dim objDrawingObject As AcadEntity 'choose a selection set name that you only use as temporary storage and 'ensure that it does not currently exist On Error Resume Next ThisDrawing.SelectionSets("TempSSet").Delete Set objSelectionSet = ThisDrawing.SelectionSets.Add("TempSSet") 'ask user to pick entities on the screen objSelectionSet.SelectOnScreen varPoint1 = ThisDrawing.Utility.GetPoint(, vbCrLf _ & "Base point of displacement: ") varPoint2 = ThisDrawing.Utility.GetPoint(varPoint1, vbCrLf _ & "Second point of displacement: ") 'move the selection of entities For Each objDrawingObject In objSelectionSet objDrawingObject.Move varPoint1, varPoint2 objDrawingObject.Update Next objSelectionSet.Delete End Sub

Offsetting Objects

The Offset method creates a new object with boundaries offset a specified distance from an existing object s boundaries. You can apply this method to the Arc, Circle, Ellipse, Line, LightweightPolyline, Polyline, Spline, and Xline objects. This method returns an array of the newly created object(s). Even though this array frequently contains only one object of the same type as the object from which it is offset, this is not always this case, as seen in the example below. varObjectArray = Object.Offset(OffsetDistance) Table 10-4 explains this method s parameter. Table 10-4. The Object.Offset Method Parameter

Name

OffsetDistance

Data Type

Double

Description

A nonzero number that indicates the offset s size and direction. Negative numbers mean that the offset makes the new object smaller than the original. If this has no meaning, as for a single straight line, a negative number positions the new object closer to the WCS origin.

CHAPTER 10 EDITING OBJECTS

In Figure 10-4, the center object is an Ellipse from which the two other objects have been offset. You can see that the new objects are not Ellipses as each point of each new object is the same distance from the original Ellipse. In these cases, the returned object is a Spline. In this example, the negative offset must be greater than 50.

Figure 10-4. Offset objects

The following code sample creates the Ellipse and Splines in Figure 10-4 and shows the user a message box of the new objects types. Public Sub OffsetEllipse() Dim objEllipse As AcadEllipse Dim varObjectArray As Variant Dim dblCenter(2) As Double Dim dblMajor(2) As Double dblMajor(0) = 100# Set objEllipse = ThisDrawing.ModelSpace.AddEllipse(dblCenter, dblMajor, _ 0.5) varObjectArray = objEllipse.Offset(50) MsgBox "The offset object is a " & varObjectArray(0).ObjectName varObjectArray = objEllipse.Offset(-25) MsgBox "The offset object is a " & varObjectArray(0).ObjectName End Sub

CHAPTER 10 EDITING OBJECTS

Note For the sake of accuracy, because offsetting an Ellipse creates nonelliptical Spline entities,

instead consider creating new Ellipse entities with calculated geometry. This produces accurate Ellipse entities instead of approximated elliptical Splines. The same is true for offsetting Spline or curve-fitted Polyline or LightweightPolyline entities.

Rotating Objects

Use the Rotate method to rotate a drawing object around a given point in the User Coordinate System s (UCS) XY plane. This method has the following syntax: DrawingObject.Rotate BasePoint, RotationAngle Table 10-5 explains this method s parameters. Table 10-5. Rotate Method Parameters

Name

BasePoint

Data Type

Variant

Description

A three-element array of doubles that specifies the 3-D WCS coordinates of the point through which the axis of rotation, parallel to the Z-axis of the UCS, passes. The angle of rotation given in radians and measured counterclockwise from the UCS s X-axis.