KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Model Structure
Securing Models
Collapse Import/ExportImport/Export
Import and Export
Collapse Adanced Data ExchangeAdanced Data Exchange
Data Flow Sample
STL Tree
IDataContext Interface
ISTLDataContext Interface
Collapse Scene ItemsScene Items
Items
3D Text
Smart Labels
View Points
Collapse MeasurementsMeasurements
Measurements
Persistent Measurements
Grid
Collapse SectionsSections
Sections
Section Types
Collapse 2D2D
Overlays
2D Models
2D Items
Point Sets
Collapse Line and Curve SectionsLine and Curve Sections
Line Strips
Line Section
3DS Curves
Collapse Surface and Solid SectionsSurface and Solid Sections
Surfaces
Collapse Mesh SectionsMesh Sections
Mesh Section
Mesh
Surface Of Revolution
BRep 3D Objects
Collapse BRep BSpline objectsBRep BSpline objects
Bspline objects
BSpline Faces
BRep Section
Pipes
Collapse 3DS Sections3DS Sections
3D Section
Profiles
Surface Patches
Surfaces and Patch Strips
Collapse AttributesAttributes
Material
Clipping Planes
Symmetries (Arrays)
Textures
Collapse OperationsOperations
Boolean Operations
Surface Trim
Cut Surface
Collapse MovementsMovements
Movements
Kinematic Sections
Collision Detection
3D Grid
Collapse Mathematical ObjectsMathematical Objects
Pure Geometric Objects
Points and Vectors
Planes
Collapse CurvesCurves
Straight Lines
3D Circle
Ellipse
Free-Form Curves
Arc Spline Curves
Frames
Transfroms
Oriented Boxes
Collapse 2D Elements2D Elements
Geometric Elements
Arcs
Line Strips
Collapse Basics of 3D GraphicsBasics of 3D Graphics
Concepts
3D View
2D View
Viewing Volume
Birds Eye View
Viewing Plane
Perspective View
Background
Collapse AlgorithmsAlgorithms
Euclidean Shortest Path
Collapse User DataUser Data
Layers
Object User Data
Model User Data
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Topological Modifications
Programming commands
Dynamic model restructuring
Dynamic Object Creation
Generator of 3D Sections
Generator of SOR Objects
Model class
Selection
Selection Event
External Models
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
IKO_Standard_Object
IKO_Model
IKO_TopExp_Explorer
Collapse BRepExtremaBRepExtrema
IKO_BRepExtrema_DistShapeShape
Collapse Geom2dGeom2d
IKO_Geom_CylindricalSurface
IKO_Geom_ElementarySurface
IKO_Geom2d_Circle
IKO_Geom2d_Conic
IKO_Geom2d_Curve
IKO_Geom2d_Geometry
IKO_Geom2d_Line
Collapse GeomGeom
IKO_Geom_BSplineCurve
IKO_Geom_BSplineSurface
Collapse GPGP
IKO_gp_Ax1
IKO_gp_Ax2
IKO_gp_Ax22d
IKO_gp_Ax2d
IKO_gp_Ax3
IKO_gp_Circ2d
IKO_gp_GTrsf2d
IKO_gp_Lin2d
IKO_gp_Mat2d
IKO_gp_Object
IKO_gp_Sphere
IKO_gp_Cone
IKO_gp_Torus
IKO_gp_Trsf
IKO_gp_Cylinder
IKO_gp_Pln
IKO_gp_Circ
IKO_gp_Trsf2d
Collapse GeomAPIGeomAPI
IKO_GeomAPI_PointsToBSpline
IKO_GeomAPI_Interpolate
Collapse TColStdTColStd
IKO_TColStd_Array1
IKO_TColStd_Array1OfInteger
Collapse TColgpTColgp
IKO_TColgp_Array1OfPnt
IKO_TColgp_Array1OfVec
Collapse BRepBRep
IKO_BRep_Builder
Collapse BRepBuilderAPIBRepBuilderAPI
IKO_BRep_Builder
IKO_BRepBuilderAPI_MakeWire
IKO_BRepBuilderAPI_MakeEdge
Collapse BRepOffsetAPIBRepOffsetAPI
IKO_BRepOffsetAPI_ThruSections
Collapse BRepPrimAPIBRepPrimAPI
IKO_BRepPrimAPI_MakePrism
Collapse ModModelingAlgorithmsModModelingAlgorithms
IKO_BRepGProp_Face
Collapse TopoDSTopoDS
IKO_TopoDS_Shape
IKO_TopoDS_Edge
IKO_TopoDS_Face
IKO_TopoDS_Wire
Collapse DataData
Collapse Import / ExportImport / Export
IDataConvert_KC
ICADFormat_KC
IDataContext
ISTLDataContext
IFormatVersionDataContext
Collapse User Data User Data
ILayers
IDataSource
IDataTable
IRecordSet
IDataMods
IUserData
IMatrixData
Collapse MovementMovement
IKinematicSection_KC
IMove_KC
IKinematicSet_KC
ICutEffect_KC
ISpinEffect_KC
Collapse FramesFrames
I3DObject
IFrame
IFrame2
IFrame3
IFrameEx
Collapse Oriented ObjectsOriented Objects
IObjectOriented
ISphere_KC
IBox
Collapse SectionsSections
Collapse ItemsItems
IItem
ILabel3D_KC
IDynamicScreenItem_KC
IDynamicScreenItemManager_KC
ISmartLabelManager_KC
ISection
ISection2
ISectionPointSet
ISectionLineStrip
ITextSection_KC
IPipeSection
ILineSection_KC
IObjectPosition_KC
ISticky_KC
ILabelSection_KC
IModelHealer_KC
IPointCloud_KC
IProfiledElement_KC
Collapse Mesh interfacesMesh interfaces
IMesh
IMeshTopol
ISimplex
IMeshMods
IVertex
IMeshEx
IIterator
IMeshPointKC
ISurfacePointKC
ISurfaceMetric_KC
IVertexEx_KC
IEdge_KC
ISimplexEx_KC
IMeshAlgor
IMeshShading_KC
Collapse GeneralGeneral
Collapse Collections InterfacesCollections Interfaces
IArray
IArray2
IList
IListUnkn_KC
IRelation
IArrayNum
IArray3D
IRefMap_KC
IObject_KC
ITypeBasic_KC2
IModelSearch_KC
IBitmap
IBlob
IKCContext
IKCContext2
IError_KC
IKCStack
ILineStyle_KC
IMenu_KC
IMenuItem_KC
IGlobalAPI_KC
IControlInitialisationContext_KC
IRange
IRectangleAxisAligned_KC
Collapse Topological InterfacesTopological Interfaces
IStripTopol
I3DSectionGenerator
ISORSectionGenerator 
IDIObjGenerator
Collapse Viewing InterfacesViewing Interfaces
IView
IView2
IViewPoint
IViewPointArray
ILookAt
IViewModal
ILook
ILookEx
IMeasurement_KC
IPick
ISelection_KC
IRectangleColor_KC
I2DView_KC
I2DView2_KC
I2DEditor_KC
IPrint_KC
IVirtualView
IGraphicItem
Collapse Lines And CurvesLines And Curves
ILine
ILineGeom
ILineMetr
ICurve
ICurveFreeForm
ICurveFreeFormEx
IArcSpline3DCurve
IArc
IArcEx
ICircle3D_KC2
IEllipse_KC
Collapse Symmetry InterfacesSymmetry Interfaces
ISymmetries
ISymmetry
IAxialSymmetry
Collapse Clipping plane interfacesClipping plane interfaces
IClipArray
IClipPlane
Collapse AlgorithmsAlgorithms
IEuclideanShortestPath_KC
Collapse 2D Geometry2D Geometry
ILine2D
IArc
IArcEx
IStripArcLine_KC
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Sample List
3DBugger
BoolOp
PlanarOps
Calculator
Capture
Cannon
Clip
Cloud
Collision
Collision Path
Cross View
Data Flow
Data Flow
Deploy Tutorial
DiffSurface
Direct User Access Demo
DIView
eMotion
Euclidean Shortest Path
Gear
Label
LabelEx
Layers
Light
Lines
LowDim
Make Your Move
Measure
Mesh Mods
MeshOps
Metrics
MiniCAD
Modal
Modeling Curves
Morph
Object Array
Overlay
Patch
Patchwork
Pick
Point Of View
BoolOp
Profile
Rotation
Pipes
Layers
Shape Explorer
Smart Labels
Strip Topology
Surface Metrics
Symmetry
Transform
Texture
Turbine
TwoD
User Data
View Point
WpfCAD
Zoom
Collapse DeploymentDeployment
Deploy Tutorial
DeployModule
DeployWixBasic
WixDeploy
Collapse .NET Samples.NET Samples
Collapse C# SamplesC# Samples
Patch Tutorial
MiniCAD Sample
Strip Topology Sample
DI View Sample
Modal View Sample
Modeling Curves
Label
LabelEx
Pick
Object Array
Data Flow
Profile
Cross View
Low Dim
Morph
Clip
BoolOp
Collision
Collision Path
3DBugger
Data Flow
Shape Explorer
Smart Labels
Symmetry Sample
Cannon
View Point Sample
Capture
User Data
Layers
Zoom
Collapse Visual Basic SamplesVisual Basic Samples
Patch Tutorial
DI View Sample
MiniCAD Sample
Object Array Sample
BoolOp
Data Flow
Pipes
Transform
Measure
Mesh Mods
Mesh Ops
Metrics
Morph
TwoD
eMotion
Cross View
3DBugger Tutorial
Collision
Collision Path
Light
Patchwork
Capture
Collapse WPFWPF
Clip
Mesh Ops
Measure
Lines
LowDim
WPF
Patch
Collapse Delphi SamplesDelphi Samples
3DBugger
BoolOp
Calculator
Patch Sample
Modelling Curves
MiniCAD Sample
Morph
Shape Explorer
Object Array
Metrics
Cannon
Pipes
Patchwork
Collision
Collapse C++ SamplesC++ Samples
3DBugger
BoolOp
Cannon
Capture
Cloud
Collision
Collision Path
Cross View
DI View Sample
eMotion
Gear Sample
Label
LabelEx
Light Sample
Measure
Mesh Ops
MiniCAD Sample
Modal Sample
Modeling Curves
Object Array Sample
Overlay Sample
Patch Tutorial
Pick
Point Of View
Planar Ops
Rotation Sample
Profile Sample
Shape Explorer
Smart Labels
Strip Topology Sample
Layers
Lines
LowDim
Metrics
Metrics2
Morph Sample
Patchwork
Pipes
Symmetry Sample
Texture Sample
Transform
TwoD
Turbine Sample
User Data
View Point Sample
Zoom Sample
Collapse Visual Basic SamplesVisual Basic Samples
Patch
DI View
MiniCAD
Data Flow
Cross View
Cloud
Planar Ops
Calculator
Light
Pick
Object Array
Label
Symmetry
Transform
Morph
Line Strip
Capture
Collapse Delphi SamplesDelphi Samples
KernelCAD and Delphi
3DBugger
Data Flow
BoolOp
Calculator
Cannon
Collision
Label
LabelEx
Metrics
MiniCAD
ModelingCurves
Object Array
Patch
Patchwork
Pipes
Collapse 3D Debugger3D Debugger
Creating and editing models
Editing Generic 3D Objects
Topological Commands
Model Explorer
Export / Import
Modeling Tips
3D Debugger
Collapse EditorsEditors
Form View
3D View
Collapse 2D Editors2D Editors
Crossection View
Profile View
Drum View
Collapse DialogsDialogs
3D Curve Dialog
Symmetry Collection Editor
Clip Editor
Material Editor
Surface options dialog
Collapse Modelling TutorialsModelling Tutorials
Table Tutorial
Mouse Tutorial
Collapse DeploymentDeployment
Redistribution
Registration
Deploy Module Tutorial
WixDeploy Tutorial
DeployWixBasic
Deploy Tutorial
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation Links
Pure 2D

Two Dimensional Views (Pure 2D)

Two Dimensional Mode of KernelCAD components allow displaying items which are two dimensional by its nature, namely sets of lines, points and 2D shapes.

Two Dimensional view (2D View) keeps internally a 2D item set, which is a 2D analogue of 3D model. Although 2D set is often generated from 3D model of the component it can be completely independent.

Use IView2.SetViewType to switch between two and three dimensional modes of the component. 2D View functionality is controlled via I2DView_KC Interface, which cal be obtained via: KernelCAD > GetView > IView > I2DView_KC

2D Views have number of properties (see the table below), which define how the items are displayed. Programmatically these properties can be managed via IKCContext queried from the I2DView_KC.

2D Views have also a 3D frame associated with it. The frame is called Frame of 2D View. It is used for mapping between 2D coordinates of the view and 3D coordinates of the main model.  x and y plane of the frame is called plane of the view. The frame, hence position and orientation of the plane can be set arbitrary via IFrame and other related frame interfaces queried from the IKCContext.

  • There are two ways to add 2D items to the 2D item set:
  • 1. 2D Mapping

    With this method 2D items are generated by mapping 3D objects of the main model of the component to 2D coordinate axes and adding the results to the 2D scene automatically. Currently there are two methods of mapping:  intersection and projection.

    2D mapping is very useful for displaying planar sections of objects or projections to a plane It requires minimal programming.

    Both methods use frame of the view (see above) to define the plane on which the image is generated and orientation of 2D axes inside the plane. 2D x and y axes are x and y axes of the frame of view.

    With intersection mapping each object of the 3D model is intersected with plane of the view (see above). If intersection is not empty intersection line is mapped to local x and y coordinates of the frame of view and added to 2D scene as a new item.

    With projection mapping each object of the 3D model is projected to the plane of the view. The result will look as if the 3D point of view has changed so that the viewer is looking along negative direction of z axis of the frame of view and y axis is up.

    The projection  works on per patch basis. A 3D patch is projected as a polygon (curvilinear in general case) rendered as line loop of its edge. When hidden line removal is enabled (default) lines which are covered by a higher polygon (the 3D edge from which the line was projected is invisible in 3D from end of z axis of the frame of view) are removed. Projected lines are mapped to local x and y coordinates of the frame of view and added to 2D scene as a new item.

    The above work is performed during UpdateSurface call. when view type is set to 2D.

    2D items keep information about its z position along z axis of the frame of view.

    To use 2D Mapping mode:

    1. Set view type to 2D with IView2.SetViewType(EViewType.eViewType2D)
    2. Query I2DView_KC via: KernelCAD > GetView > IView > I2DView_KC
    3. Obtain IKCContext via I2DView_KC.GetContext.
    4. Set required mapping type with IKCContext.SetIntParam(0, E2DViewGeometryType.e2DViewGeometryTypeIntersection ) or IKCContext.SetIntParam(0, E2DViewGeometryType.e2DViewGeometryTypeProjection )
    5. Use IFrame or/and IFrame2 queried from the IKCContext. to set position and orientation of the plane of the view and x, y axes inside the plane.
    6. Call UpdateSurface to create the 2D items and display them in the view

    See Cross View Sample for an example.

    2. Direct Definition

    With Direct Definition method 2D items are defined and added to the scene directly without any reference to any 3D objects.

    To use Direct Definition mode:

    1. Set view type to 2D with IView2.SetViewType(EViewType.eViewType2D)
    2. Query IKCContext via: KernelCAD > GetView > IView > I2DView_KC > IKCContext
    3. Query IDraw from IKCContext.
    4. Use IDraw.Begin, IDraw.Vertex, IDraw.End to add lines, points or shapes to the 2D item set. Use I2DView_KC.AddText to add text stings at specified locations
    5. Use I2DView_KC.AddText to add text strings
    6. Call UpdateView to redraw the window

    Note that IDraw is used here in an unusual way. Instead of normal drawing of a single scene it is used to define geometry, which will be used in multiple rendering with possible window resizing, etc.

    See MidImplementation.AddProjection() method of Cross View Sample for an example.

     

    Both 2D Mapping and Direct Definition methods can be used simultaneously. So that 2D view can contain items generated both by 2D mapping and items created directly.

    Use I2DView_KC.RemoveAll to remove all items from the View.

    Often 2D mode is used to show a model in multiple projections. This can be achieved by using External models.

    When ShowAngles property is true the view displays text strings with angles in degrees inside narrowest corners of 2D polygons. Angles 0, 90, and 180 are not displayed. This functionality is useful mostly when objects have straight edges in 3D. Font of the text can be modified by queering IDIFont from the return of IKCContext.GetParam(0), See ChildrenFont in the table below

    When ShowRulersOrGrid property is true either grid or vertical and horizontal rulers showing dimensions of the object(s) are displayed. Font of dimensions can be modified by queering IDIFont from the return of IKCContext.GetParam(1), See DimensionsFont in the table below.

    When rules are on and the 2D items are very long in one direction the scene is displayed with a break in the middle to use space of the window more efficiently.. Use BreakLongDimension property to disable this functionality.

    When ShowSideAnnotation property is true and frame of the view is aligned with global axes, more exactly orientation of the frame of the view coincides with orientation of the global frame rotated one or more times around its axes by 90 degrees, "Front", "Left", etc text will be displayed at the top left corner of the view. Font of the annotation can be modified by queering IDIFont from the return of IKCContext.GetParam(2), See SideAnnotationFont in the table below.

    2D Views can be printed using IPrint_KC obtained via: KernelCAD > GetView > IView > IPrint_KC.

    Properties of 2D View accessed via IKCContext

    DetectCurves
    Name Type Description Deafult Context Parameter ID
    for
    IKCContext
    GeometryType Integer Valid values are enumerated in E2DViewGeometryType. 0 0
    HorizontalRulerTickDistance Double Minimal distance between ticks in horizontal ruler -1 (calculated dynamically at runtime) 0
    VerticalRulerTickDistance Double Minimal distance between ticks in vertical ruler -1 (calculated dynamically at runtime) 1
    ShowAngles Boolean Display angles. See above true 0
    ShowRulersOrGrid Boolean Show either rulers or grid depending on ShowGrid value true 1
    ShowGrid Boolean Show grid, not rulers if ShowRulersOrGrid is true false 2
    ShowSideAnnotation Boolean Show annotation of the front side for standard orientation false 3
    SideAnnotationFont IDIFont Font for ShowSideAnnotation property Arial, size 10, black 2
    ShowAxesAnnot Boolean Show orientation of global axes as icon in bottom left corner false 4
    ChildrenFont  (Angles) IDIFont Font to be used for angles. Color modified via ColorDefaultChildren Arial, size 10, red 0
    DimensionsFont IDIFont Font to be used for dimensions. Color modified via ColorRulerText Arial, size 10, dark blue 1
    BreakLongDimension Boolean Break excessively long dimension. UpdateSurface must be called on change true 5
    HorVisibleRange IRange range of model's x coordinate visible in the window. More... Dynamic 3
    VertVisibleRange IRange range of model's y coordinate visible in the window. More... Dynamic 4
    EnabledHorPan Boolean Enables / disables pan in x direction true 6
    EnabledVertPan Boolean Enables / disables pan in y direction true 7
    EnabledZoom Boolean Enables / disables zoom true 8
    BreakTrigger Double A tune-in parameter for BreakLongDimension. Valid range: [0, 1]. Increasing triggers break for longer models 0.2 3
    LineWidth Integer Line width in the drawing in pixels. Valid range : 1 to 255 1 1
    DimensionLineWidth Integer Line width of dimensions. Valid range : 1 to 255 1 2
    TickLineWidth Integer Line width ticks in dimensions in pixels. Valid range : 1 to 255 1 3
    LineWidthAll Integer When set modifies LineWidth, DimensionLineWidth and TickLineWidth to the new value. When retrieved the returned value is the minimum of the three width values. 1 4
    DimensionTickSizeFactor Double Default length of ticks is multiplied by this factor just before rendering 1.0 5
    DimensioLineDistFactor Double Default distance dimension line to drawing and distance between two dimension lines is multiplied by this factor just before rendering 1.0 6
    DistDimLineToDimTextHoriz Integer Distance of horizontal dimension line to dimension text in pixels. If negative default (1) is used -1 (means use default = 1) 5
    DistDimLineToDimTextVert Integer Distance of vertical dimension line to dimension text in pixels. If negative default (5) is used -1 (means use default = 5) 6
    BreakLineWidth Integer Width of break line in device units (pixels) 1 7
    BreakLineStyle Integer Styles of the break line:
    SOLID 0
    DASH 1 /* ------- */
    DOT 2 /* ....... */
    DASHDOT 3 /* _._._._ */
    DASHDOTDOT 4 /* _.._.._ */
    1 valid range 0 to 4 8
    DrawingBounds IRectangleAxisAligned_KC Axis aligned bounding rectangle of the drawing. Read-only property none 5
    BreakRange IRange Minimum and Maximum positions of the break range for long drawings. Empty if break not applied. Read-only property Dynamic 6
    BreakGap IRange Minimum and Maximum positions of the break gap for long drawings after break has been applied. Empty if break not applied. Read-only property Dynamic 7
    RemoveTesselation Boolean If true any internal polygons on a flat front surface will be removed from the drawing. This operation is performed prior to the DetectCurces stage (see the next property) false 10
    DetectCurves Boolean If true the software will detect isolated circles in the drawing and will add special location and radius annotation. false 11
    SetupHorAlignment Boolean Has to be set true on the control, which will be aligned to horizontally. See Alignment false 13
    SetupVertAlignment Boolean Has to be set true on the control, which will be aligned to vertically. See Alignment false 14
    NewItemLineStyle Integer Defines line style for newly added items. See BreakLineStyle property for more details. 0 valid range 0 to 4 9
    RulersAllSides Boolean If true dimension lines can appear on all four sides of the drawing to optimize usage of space false 15
    ApplyToAll Boolean If true modifications to ColorDefaultItems and ColorDefaultChildren properties (see the table below) are applied to all relevant 2D view scene items. If false (default) only new items added after the call will be created with the specified color false 16
    UserData Integer Added to store any user / application defined number. Not used by the component 0 11

     

    Properties of 2D View accessed via IKCContext2

    Name Type Description Deafult Context Parameter ID (for IKCContext2 )
    ColorDefaultItems Color Color of lines in the drawing. See description for the ApplyToAll property above  0, 0, 0 (black) 0
    ColorDefaultChildren Color Color of angle labels. See above 1, 0, 0 (red) 1
    ColorRulerLines Color Color of lines in dimension annotations 0, 0, 0.7843 2
    ColorRulerText Color Color of dimension text 0, 0, 0.7843 3
    ColorBreakLine Color Color of break lines 0, 0, 0 4
    ColorOrientationText Color Color of Side / Orientation text 0.6274, 0.6274, 1 5

     

    Programmatic 2D Zoom

    HorVisibleRange and VertVisibleRange properties provide programmatic access to viewing rectangle of the displayed scene of a 2D view.

    For example, increasing length of the horizontal range will result in large area of 2D plane to be displayed in the current window so the model will appear smaller, which has effect of zooming out. Reduction of the range has effect of zooming in.

    Translation of the horizontal range to the right will appear as if the model has been shifted to the left, which has effect of pan operation. The same is true for the vertical range.

    To perform the above zoom / pan operations it is enough to modify only one range of the two. The second one will be updated automatically. See below for an explanation.

    Note that ratio of lengths of the two ranges is constant and coincides with aspect ratio (width / height) of the component's window, otherwise the scene would look distorted. Because of that modification of one range results in automatic modification of the other range inside the KernelCAD component.

     

    Aligning of 2D Views

    Aligning allows horizontal or vertical alignment of two screen images or metafile drawings. If two controls or two metafile drawings are vertically aligned aligning windows (positioning at the same horizontal location on the screen and making width equal) of both controls or pictures guarantees that the drawing inside the window or picture will be aligned too, i.e. they will have the same amount of empty space on the left and the right side of the drawing and break lines, if present in both, will be aligned vertically.

    Aligning two controls is not completely symmetric. The first control is the control to which the second control will be aligned to.

    To align two controls or to align control to itself after a rotation of Frame of 2D View:

    1. Query I2DView2_KC from I2DView_KC of both controls. Set SetupHorAlignment and/or SetupVertAlignment property of the first control to true.
    2. Call I2DView2_KC.CreateTemplate of I2DView2_KC of the second control to create target configuration of the view as a view template
    3. Call I2DView2_KC.SetupAlignment of I2DView2_KC of the first control to prepare the control for alignment
    4. Call I2DView2_KC.CreateTemplate of I2DView2_KC of the first control prepare the control to store the configuration of the view in a view template.
    5. Call I2DView2_KC.Align of I2DView2_KC of the second control to align the scene.
    The Setup...Alignment properties do not always improve layout. So it is recommended experimenting with its value. Call I2DView2_KC.Align(NULL, 0) to stop alignment.

    See also Cross View Sample