forked from 454a1/CATIA_VBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddNewCircleCtrRad.txt
50 lines (31 loc) · 1.08 KB
/
AddNewCircleCtrRad.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
Attribute VB_Name = "AddNewCircleCtrRad"
Sub CATMain()
On Error Resume Next
Dim oPart As Part
Dim oBodies As Bodies
Dim oBody As Body
Dim oHSF As HybridShapeFactory
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 oBodies = oPart.Bodies
Set oHSF = oPart.HybridShapeFactory
Set oBody = oBodies.Item("Áã¼þ¼¸ºÎÌå")
Dim oPt As Point
Set oPt = oHSF.AddNewPointCoord(0#, 0#, 0#)
oBody.InsertHybridShape oPt
Dim oRefPt As Reference
Set oRefPt = oPart.CreateReferenceFromObject(oPt)
Dim oPlane As Plane
Set oPlane = oPart.OriginElements.PlaneXY
Dim oRefplane As Reference
Set oRefplane = oPart.CreateReferenceFromObject(oPlane)
Dim oCircle As HybridShapeCircle
Set oCircle = oHSF.AddNewCircleCtrRad(oRefPt, oRefplane, False, 20#)
oBody.InsertHybridShape oCircle
oPart.Update
End Sub