Scale and Rotate CAD Layers

Created:11/17/2000
Last Modified:1/24/2002
Description:

This sample code demonstrates how to change the transformation of the CAD data within your map session. You might want to change the transformation for the purpose of copying and pasting from the CAD file (this can be easier to do when the CAD data is in the same extent as what you are copying to). This sample scales and rotates a CAD layer based on a selected feature in that layer and a corresponding selected feature in another layer (non-CAD) in the map.

How to use:
  1. Browse and select the ScaleRotateCADPrj.dll using the 'Add From File' button on the customization dialog.
  2. From the 'Developer Samples' commands category, add the 'Scale/Rotate CAD file' command to an existing toolbar.
  3. Select one line feature from the CAD layer and one corresponding line feature from the non-CAD data.
  4. Click on the command and you will be presented with a preview dialog initially showing the CAD layer transformed so that the two selected features line up with each other. Manipulate the options to get a good fit for the CAD layer, then click on the OK button to apply the transformation. NOTE: This transformation will be applied to all layers. This transformation is not being applied to the actual file but only to its representation within this ArcMap document. You can save this information by saving the layer properties out to a file. There is no undo operation for this although you simply run this operation again with newly selected features and it will reset itself. This information is stored in the layer properties. To access this open the layer properties and click on the transformation tab.

Application:
ArcMap

Requires: CAD layer.

Minimum ArcGIS Version Required: 8.2

Difficulty: Moderate


Visual Basic
File Description
frmResources2.frm Form containing the tool icon.
ScaleRotateCad.cls Class for transforming CAD data based on two selected features.


Key CoClasses: CADLayer, Line, Polyline
Key Interfaces: ICadTransformations, ILine, IPolylineine
Key Members: ICadTransformations::TransformMode, ICadTransformations::SetTransformation, ILine::Angle, IPolyline::Length