VCDuplicateWithScale


Version: 

6.0

Description:

Makes a copy of the specified entity using the entity's settings and the current properties for layer, color, line type, and line width, while scaling the copy relative to a specified reference point by a given scale and optionally setting the draw order of the duplicated entity.

Declaration:

 

C/C++

extern "C" void WINAPI VCDuplicateWithScale(short* iError, ENTITYHANDLE lH, Point2D* dpRef, Point2D* dpScale, ENTITYHANDLE lHDrawAfter);

Delphi

procedure VCDuplicateWithScale (var iError: Smallint; lH: Longint; var dpRef: Point2D; var dpScale: Point2D; lHDrawAfter: Longint); stdcall;

ActiveX/COM

Sub DuplicateWithScale(ByVal lH As Long, dpRef As IVCPoint2D, dpScale As IVCPoint2D, ByVal lHDrawAfter As Long)

Parameters:

lH - the handle of the entity to be duplicated.
dp
Ref - the point about which to scale the duplicated entity. Use 0.0,0.0 to scale about the origin.
dpScale
- the x and y scale factors to apply to the duplicated entity. Use 1.0,1.0 to keep the same scale.
lHDrawAfter - the handle of the entity after which to draw the duplicated entity.  Use -1 to not set the draw order and to draw the entity at the end of the database.

Return Value:

None.

iError Code:

0 - Success
1 - Invalid world
2 - Invalid entity handle to be duplicated

Notes:

Normally when changing or editing entities in Visual CADD™ it would be necessary to first query for each of the coordinates of the entity and then reintroduce the entity into the database using the VCAdd...Entity functions after scaling those points. VCDuplicateWithScale allows for scaling of the copied entity without the need for other mathematical routines. VCDuplicateWithScale uses the entity's transformed settings, in contrast to VCDuplicate which uses current settings, except that VCDuplicateWithScale uses the current properties for layer, color, line type, and line width. The reason for the exception is that settings can include length, position, and rotation settings which can be affected by the transformation, thus VCDuplicateWithScale uses the entity's transformed settings.

In comparison, VCDuplicate does this by copying the specified entity with all its data points while still adopting all the current applicable settings.

Normally when adding new entities to the database using VCDuplicate... functions or VCAdd...Entity functions, the new entity is added at the end of the database and at the end of the draw order. VCDuplicateWithScale can optionally set the new entity to be drawn after any valid entity without the need to separately use VCDrawCurrentEntityAfter. For example, if it were desired that the duplicate be drawn after the entity it is copying, then use lHDrawAfter equal to lH. If setting draw order is not desired, then use lHDrawAfter equal to -1.

With various combinations and sequences of VCDuplicateWithRotate, VCDuplicateWithSkew, VCDuplicateWithScale, and VCDuplicateWithMove, it is possible to duplicate entities with any possible linear transformation.

See Also:

VCDrawCurrentEntityAfter, VCDuplicateWithTransform, VCDuplicateWithRotate, VCDuplicateWithSkew, VCDuplicateWithMove