Sub CATMain() Dim DrawingSelection,DrawingSheets,DrawingSheet,DrawingViews,DrawingFrontView : ReDim DrawingSelectionAtBeginning(1) Dim Status,InputObjectType(0),Plane,Drawing,DrawingViewGenerativeBehavior,V1(2),V2(2),PartDocument Set Drawing = CATIA.ActiveDocument : Set DrawingSelection = Drawing.Selection : Set DrawingSheets = Drawing.Sheets Set DrawingSheet = DrawingSheets.ActiveSheet 'We save the current selection content ReDim DrawingSelectionAtBeginning(DrawingSelection.Count2) for SelectionObjectIndex = 0 to DrawingSelection.Count2-1 Set DrawingSelectionAtBeginning(SelectionObjectIndex) = DrawingSelection.Item2(1).Value next SelectionAtBeginningLength = DrawingSelection.Count2 'Feature creation InputObjectType(0)="BiDimInfinite" Status=DrawingSelection.SelectElement4(InputObjectType,"Select a 2-D topological entity in a 3-D geometry", _ "Select a 2-D topological entity",false,PartDocument) if ((Status = "Cancel") Or (Status = "Undo") Or (Status = "Redo")) then ' We restore the selection to its initial content PartDocument.Selection.Clear for SelectionObjectIndex = 0 to SelectionAtBeginningLength-1 DrawingSelection.Add DrawingSelectionAtBeginning(SelectionObjectIndex) next Exit Sub else Set BiDimFeature = PartDocument.Selection.Item2(1).Value BiDimFeatureType = TypeName(BiDimFeature) if ((BiDimFeatureType="Plane") Or (BiDimFeatureType="PlanarFace")) then BiDimFeature.GetFirstAxis V1 BiDimFeature.GetSecondAxis V2 else Exit Sub end if ' We create a view called "Front View" in the current sheet, using Plane as projection plane, and whose origin ' coordinates are 300,150 Set DrawingFrontView = DrawingSheet.Views.Add("Front View") Set DrawingViewGenerativeBehavior = DrawingFrontView.GenerativeBehavior DrawingViewGenerativeBehavior.Document = PartDocument DrawingViewGenerativeBehavior.DefineFrontView V1(0), V1(1), V1(2), V2(0), V2(1), V2(2) DrawingFrontView.x = 300 DrawingFrontView.y = 150 DrawingViewGenerativeBehavior.Update ' We clear the PartDocument Selection object PartDocument.Selection.Clear end if End Sub