Catia坐标点输出程序相关函数及参数

更新时间:2023-12-13 13:58:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

从documents找到的Catia坐标点输出程序相关函数,

点坐标提取及定义.................................................................................................................................. 1 HybridShapePointCoord (Object) .............................................................................................................. 1

Property Index.................................................................................................................................. 2 Properties ........................................................................................................................................ 2 对象控制................................................................................................................................................ 3 AnyObject (Object).................................................................................................................................. 3

Property Index.................................................................................................................................. 4

Method Index ................................................................................................................................... 4 Properties ........................................................................................................................................ 4 Methods .......................................................................................................................................... 5 选择元素................................................................................................................................................ 6 SelectedElement (Object).......................................................................................................................... 6

Property Index.................................................................................................................................. 6 Method Index ................................................................................................................................... 6 Properties ........................................................................................................................................ 7 Methods .......................................................................................................................................... 9 选择方法...............................................................................................................................................10 Selection (Object) ...................................................................................................................................10

Property Index.................................................................................................................................12 Method Index ..................................................................................................................................12 Properties .......................................................................................................................................13 Methods .........................................................................................................................................13

点坐标提取及定义

file:///F:/catiav5r16doc_en/English/online/interfaces/interface_hybridshapepointcoord.htm#

HybridShapePointCoord (Object)

IUnknown |

+---IDispatch |

+---CATBaseUnknown |

+---CATBaseDispatch |

+---AnyObject

|

+---HybridShape |

+---Point |

+---HybridShapePointCoord

Point defined by coordinates.

Role: To access data of the point feature created with its cartesian coordinates. See also:

Length

See also:

Reference

See also:

HybridShapeFactory

Property Index

PtRef

Returns or Sets the reference point for PointCoord feature.

RefAxisSystem

Returns or Sets the reference Axis System for PointCoord feature.

X

Returns X coordinate of the point.

Y

Returns Y coordinate of the point.

Z

Returns Z coordinate of the point.

Properties

o Property PtRef( ) As CATIAReference

Returns or Sets the reference point for PointCoord feature.

This data is not mandatory, if element is null, the origin point is taken. When an element is given, X, Y and Z are measured starting from this point. Sub-element(s) supported (see Boundary object): Vertex. Example:

This example retrieves in oPtRef the reference point for PointCoord feature.

Dim oPtRef As CATIAReference Set oPtRef = PointCoord.PtRef

o Property RefAxisSystem( ) As CATIAReference

Returns or Sets the reference Axis System for PointCoord feature.

This data is not mandatory, if element is null, the absolute axis system is taken. When an element is given, X, Y and Z are considered in this Axis system.

If reference point is not specified, X,Y and Z are measured from origin of this axis system. * Example:

This example retrieves in oRefAxis the reference Axis System for PointCoord feature.

Dim oRefAxis As CATIAReference

Set oRefAxis = PointCoord.RefAxisSystem

o Property X( ) As CATIALength (Read Only)

Returns X coordinate of the point. Example:

This example retrieves in oX the X coordinate for the PointCoord hybrid shape feature.

Dim oX As CATIALength Set oX = PointCoord.X

o Property Y( ) As CATIALength (Read Only)

Returns Y coordinate of the point. Example:

This example retrieves in oY the Y coordinate for the PointCoord hybrid shape feature.

Dim oY As CATIALength Set oY = PointCoord.Y

o Property Z( ) As CATIALength (Read Only)

Returns Z coordinate of the point. Example:

This example retrieves in oZ the Z coordinate for the PointCoord hybrid shape feature.

Dim oZ As CATIALength Set oZ = PointCoord.Z

对象控制 AnyObject (Object)

IUnknown |

+---IDispatch |

+---CATBaseUnknown

|

+---CATBaseDispatch |

+---AnyObject

file:///F:\\catiav5r16doc_en\\English\\online\\CAAScdBase\\CAAScdAutomationHome.htm

Represents the base object for all other objects except collection and reference objects. As a base object, it provides properties shared by any other object.

Property Index

Application

Returns the application.

Name

Returns or sets the name of the object.

Parent

Returns the parent object.

Method Index

GetItem

Returns an object from its name.

Properties

o Property Application( ) As CATIAApplication (Read Only)

Returns the application. The application is the root object of the object structure and can be retrieved from any object in this object structure using the Application property. The root object, also called top-level object, is the object located at the top of the application's object structure. It is used by clients to retrieve and navigate across all the application's subordinate objects. If the client runs in-process, it retrieves the object at the top of the object structure. If the client runs out-process, it should call the GetApplication method to retrieve the object at the top of the object structure, which is the only object accessible from outside. The Application property is thus the way to jump from any object up to the root of the object structure, allowing then to navigate downwards. For in-process scripting, the application is always referred to as CATIA. Note that the Application property of the Application object returns the Application object itself. Example:

This example retrieves in CurrentApplication the application object, root of the object structure, from a given object of this structure: a document refered to using the MyDoc variable.

Dim CurrentApplication As Application

Set CurrentApplication = MyDoc.Application

o Property Name( ) As CATBSTR

Returns or sets the name of the object. The name is a character string automatically assigned to any object to handle it easier. Even if the Name property allows you to reassign an object name, this is not advised. Many objects, such as the application and the collections, have names that you must not change, and it's safer to use Name as a read only property. When an object is part of a collection, the object name can often be used in place of the object rank to retrieve or remove the object, providing the Item and Remove methods of the collection feature an argument with the Variant type. A name must start with a letter. It can include numbers, but it can't include spaces. If the object has no name set, the default name returned is the object type. For example, the Name property of a Viewer3D object with no name set returns Viewer3D. Example:

This example retrieves in MyObjectName the name of the MyObject object.

MyObjectName = MyObject.Name

o Property Parent( ) As CATBaseDispatch (Read Only)

Returns the parent object. The parent object of a given object is the object just above in the object structure, usually the object that created this object and that aggregates it. In the case of an object part of a collection, the parent object is not the collection object itself, but the object that aggregates the collection object. The Parent property is the way to step upwards in the object structure. Note that the Parent property of the Application object returns the Application object itself. Example:

This example retrieves in ParentObject the parent object of the GivenObject object.

Dim ParentObject As AnyObject

Set ParentObject = GivenObject.Parent

Methods

o Func GetItem( CA TBSTR IDName) As CATBaseDispatch

Returns an object from its name.

Role: To retrieve an object when only its name is available. You should not use this method, but you can find it in the macros generated by the Tools->Macro command. Parameters: IDName

The searched obect name Returns:

The searched object

选择元素

SelectedElement (Object)

IUnknown |

+---IDispatch |

+---CATBaseUnknown |

+---CATBaseDispatch |

+---AnyObject |

+---SelectedElement

file:///F:\\catiav5r16doc_en\\English\\online\\CAAScdBase\\CAAScdAutomationHome.htm

Represents an element contained by a Selection object.

This object is an object contained by a Selection object. The Selection object contains SelectedElement objects, which are accessed through the Selection.Count2 and Selection.Item2 methods.

Property Index

Document

Returns the document to which the selected element belongs.

LeafProduct

Returns the leaf product corresponding to the selection in the specification tree.

Reference

Returns a Reference version of the Value property.

Type

Returns the string constant which describes the selected element Automation type.

Value

Returns the actual selected automation object.

Method Index

GetCoordinates

Returns the coordinates of the pick point.

Properties

o Property Document( ) As CATIADocument (Read Only)

Returns the document to which the selected element belongs.

o Property LeafProduct( ) As CATIABase (Read Only)

Returns the leaf product corresponding to the selection in the specification tree.

Role: Returns the leaf Product (component, corresponding for example to \in the specification tree). The AnyObject returned is a Product if a product appears in the specification tree, in the path corresponding to the current selection, and a fake AnyObject whose AnyObject.Name

property equals to \

Cumulated with the use of the AnyObject.Parent property (which enables to navigate into the object structure), the current property enables the scripter to obtain the path, in the specification tree, corresponding to the selection. Example:

The following example supposes a Part or a Product is opened. It asks the end user to select a Shape in the current window. It then sends message boxes containing the names of the automation objects contained in the specification tree path corresponding to the shape selected, and, regarding the automation objects which are products (only products which are components), a message box containing the abcissa of the translation of the product compared to its reference product.

Dim Status,Feature,LeafProduct,LeafProductProcessed,InputObjectType(0) Dim

Document,Selection,AutomationTreeNodeOrProduct,Position,AxisComponentsArray(11) Set Document = CATIA.ActiveDocument : Set Selection = Document.Selection 'We propose to the user that he select a feature InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType,\ if (Status = \ Set Feature = Selection.Item(1).Value

Set LeafProduct = Selection.Item(1).LeafProduct LeafProductProcessed = true

if (LeafProduct.Name<>\ Set AutomationTreeNodeOrProduct = Feature

do while (TypeName(AutomationTreeNodeOrProduct)<>\

' We send a message box, if AutomationTreeNodeOrProduct is not nor a Shapes object neither a PartDocument object

if ((TypeName(AutomationTreeNodeOrProduct)<>\ (TypeName(AutomationTreeNodeOrProduct)<>\ (TypeName(AutomationTreeNodeOrProduct)<>\ (TypeName(AutomationTreeNodeOrProduct)<>\

(TypeName(AutomationTreeNodeOrProduct)<>\ msgbox AutomationTreeNodeOrProduct.Name

if (TypeName(AutomationTreeNodeOrProduct)=\

' We display a message box containing the abcissa of the translation, except in the case of the ' root product

if (TypeName(AutomationTreeNodeOrProduct.Parent.Parent)<>\then

Set Position = AutomationTreeNodeOrProduct.Position Call Position.GetComponents(AxisComponentsArray) msgbox AxisComponentsArray(9) end if end if end if

' We determine the next automation tree node or product

Set AutomationTreeNodeOrProduct = AutomationTreeNodeOrProduct.Parent if ((TypeName(AutomationTreeNodeOrProduct)=\LeafProductProcessed)) then

' The specification tree path corresponding to the selection contains at least one product, which the current

' loop as not yet processed. It means that the parent in the specification tree of the feature corresponding

' to the last message box sent is LeafProduct Set AutomationTreeNodeOrProduct = LeafProduct LeafProductProcessed = true end if loop

If you run the preceeding piece of script, the current document beeing a product with the following specification tree:

+--------+ !Product3! +----+---+ !

+- Product2 (Product2.1) 'translation value: 10 ! !

! +- Product1 (Product1.1) 'translation value: 20 ! !

! +- Part1 (Part1.1) ! !

! +- Part1 ! !

! +- PartBody ! !

! +- Pad.1 +- Part2 (Part2.1)

and you select Pad.1, the message boxes displayed will be:

Pad.1

PartBody Part1 Part1.1 Product1.1 20

Product2.1 10 Product3

o Property Reference( ) As CATIAReference (Read Only)

Returns a Reference version of the Value property. Role: Returns a Reference version of Value .

o Property Type( ) As CATBSTR (Read Only)

Returns the string constant which describes the selected element Automation type. This type is returned by the Value property, and may be, for instance \ or \.

Caution: This property gives the leaf automation type of the object, in the inheritance hierarchy. Nevertheless,

after

a

call

to

Selection.SelectElement2 , Selection.SelectElement3 ,

Selection.SelectElement4 , Selection.IndicateOrSelectElement2D or

Selection.IndicateOrSelectElement3D , this property gives the input filter string constant relative to the

effective selection (more precisely the first filter string constant delivered through the iFilterType parameter, for which the current automation object fullfills the string constant). This string constant may be an automation object name corresponding to the iFilterType parameter with which

Selection.SelectElement2 has previously been called, or even a CATSelectionFilter value name.

Example:

Suppose you run the following piece of script:

Set Selection = CATIA.ActiveDocument.Selection

' We propose to the user that he select a Prism or a Hole

ReDim InputObjectType(1) : InputObjectType(0)=\ Status=Selection.SelectElement2(InputObjectType,\ if (Status = \ AutomationType = Selection.Item(1).Type

If the user selects a Pad, the script AutomationType variable will contain \ and not \. Consequently, in most cases, use the VBScript TypeName function instead of this property.

o Property Value( CA) As TBaseDispatch (Read Only)

Returns the actual selected automation object.

Methods

o Sub GetCoordinates( CA TSafeArrayVariant ioPoint)

Returns the coordinates of the pick point. Parameters:

oPoint

The coordinates of the pick point, i.e. the hit between the geometric object and the cursor. The length of this parameter will be 3, except if the document is a

DrawingDocument

Example:

This example retrieves the coordinates of the pick point in the array myArray:

Dim oSelElem As SelectedElement

Set oSelElem = CATIA.ActiveDocument.Selection.Item(1) ReDim myArray(2)

oSelElem.GetCoordinates myArray

选择方法 Selection (Object)

IUnknown |

+---IDispatch |

+---CATBaseUnknown |

+---CATBaseDispatch |

+---AnyObject |

+---Selection

file:///F:\\catiav5r16doc_en\\English\\online\\CAAScdBase\\CAAScdAutomationHome.htm

Represents the selection.

The Selection object contains the features the end user selected, usually with the mouse, and which are candidates as subjects for the next action.

A feature possess parent objects in the specification tree (hierarchy). For example, the Pad below possess parent objects in the specification tree:

+--------+ !Product3! +--------+ !

+- Product2 (Product2.1) ! !

! +- Product1 (Product1.1) ! !

! +- Part1 (Part1.1) ! !

! +- Part1 ! !

! +- PartBody

! ! +------------------+ ! +- Pad.1 ! Selected feature ! ! ! +------------------+ ! +- Sketch.1 +- Part2 (Part2.1)

For a given selected feature, its parent objects which are exposed to automation can be accessed through a recursive call to the AnyObject.Parent property. When a given feature is selected, there are three possibilities:

? ?

The feature is exposed to automation (a Pad for example, this is the common case): the feature can be accessed by all Selection object methods

The feature is not exposed to automation, but at least one of its parent objects is exposed to automation (a DMU Navigator URL for example: the Hyperlink is not exposed to automation, but the root Product, which contains the Hyperlink, is exposed to automation):

o no access is given to the feature through the Count2 and Item2 methods of the Selection

object o nevertheless, the first parent object of the feature, which is exposed to automation (the root

Product in our example) can be accessed through the Item2 and Count2 methods

o The Search, Delete, VisProperties, Copy, Cut, Paste and PasteSpecial methods of the Selection

object, take into account the feature. For example, if the user:

? ?

Puts a DMU Navigator URL in the clipboard Runs a script calling the PasteSpecial method

then, during the paste, the DMU Navigator URL will be pasted

?

The feature is not exposed to automation, and he has no parent object which is exposed to automation (a ResourcesList object of a .CATProcess for example):

o no access is given to the feature through the Count2 and Item2 methods of the Selection

object o no access is given neither to any parent object of the feature through the Item2 and Count2

methods

o The Search, Delete, VisProperties, Copy, Cut, Paste and PasteSpecial methods of the Selection

object take into account the feature. For example, if the user:

? ? ?

Go to the \ Puts a ResourcesList object in the clipboard

Runs a script calling the Selection.PasteSpecial method

then, during the paste, the ResourcesList object will be pasted.

Property Index

Count Count2

Returns the number of SelectedElement objects contained by the current selection.

VisProperties

Manages graphic properties on current selection.

Method Index

Add

Creates a SelectedElement object which Value property is the given automation object, and adds it to the selection.

Clear

Clears the selection.

Copy

Copies, in a copy and paste operation.

Cut

Cuts, in a cut and paste operation.

Delete

Deletes all selected objects.

FilterCorrespondence

Specifies if the automation objects appearing as Value property of SelectedElement objects fit a given filter.

FindObject

Finds an object in the current selection and deletes it from the selection.

IndicateOrSelectElement2D

Runs an interactive command enabling both indication and selection, 2D version.

IndicateOrSelectElement3D

Runs an interactive command enabling both indication and selection, 3D version.

Item Item2

Returns the iIndex-th SelectedElement object contained by the current selection.

Paste

Puts the contents of the clipboard in the document at the indicated location.

PasteSpecial

Puts the contents of the clipboard in the document at the indicated location, according to the specified format.

Remove

Remove2

Removes the iIndex-th SelectedElement object contained by the current selection.

Search

Finds an object in the document using the Edit/Search grammar.

SelectElement2

Runs an interactive selection command.

SelectElement3

Runs an interactive selection command, exhaustive version.

SelectElement4

Runs an interactive selection command, enabling the selection in a non active document.

Properties

o Property Count( ) As long (Read Only)

Deprecated:

V5R16 #Count2 . The Count and Item Methods have been replaced by the Count2 and Item2 methods because they did not process correctly features which are not exposed to automation (such as a ResourcesList feature of a .CATProcess document).

o Property Count2( ) As long (Read Only)

Returns the number of SelectedElement objects contained by the current selection.

Role: This method returns the number of SelectedElement objects contained by the Selection. The Value property of a given SelectedElement object is an automation object associated to a selected

feature.

o Property VisProperties( ) As CATIAVisPropertySet (Read Only)

Manages graphic properties on current selection.

Role: Gives a VisPropertySet automation object so that graphic properties of the selected objects can be read or modified.

Note: After the execution of the VisProperties methods which update graphic properties of the features, selected features which are not exposed to automation will be updated. After the execution of the VisProperties methods which consult the selection to give the graphic properties, selected features which are not exposed to automation will be consulted. Example:

This example sets in no show all elements of the current selection:

Dim Selection,VisPropertySet

Set Selection = CATIA.ActiveDocument.Selection Set VisPropertySet = Selection.VisProperties VisPropertySet.SetShow catVisPropertiesNoShowAttr

Methods

o Sub Add( CA TIABase iObject)

Creates a SelectedElement object which Value property is the given automation object, and adds it to

the selection.

Role: Creates a SelectedElement object, which Value property is the given automation object, and which LeafProduct property is the first (when scanning the specification tree) which contains the automation object. The SelectedElement is added to the current selection. Example:

This example creates a SelectedElement object, which Value property is the ObjectToAdd automation object, the SelectedElement being added to the current selection.

CATIA.ActiveDocument.Selection.Add(ObjectToAdd)

o Sub Clear( )

Clears the selection. Example:

This example clears the selection. The selection is then empty.

CATIA.ActiveDocument.Selection.Clear()

o Sub Copy( )

Copies, in a copy and paste operation.

Role: Puts the contents of the selection in the clipboard, but leaves the selected elements in the document, and clears the selection. This is the programming equivalent of the Copy command from the Edit menu.

Note: If a selected feature is not exposed to automation, it will be copied into the clipboard all the way. Example:

This example copies, in a copy and paste operation. A selected DMU Navigator URL will be put into the clipboard although it is not exposed to automation.

CATIA.ActiveDocument.Selection.Copy()

o Sub Cut( )

Cuts, in a cut and paste operation.

Role: Puts the contents of the selection in the clipboard, and removes the selected elements from the document, and clears the selection. This is the programming equivalent of the Cut command from the Edit menu.

Note: If a selected feature is not exposed to automation, it will be copied into the clipboard and removed from the document all the way. Example:

This example cuts, in a cut and paste opertation. A selected DMU Navigator URL will be put into the clipboard and removed from the document, although it is not exposed to automation.

CATIA.ActiveDocument.Selection.Cut()

o Sub Delete( )

Deletes all selected objects.

Role: For all the SelectedElement objects contained by the selection, the SelectedElement.Value automation object is deleted from the document.

Note: If a selected feature is not exposed to automation, it will deleted all the way. Example:

This example deletes all the selected objects. A selected DMU Navigator URL will be removed from the document, although it is not exposed to automation.

CATIA.ActiveDocument.Selection.Delete()

o Func FilterCorrespondence( CA TSafeArrayVariant iFilterType) As boolean

Specifies if the automation objects appearing as Value property of SelectedElement objects fit a given filter.

Role: FilterCorrespondence filters the selection with respect to provided automation types. The use of this method coupled with the use of the SelectElement2 will enable, for example, to write a script reproducing the functionalities of the \This method, called before a loop onto SelectElement2 calls, will enable to initialize a set of objects to select.

This way of coding corresponds to a power multi-selection with a visual feedback of the selected edge (high-lighting) as soon as an edge has been selected. Parameters: iFilterType

An array of strings constants to be used as a filter for the kind of element to which current selection object must correspond. See the iFilterType parameter of the

SelectElement2 method.

oAllFit

All current selection objects fit the iFilterType filter, i.e. regarding each of the current selection objects, they all fit one of the iFilterType string constant. Example:

The following example uses an internalized array of edges. It loops onto:

? asking the end user to select an edge of a tri-dimentional feature (see TriDimFeatEdge )

? adding the selected edge into the internalized edge list (the edge count maximum value equals to 5) Then, it creates an edge fillet (see ConstRadEdgeFillet ), giving it as specifications the selected edges.

At the beginning of the execution of the script, we test if all current selection objects are edges. If it is the case, the internalized edge list is updated. Otherwise, we clear the current selection content.

Set Document = CATIA.ActiveDocument : Set Part = Document.Part : Set Selection = Document.Selection

Set ShapeFactory = Part.ShapeFactory : AllocatedEdgeCount = 10 : ReDim Edge(AllocatedEdgeCount-1)

ReDim InputObjectType(0) : InputObjectType(0)=\ AllFit = Selection.FilterCorrespondence(InputObjectType) if (AllFit) then

' We add the selected edges to Edge

for EdgeIndex = 0 to Selection.Count2-1

' We increase the allocation of EdgeSet if necessary if (EdgeCount = AllocatedEdgeCount) then

AllocatedEdgeCount = AllocatedEdgeCount + 10 : ReDim Edge(AllocatedEdgeCount-1) end if

Set Edge(EdgeIndex) = Selection.Item2(1).Value : EdgeCount = EdgeCount+1 next else

Selection.Clear end if

'We loop onto interactive selections AllEdgesHaveBeenSelected = false

do while (Not AllEdgesHaveBeenSelected)

' We increase the allocation of EdgeSet if necessary if (EdgeCount = AllocatedEdgeCount) then

AllocatedEdgeCount = AllocatedEdgeCount + 10 : ReDim Edge(AllocatedEdgeCount-1) end if

' We propose to the user that he select an edge

Status=Selection.SelectElement2(InputObjectType,\ if (Status=\ Selection.Clear : Exit Sub end if

' We save the selected edge

Set SelectedEdge = Selection.Item2(1).Value

' We determine if the edge already belongs to the Edge array EdgeIndex2 = 0 Found = False

do while ((EdgeIndex2 < EdgeCount) And (Not Found)) if (Edge(EdgeIndex2).Name=SelectedEdge.Name) then Found = True

AlreadySelectedEdgeIndex = EdgeIndex2 end if

EdgeIndex2 = EdgeIndex2 + 1 loop

' We add the selected edge to Edge or remove the selected edge from Edge if (Found) then

' The edge already belongs to Edge. We suppress it from Edge for EdgeIndex2 = AlreadySelectedEdgeIndex to EdgeCount-2 Set Edge(EdgeIndex2) = Edge(EdgeIndex2+1) next

EdgeCount = EdgeCount - 1 else

' The edge does not already belong to Edge. We add the it to edge

Set Edge(EdgeCount) = Selection.Item2(1).Value : EdgeCount = EdgeCount + 1 end if

' We fill Selection with all the selected edges Selection.Clear

for EdgeIndex = 0 to EdgeCount -1 Selection.Add Edge(EdgeIndex)

next

' We ask the end user if the edge selection is finished

OtherEdgeAnswer = msgbox (\Definition\

if (OtherEdgeAnswer = 2) then Exit Sub

if (OtherEdgeAnswer = 7) then AllEdgesHaveBeenSelected = true loop

'We create a new fillet based onto the current selection content

Set Fillet = ShapeFactory.AddNewEdgeFilletWithConstantRadius(Edge(0), 1, 5.0) Fillet.EdgePropagation = 1

for EdgeIndex = 1 to EdgeCount -1

Fillet.AddObjectToFillet Edge(EdgeIndex) next

Part.Update

o Func FindObject( CA TBSTR iObjectType) As CATIABase

Finds an object in the current selection and deletes it from the selection.

Role: Determines the first automation object specified in SelectedElement.Value (for the

SelectedElement objects contained in the current selection), or which is a Parent (see AnyObject.Parent ) of the automation object specified in SelectedElement.Value , which type is equal to

the type specified in input. It returns directly the automation object and deletes the corresponding

SelectedElement object from the current selection.

Note: If the string specified in input is he \string, the possible automation object specified in SelectedElement.LeafProduct is also looked at. Example:

This example searches a Pad object in the current selection and puts it into FoundObject.

Dim FoundObject As AnyObject

Set FoundObject = CATIA.ActiveDocument.Selection.FindObject(\

o (

Func

iMessage,

IndicateOrSelectElement2DCATBSTR

CATSafeArrayVarianiFilterType,

t

boolean boolean boolean boolean

iObjectSelectionBeforeCommandUsePossibility,

iTooltip,

iTriggeringOnMouseMove, oObjectSelected,

oDocumentWindowLocation) As CATBSTR

CATSafeArrayVariant

Runs an interactive command enabling both indication and selection, 2D version.

Role: IndicateOrSelectElement2D runs an interactive command into a 2D document window, asking to the user to select a location into the window, or to select an object. See

Document.Indicate2D and SelectElement3.

Parameters: iMessage

A string which instructs the user that he must select a location into the document window or select an object. iFilterType

An array of strings constants to be used as a filter for the kind of element to select. iObjectSelectionBeforeCommandUsePossibility

Enables the script to support the possibility, for the user, to select a required object before running the script. See

SelectElement2 .

iTooltip

Displays a tooltip as soon as an object is located under the mouse without being selected. iTriggeringOnMouseMove

Triggers as soon as a mouse move event is detected. This option beeing set, oOutputState may be valued to \ oObjectSelected

Flag pr閏ising if the user choosed the selection or the indication. oDocumentWindowLocation

An array made of 2 doubles: X, Y - coordinates array of the location the user specified in the document window. This parameter is valuated only if oObjectSelected equals to false. oOutputState

The state of the interactive command once IndicateOrSelectElement2D returns. The possible values are the same than the values described regarding the oOutputState parameter of the SelectElement2 method, except that the \value can also be returned. Example:

The following example suppose a drawing is currently edited. It creates a point (see Point2D ), and asks the end user to click to define the circle center.

When it is done, as the mouse moves without clicking the left button, the script determines the location into the drawing window, and the script creates a temporary circle as a feedback.

A click into the document window or the selection of a point creates definitively the circle (see

Circle2D ) located at the specified location (whether the location is a location into the drawing window

or whether it is the existing point location).

Dim

Document,Selection,DrawingSheets,DrawingSheet,DrawingViews,WindowLocation(1),DrawingView,Factory2D,Radius,Circle2D Dim

HardCodedPoint,Status,XCenter,YCenter,InputObjectType(0),TempCircleHasBeenCreatedAtLeastOnce,ExistingPoint Dim ObjectSelected

Set Document = CATIA.ActiveDocument : Set Selection = Document.Selection : Set DrawingSheets = Document.Sheets

Set DrawingSheet = DrawingSheets.ActiveSheet : Set DrawingViews = DrawingSheet.Views Set DrawingView = DrawingViews.ActiveView : Set Factory2D = DrawingView.Factory2D

'We create a point

Set HardCodedPoint = Factory2D.CreatePoint(700.,400.)

HardCodedPoint.ReportName = 1 : HardCodedPoint.Construction = False 'We propose to the user to click to define the circle center

Status=Document.Indicate2D(\ if (Status = \ XCenter = WindowLocation(0) : YCenter = WindowLocation(1)

'We propose to the user that he specify a location into the drawing window or a point InputObjectType(0)=\

Status = \

Status=Selection.IndicateOrSelectElement2D(\circle radius point\

InputObjectType,false,false,true, _ ObjectSelected,WindowLocation) ' We loop onto mouse moves without click do while (Status = \

if (TempCircleHasBeenCreatedAtLeastOnce) then Selection.Add Circle2D : Selection.Delete end if

Radius = Sqr(((WindowLocation(0)-XCenter)*(WindowLocation(0)-XCenter))+ _ ((WindowLocation(1)-YCenter)*(WindowLocation(1)-YCenter))) Set Circle2D = Factory2D.CreateClosedCircle(XCenter,YCenter,Radius) TempCircleHasBeenCreatedAtLeastOnce = 1

Status=Selection.IndicateOrSelectElement2D(\a point or click to locate the circle radius point\

InputObjectType,false,false,true, _ ObjectSelected,WindowLocation) loop

'We go out if necessary

if (Status = \ if (TempCircleHasBeenCreatedAtLeastOnce) then

Selection.Add Circle2D : Selection.Add HardCodedPoint : Selection.Delete end if Exit Sub end if

'We determine the possible selected point coordinates if (ObjectSelected) then

Set ExistingPoint = Selection.Item2(1).Value : ExistingPoint.GetCoordinates WindowLocation : Selection.Clear end if

'We clean-up the temporary circle

if (TempCircleHasBeenCreatedAtLeastOnce) then Selection.Add Circle2D : Selection.Delete end if

'We create the circle

Radius = Sqr(((WindowLocation(0)-XCenter)*(WindowLocation(0)-XCenter))+ _ ((WindowLocation(1)-YCenter)*(WindowLocation(1)-YCenter)))

Set Circle2D = Factory2D.CreateClosedCircle(XCenter,YCenter,Radius) : Selection.Add Circle2D

o Func

iPlanarGeometricObject, iMessage, iFilterType,

iObjectSelectionBeforeCommandUsePossibility,

iTooltip,

iTriggeringOnMouseMove, oObjectSelected,

IndicateOrSelectElement3DCATIABase (

CATBSTR CATSafeArrayVariant

boolean boolean boolean boolean

CATSafeArrayVarianoWindowLocation2D,

t

CATSafeArrayVariant

oWindowLocation3D) As CATBSTR

Runs an interactive command enabling both indication and selection, 3D version.

Role: IndicateOrSelectElement3D runs an interactive command into a 3D document window, asking to the user to select a location into the window, or to select an object. See

Document.Indicate3D and SelectElement3.

Parameters:

iPlanarGeometricObject A planar geometric object.

iMessage

A string which instructs the user that he must select a location into the document window or select an object. iFilterType

An array of strings constants to be used as a filter for the kind of element to select. iObjectSelectionBeforeCommandUsePossibility

Enables the script to support the possibility, for the user, to select a required object before running the script. See

SelectElement2 .

iTooltip

Displays a tooltip as soon as an object is located under the mouse without being selected. iTriggeringOnMouseMove

Triggers as soon as a mouse move event is detected. This option beeing set, oOutputState may be valued to \ oObjectSelected

depth of the investigation field.

Note: After the execution of the Search method, there may be, among the selected features, some which are not exposed to automation. Example:

The following example searches the objects matching the following criterium in all the document: Part.Sketcher.Color='White' . A selected DMU Navigator URL put into the selection although it is not exposed to automation.

CATIA.ActiveDocument.Selection.Search(\

o

Func

SelectElement2(

, CATSafeArrayVariant iFilterType

CATBSTR

boolean

iMessage,

iObjectSelectionBeforeCommandUsePossibility)

As

CATBSTR

Runs an interactive selection command.

Role: SelectElement2 filters the selection with respect to provided automation types.

? If iObjectSelectionBeforeCommandUsePossibility is equal to False:

The end user is asked to interactively select an appropriate element. When this is done, the Selection object is cleared, and filled with the selected element. ? If iObjectSelectionBeforeCommandUsePossibility is equal to True:

SelectElement2 determines whether the automation objects specified in

SelectedElement.Value, for the SelectedElement objects contained in the current selection, or

one of the parents of the automation objects (see AnyObject.Parent) is an appropriate element:

o If it is the case, no interaction is asked to the end user, the Selection object is cleared,

and filled with the appropriate element.

o Otherwise, the Selection object is cleared, and the end user is asked to interactively

select an appropriate element. When this is done, the selection is filled with the selected element.

Note: During the selection scan to find an automation object, a \string constant specified in iFilterType will imply that SelectElement2 will also look at the possible automation object specified in SelectedElement.LeafProduct .

After a call to SelectElement2, if the return value equals to \Count2 method will return one, and a call to Item2(1) will return the selected element.

Note:If the scripting language is Visual Basic for Applications or Visual Basic 6 Development Studio, then, you have to know that during the execution of an interactive selection method such as this one, no form (dialog box) must be displayed, otherwise it would lead to unpredictible results. In a form method, before calling an interactive selection method such as Selection.SelectElement2, you must hide all forms, and, after the call to the method, you must show the forms. Parameters: iFilterType

An array of strings constants to be used as a filter for the kind of element to select. The resulting filter is a logical OR of the supplied strings constants. For instance if the array contains two elements \ and \, the function will return any element which is either a point or a line. Beside the automation object names, the

CATSelectionFilter value names are supported.

iMessage

A string which instructs the user what to select. This string is displayed in the message area located at the left of the power input area.

iObjectSelectionBeforeCommandUsePossibility

Enables the script to support the possibility, for the user, to select a required object before running the script. If the scripter:

? writes a script calling SelectElement2, giving as iFilterType parameter an array containing one

string: \

? for the first call to SelectElement2 made by the script, the

iObjectSelectionBeforeCommandUsePossibility is set to True

? the scripter associates the script to an Icon. He will proceed as following:

o in the Tools menu, select the Customize item. A window appears. o select the Commands Tab. The window contains two lists. o in the list on the left, select the Macros value o select the \

o select the button on the right of the Icon label. A window containing a list of icons

appears o select an Icon

o select the Close button. The window containing the icon list disappears

o in the list on the right, push the key 1 of the mouse, the cursor beeing on the macro to

associate to an Icon. Then drag to a desired Toolbar. The Icon has been added to the Toolbar.

Then the user will be able to implement the following scenario:

? select a Pad

? select the Icon mentioned above. This runs the script.

During the execution of the script, the script will detect that the selected Pad is required as input, and the first call to SelectElement2 will not ask to the user to interactively select a Pad: the Pad selected before the script execution will be taken.

Note:Regarding the features selected by the user (a Pad in the example above), all the automation objects specified in SelectedElement.Value for the current selection SelectedElement objects must be used: if an automation object specified in SelectedElement.Value is not asked by the input filter, the SelectElement2 method will ask the user to interactively select an appropriate element.

oOutputState

The state of the selection command once SelectElement2 returns. It can be either \(the selection has succeeded), \(the user wants to cancel the VB command, which must exit immediately), \

Note:The \

? an external command has been selected ? the ESCAPE key has been selected

? another window has been selected, the window document beeing another document than the

current document

Caution:All scripts should exit (after the necessary cleanings) when the \ If the script does not exit (beside the cleanings) when the \interactive method such as SelectElement2 , and, during execution, the user select an external command (which triggers the return of the \method will display an error message. Example:

The following example asks the end user to select a sketch (see Sketch ) in the current window, and creates a Pad (see ShapeFactory.AddNewPad ). Then, it asks the end user to select an edge of the pad, and creates an edge fillet. Then, is asks the end user to select a 1-D entity whose geometry is rectilinear (see CATSelectionFilter ), such as an edge of the Pad. Then, is asks the end user to select a pad face, and creates a hole at the face selected point, the hole direction being the direction of the 1-D selected entity.

Dim

Document,Part,Selection,ShapeFactory,SketchHasBeenAcquiredAtLeastOnce,EdgeHasBeenAcquiredAtLeastOnce Dim

FaceHasBeenAcquiredAtLeastOnce,MonoDimEntityHasBeenAcquiredAtLeastOnce,FirstExtrudeNotFinished,FilletEdge Dim

PadNotFinished,Status,SketchForPad,Pad,FilletNotFinished,Fillet,MonoDimEntityDeterminationNotFinished Dim

SelectedElement,MonoDimEntity,HoleNotFinished,PadFace,Hole,InputObjectType(0),HoleLocation(2)

Set Document = CATIA.ActiveDocument : Set Part = Document.Part : Set Selection = Document.Selection

Set ShapeFactory = Part.ShapeFactory

SketchHasBeenAcquiredAtLeastOnce = False : EdgeHasBeenAcquiredAtLeastOnce = False FaceHasBeenAcquiredAtLeastOnce = False : MonoDimEntityHasBeenAcquiredAtLeastOnce = False

FirstExtrudeNotFinished = True : PadNotFinished = True : ReDim SelectionAtBeginning(1) 'We save the current selection content

ReDim SelectionAtBeginning(Selection.Count2) for SelectionObjectIndex = 0 to Selection.Count2-1

Set SelectionAtBeginning(SelectionObjectIndex) = Selection.Item2(1).Value next

SelectionAtBeginningLength = Selection.Count2 'Feature creation

do while PadNotFinished

' We propose to the user that he select a sketch InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType,\ if ((Status = \' We restore the selection to its initial content Selection.Clear

for SelectionObjectIndex = 0 to SelectionAtBeginningLength-1 Selection.Add SelectionAtBeginning(SelectionObjectIndex) next Exit Sub

elseif (Status = \ ' We do nothing: Redo has no meaning in this context else

if (Status <> \ SketchHasBeenAcquiredAtLeastOnce = True ' We create the Pad

Set Pad = ShapeFactory.AddNewPad(SketchForPad,20.0) Pad.SecondLimit.Dimension.Value = 0.0 : Part.Update PadNotFinished = False Selection.Clear

' We create the fillet and the hole FilletNotFinished = True

do while (FilletNotFinished And Not PadNotFinished) ' We propose to the user that he select an edge InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType,\Pad\

if (Status = \

' We remove the pad, restore the selection to its initial content and go out

Selection.Clear : Selection.Add(Pad) : Selection.Delete Part.Update Selection.Clear

for SelectionObjectIndex = 0 to SelectionAtBeginningLength-1 Selection.Add SelectionAtBeginning(SelectionObjectIndex) next Exit Sub

elseif (Status = \ ' We do nothing: Redo has no meaning in this context

elseif (Status = \' We remove the pad

Selection.Clear : Selection.Add(Pad) : Selection.Delete Part.Update

PadNotFinished = True else

if (Status <> \ EdgeHasBeenAcquiredAtLeastOnce = True ' Create the Fillet Set Fillet =

ShapeFactory.AddNewSolidEdgeFilletWithConstantRadius(FilletEdge, catTangencyFilletEdgePropagation,5.0) Part.Update

FilletNotFinished = False Selection.Clear

' Determine the 1-D entity

MonoDimEntityDeterminationNotFinished = True

do while (MonoDimEntityDeterminationNotFinished And Not FilletNotFinished)

' We propose to the user that he select 1-D entity whose geometry is rectilinear

InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType, _

\rectilinear\

if (Status = \

' We remove the fillet, the pad, restore the selection to its initial content and go out

Selection.Clear : Selection.Add(Fillet) : Selection.Delete Selection.Clear : Selection.Add(Pad) : Selection.Delete Part.Update Selection.Clear

for SelectionObjectIndex = 0 to SelectionAtBeginningLength-1 Selection.Add SelectionAtBeginning(SelectionObjectIndex) next Exit Sub

elseif (Status = \MonoDimEntityHasBeenAcquiredAtLeastOnce ) then

' We do nothing: Redo has no meaning in this context elseif (Status = \' We remove the fillet

Selection.Clear : Selection.Add(Fillet) : Selection.Delete Part.Update

FilletNotFinished = True

else

if (Status = \

Selection.Clear : Selection.Add(MonoDimEntity) else

Set SelectedElement = Selection.Item2(1) Set MonoDimEntity = SelectedElement.Value end if

MonoDimEntityHasBeenAcquiredAtLeastOnce = True MonoDimEntityDeterminationNotFinished = False ' Create the Hole

HoleNotFinished = True

do while (HoleNotFinished And Not MonoDimEntityDeterminationNotFinished)

' We propose to the user that he select a face InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType, _

\a face perpendicular to the 1-D entity\

if (Status = \

' We remove the fillet, the pad, restore the selection to its initial content and go out

Selection.Clear : Selection.Add(Fillet) : Selection.Delete

Selection.Clear : Selection.Add(Pad) : Selection.Delete Selection.Clear

for SelectionObjectIndex = 0 to SelectionAtBeginningLength-1

Selection.Add SelectionAtBeginning(SelectionObjectIndex) next

Part.Update Exit Sub

elseif (Status = \FaceHasBeenAcquiredAtLeastOnce ) then

' We do nothing: Redo has no meaning in this context elseif (Status = \ Selection.Clear

' The 1-D entity must be re-selected

MonoDimEntityDeterminationNotFinished = True else

if (Status <> \

Set SelectedElement = Selection.Item2(1) Set PadFace = SelectedElement.Value

SelectedElement.GetCoordinates HoleLocation

end if

FaceHasBeenAcquiredAtLeastOnce = True ' We create the Hole Set Hole =

Part.ShapeFactory.AddNewHoleFromPoint(HoleLocation(0),HoleLocation(1),HoleLocation(2),PadFace,10.0)

Hole.ThreadingMode = 1 : Hole.ThreadSide = 0 : Hole.Diameter.Value = 5.0

Hole.SetDirection FilletEdge Part.Update

HoleNotFinished = False end if loop end if loop end if loop end if loop

o Func SelectElement3( CA TSafeArrayVariant iFilterType,

CATBSTR

boolean boolean

iMessage,

iObjectSelectionBeforeCommandUsePossibility, iTooltip) As CATBSTR

, CATMultiSelectionMode iMultiSelectionMode

Runs an interactive selection command, exhaustive version.

Role: SelectElement3 filters the selection with respect to provided automation types. It is identical to the SelectElement2 method except that it manages complex uses through the specification of 2

more parameters. Parameters: iFilterType

An array of strings constants to be used as a filter for the kind of element to select. iMessage

A string which instructs the user what to select. This string is displayed in the message area located at the left of the power input area.

iObjectSelectionBeforeCommandUsePossibility

Enables the script to support the possibility, for the user, to select required object(s) before running the script. See

SelectElement2 .

iMultiSelectionMode

The type of multi-selection which will be offered to the user. iTooltip

Displays a tooltip as soon as an object is located under the mouse without being selected. oOutputState

The state of the selection command once SelectElement3 returns. It can be either \Cancel\\SelectElement2 . Example:

This first example asks the end user to select several points (see Point ) into the current Part window, drawing a trap, and performs a symmetry with respect to the XZ plane on the selected points (see

HybridShapeSymmetry ). The points can be selected before the script be run.

Dim

Document,Part,Selection,HybridShapeFactory,HybridBodies,HybridBody,OriginElements,Plane,PlaneReference,Status

Dim InputObjectType(0),PointIndex,PointReference,HybridShapeSymmetry

Set Document = CATIA.ActiveDocument : Set Part = Document.Part : Set Selection = Document.Selection

Set HybridShapeFactory = Part.HybridShapeFactory Set Bodies = Part.Bodies

Set Body = Bodies.Item(\ Set OriginElements = Part.OriginElements Set Plane = OriginElements.PlaneZX

Set PlaneReference = Part.CreateReferenceFromObject(Plane)

'We propose to the user that he select several points, drawing a trap InputObjectType(0)=\

Status=Selection.SelectElement3(InputObjectType,\ true,CATMultiSelTriggWhenSelPerf,false) if (Status = \ For PointIndex = 1 to Selection.Count2 Set PointReference =

Part.CreateReferenceFromObject(Selection.Item2(PointIndex).Value) Set HybridShapeSymmetry =

HybridShapeFactory.AddNewSymmetry(PointReference,PlaneReference) HybridShapeSymmetry.VolumeResult = False Body.InsertHybridShape HybridShapeSymmetry Part.InWorkObject = HybridShapeSymmetry Part.Update next

Selection.Clear

Example:

This second example illustrates the use of the CATMultiSelTriggWhenUserValidatesSelection value for the iMultiSelectionMode parameter. This example is a training tool enabling the user to learn how to use the \ It creates a drawing containing a line and three points, and guides the user in:

? the selection of points

? the selection of the symmetry axis

the selected points being moved by symmetry according to the selected axis.

'We create a drawing

Set Documents = CATIA.Documents : Set Document = Documents.Add(\Document.Standard = catISO

Set DrawingSheets = Document.Sheets : Set DrawingSheet = DrawingSheets.Item(\ DrawingSheet.PaperSize = catPaperA0 : DrawingSheet.Scale = 1.000000 : DrawingSheet.Orientation = catPaperLandscape

Set DrawingViews = DrawingSheet.Views : Set DrawingView = DrawingViews.ActiveView Set Factory2D = DrawingView.Factory2D : Set Selection = Document.Selection : Dim Coordinates(2)

ReDim InputObjectType(0) : Dim SelectedPoint(3) : SelectedPointCount = 0 'We create a horizontal line with a zero ordinate

Set LineLeftExtremity = Factory2D.CreatePoint(-100.0, 0.0) : LineLeftExtremity.ReportName = 3

Set LineRightExtremity = Factory2D.CreatePoint(100.0, 0.0) : LineRightExtremity.ReportName = 4

Set Line2D = Factory2D.CreateLine(-100.0, 0.0, 100.0, 0.0) : Line2D.ReportName = 5 Line2D.StartPoint = LineLeftExtremity : Line2D.EndPoint = LineRightExtremity 'We create three points

Set Point2D1 = Factory2D.CreatePoint(-50.0, 50.0) : Point2D1.ReportName = 6 : Point2D1.Construction = False

Set Point2D2 = Factory2D.CreatePoint(0.0, 70.0) : Point2D2.ReportName = 7 : Point2D1.Construction = False

Set Point2D3 = Factory2D.CreatePoint(50.0, 50.0) : Point2D3.ReportName = 8 : Point2D3.Construction = False

'We mention to the user that he will select the set of elements to be symmetrized msgbox \tool will enable you to learn how to use the Symmetry command.\& Chr(13) & Chr(13) & _

\ \ 'We propose to the user that he select several points InputObjectType(0)=\

Status=Selection.SelectElement3(InputObjectType,\symmetrized\

true,CATMultiSelTriggWhenUserValidatesSelection,false) if (Status = \

'We add the selected points to SelectedPoint for PointIndex = 0 to Selection.Count2-1

Set SelectedPoint(PointIndex) = Selection.Item2(PointIndex+1).Value : SelectedPointCount = SelectedPointCount+1 next

'We mention to the user that he will select the axis from which the elements will remain equidistant

msgbox \will then select the line from which the elements will remain equidistant\ 'We propose to the user that he select the line

InputObjectType(0)=\

Status=Selection.SelectElement2(InputObjectType, _

\the line or axis from which the elements will remain equidistant\

if (Status = \

'We move the selected points by symmetry according to the selected line for PointIndex = 0 to SelectedPointCount-1

Set CurrentPoint2D = SelectedPoint(PointIndex) CurrentPoint2D.GetCoordinates Coordinates

CurrentPoint2D.SetData Coordinates(0), -Coordinates(1) next

Selection.Clear

'We mention to the user that the points have successfully been moved msgbox \

o Func SelectElement4( CA TSafeArrayVariant iFilterType,

CATBSTR CATBSTR

boolean

iActiveDocumentMessage, iNonActiveDocumentMessage, iTooltip,

oDocument) As CATBSTR

CATIADocument

Runs an interactive selection command, enabling the selection in a non active document.

Role: SelectElement4 filters the selection into a non active document, with respect to provided automation types (which relate to the regarded non active document).

This method may be used, for example, to write a script which does the following:

? a drawing is currently edited

? request that the user select a reference plane in the 3D geometry (a part)

? creation of a front view in the drawing, projecting the 3D geometry onto the selected reference

plane

Compared to the SelectElement2 , the result of the selection will not be accessed through the Count2 and Item2 methods of the current selection object, but through the Count2 and Item2 methods of the Selection object aggregated by the Document object returned through the oDocument parameter. Note:The Selection object aggregated by the Document object returned through the oDocument parameter is emptied by before the effective interactive selection. Parameters: iFilterType

An array of strings constants to be used as a filter for the kind of element to select. iActiveDocumentMessage

A string which instructs the user what to select, which will be displayed into the active document. This string is displayed in the message area located at the left of the power input area. iNonActiveDocumentMessage

A string which instructs the user what to select, which will be displayed into the non active document.

iTooltip

Displays a tooltip as soon as an object is located under the mouse without being selected. oOutputState

The state of the selection command once SelectElement3 returns. It can be either \\ Example:

The following example supposes a part, containing a pad, and drawing are currently edited, the drawing window beeing the current window. It asks the end user to select a 2-D topological entity, such as a Plane, in a part. Then it creates a front view in the drawing, projecting the 3D geometry onto the selected 2-D topological entity.

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)=\

Status=DrawingSelection.SelectElement4(InputObjectType,\entity in a 3-D geometry\

\entity\

if ((Status = \' 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=\ BiDimFeature.GetFirstAxis V1 BiDimFeature.GetSecondAxis V2

else Exit Sub end if

' We create a view called \View\in the current sheet, using Plane as projection plane, and whose origin ' coordinates are 300,150

Set DrawingFrontView = DrawingSheet.Views.Add(\

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

本文来源:https://www.bwwdw.com/article/4qe5.html

Top