forked from 454a1/CATIA_VBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path曲面设计不创建几何图形集方法.txt
51 lines (33 loc) · 1.14 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'Attribute VB_Name = "曲面设计不创建几何图形集方法"
Sub CATMain()
On Error Resume Next
Dim oPart As Part
Dim oHSF As HybridShapeFactory
Dim oBodies As bodies
Dim oBody As Body
Set oPart = CATIA.ActiveDocument.Part
If Err.Number <> 0 Then
Dim oDoc As Document
Set oDoc = CATIA.Documents.Add("Part")
Set oPart = oDoc.Part
End If
On Error GoTo 0
Set oHSF = oPart.HybridShapeFactory
Set oBodies = oPart.bodies
Set oBody = oBodies.Item("零件几何体")
Dim Point1 As HybridShapePointCoord
Set Point1 = oHSF.AddNewPointCoord(0#, 2#, 3#)
'使用InsertHybridShape可以不添加几何图形集
oBody.InsertHybridShape Point1
Dim oRefPt As Reference
Set oRefPt = oPart.CreateReferenceFromObject(Point1)
oHSF.GSMVisibility oRefPt, 0
'定义方向
Dim dir As HybridShapeDirection
Set dir = oHSF.AddNewDirectionByCoord(1#, 2#, 3#)
Dim oLine As Line
Set oLine = oHSF.AddNewLinePtDir(oRefPt, dir, 0#, 100#, False)
oBody.InsertHybridShape oLine
'更新
oPart.Update
End Sub