forked from 454a1/CATIA_VBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreate a draft feature.txt
32 lines (32 loc) · 1.41 KB
/
Create a draft feature.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
Sub Draft()
Dim InputObjectType(0)
Dim document As PartDocument
Set document = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = document.Part
Dim ShapeFactory As ShapeFactory
Set ShapeFactory = part1.ShapeFactory
Set Selection = document.Selection
'We propose to the user that he select the face to draft
InputObjectType(0) = "Face"
Status = Selection.SelectElement2(InputObjectType, "Select the face to draft", True)
If (Status = "cancel") Then Exit Sub
Set FaceToDraft = Selection.Item(1).Value
Selection.Clear
'We propose to the user that he select the neutral face
InputObjectType(0) = "PlanarFace"
Status = Selection.SelectElement2(InputObjectType, "Select the neutral face", True)
If (Status = "cancel") Then Exit Sub
Set NeutralFace = Selection.Item(1).Value
Selection.Clear
'We propose to the user that he select the parting element
InputObjectType(0) = "PlanarFace"
Status = Selection.SelectElement2(InputObjectType, "Select the parting element", True)
If (Status = "cancel") Then Exit Sub
Set PartingElement = Selection.Item(1).Value
Set Draft = ShapeFactory.AddNewDraft(FaceToDraft, NeutralFace, 0, PartingElement, 0#, 0#, 1#, 0, 5#, 0)
Set DraftDomains = Draft.DraftDomains
Set DraftDomain = DraftDomains.Item(1)
DraftDomain.SetPullingDirection 0#, 0#, 1#
part1.Update
End Sub