VCDuplicateWithRotate


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 rotating the copy about a specified reference point by a given angle and optionally setting the draw order of the duplicated entity.

Declaration:

 

C/C++

extern "C" void WINAPI VCDuplicateWithRotate(short* iError, ENTITYHANDLE lH, Point2D* dpRef, double dAngle, ENTITYHANDLE lHDrawAfter);

Delphi

procedure VCDuplicateWithRotate (var iError: Smallint; lH: Longint; var dpRef: Point2D; dAngle: Double; lHDrawAfter: Longint); stdcall;

ActiveX/COM

Sub DuplicateWithRotate(ByVal lH As Long, dpRef As IVCPoint2D, ByVal dAngle As Double, ByVal lHDrawAfter As Long)

Parameters:

lH - the handle of the entity to be duplicated.
dp
Ref - the point about which to rotate the duplicated entity. Use 0.0,0.0 to rotate about the origin.
dAngle
- the angle to rotate the duplicate entity from the horizontal in radians.
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 rotating those points. VCDuplicateWithRotate allows for rotation of the copied entity without the need for other mathematical routines. VCDuplicateWithRotate uses the entity's transformed settings, in contrast to VCDuplicate which uses current settings, except that VCDuplicateWithRotate 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 VCDuplicateWithRotate 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. VCDuplicateWithRotate 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, VCDuplicateWithSkew, VCDuplicateWithScale, VCDuplicateWithMove