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

2020-02-22 13:08

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.


Catia坐标点输出程序相关函数及参数(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:吊索具使用维护作业指导书 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: