Scaling Objects

The ScaleEntity method scales a drawing object uniformly in all directions around a base point. This method has the following syntax:

DrawingObject.ScaleEntity BasePoint, ScaleFactor

Table 10-7 explains this method's parameters.

Table 10-7. ScaleEntity Method Parameters

Name Data Type Description

Table 10-7. ScaleEntity Method Parameters

BasePoint

Variant

A three-element array of doubles that specifies the 3-D WCS coordinates of the scale's base point.

ScaleFactor

Double

A positive number that represents how much to scale the object relative to its current size. Each of the object's dimensions, measured from the base point, is multiplied by this parameter. A scale factor greater than 1 enlarges the object, while a scale factor less than 1 shrinks the object.

Figure 10-7 shows a scaled object.

Figure 10-7 shows a scaled object.

Object's New \

Position and Size \

This example shows how to implement this method:

Public Sub ScaleObject()

Dim objDrawingObject As AcadEntity Dim varEntityPickedPoint As Variant Dim varBasePoint As Variant Dim dblScaleFactor As Double

On Error Resume Next

ThisDrawing.Utility.GetEntity objDrawingObject, varEntityPickedPoint, _

"Please pick an entity to scale: " If objDrawingObject Is Nothing Then

MsgBox "You did not choose an object" Exit Sub End If varBasePoint = ThisDrawing.Utility.GetPoint(, _

"Pick a base point for the scale:") dblScaleFactor = ThisDrawing.Utility.GetReal("Enter the scale factor: ")

'Scale the object objDrawingObject.ScaleEntity varBasePoint, dblScaleFactor objDrawingObject.Update End Sub

■ Note There is no direct equivalent to the SCALE command's Reference option. AutoCAD performs those calculations for you. To mimic that functionality, you have to write the code that performs the calculations.

Was this article helpful?

0 0

Post a comment