forked from 454a1/CATIA_VBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path零件序号的插入 .txt
32 lines (32 loc) · 1.22 KB
/
零件序号的插入 .txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Dim Drw As DrawingDocument
Set Drw = CATIA.ActiveDocument
Dim DrwSheets As DrawingSheets
Set DrwSheets = Drw.Sheets
Dim DrwSheet As DrawingSheet
Set DrwSheet = DrwSheets.ActiveSheet
Dim SheetViews As DrawingViews
Set SheetViews = DrwSheet.Views
Dim SheetView As DrawingView
Set SheetView = SheetViews.Item(1) ' SheetViews.ActiveView
Dim EvI As Integer
EvI = 1
Dim txts As DrawingTexts
Set txts = SheetView.Texts
Dim Txt As DrawingText
Dim DrwLeader As DrawingLeader
Dim PointS(2) 'As Double
Dim XScale As Double
XScale = DrwSheet.Scale2
Dim drwSel 'As Selection
Dim selStatus As String, SelType(0)
Set drwSel = Drw.Selection
SelType(0) = "AnyObject"
Do While EvI > 0
drwSel.Clear
selStatus = drwSel.SelectElement2(SelType, "Please select a position what you want insert the txt", False)
If selStatus = "Cancel" Then Exit Do
drwSel.Item(1).GetCoordinates PointS
Set Txt = txts.Add(CStr(EvI), (PointS(0) + 50) / XScale, (PointS(1) + 50) / XScale)
Txt.SetFontSize 0, 0, 3.5
Set DrwLeader = Txt.Leaders.Add(PointS(0) / XScale, PointS(1) / XScale)
Loop