📄 clspulldirection.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsPullDirection"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Description = "User defined pull plane direction. Used in calculation of surface suitability for molds"
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'local variable(s) to hold property value(s)
Private mvarVectorX As Double 'local copy
Private mvarVectorY As Double 'local copy
Private mvarVectorZ As Double 'local copy
Private mvarMinDraftAngle As Double 'local copy
Public Property Let MinDraftAngle(ByVal vData As Double)
Attribute MinDraftAngle.VB_Description = "Minimum draft angle desired in part. Moldability will flag surfaces with color that are not drafted by atleast this amount"
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.MinDraftAngle = 5
mvarMinDraftAngle = vData
End Property
Public Property Get MinDraftAngle() As Double
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.MinDraftAngle
MinDraftAngle = mvarMinDraftAngle
End Property
Public Function SetNormalDirection(Part As Object) As Boolean
Attribute SetNormalDirection.VB_Description = "Use a selected reference plane or planar face to set the unit vector for pull plane direction"
'Use a selected reference plane or planar face to set the unit vector for
'pull plane direction
Dim SelMgr As Object ' list of selected items in SW
Dim SelObj As Object ' Sw object in selection list
Dim SelectedType As Long ' Feature type of selected object
Dim PlaneParams As Variant ' plane info returned from SW
Const swSelFACES = 2 ' Types returned from SW
Const swSelDATUMPLANES = 4
SetNormalDirection = False
mvarVectorX = 0
mvarVectorY = 0
mvarVectorZ = 0
Set SelMgr = Part.SelectionManager
If SelMgr.GetSelectedObjectCount > 0 Then ' Something is selected
Set SelObj = SelMgr.GetSelectedObject2(1) ' get 1st item from selection list
SelectedType = SelMgr.GetSelectedObjectType(1) 'get type of 1st item
Select Case SelectedType
Case swSelDATUMPLANES
Set SelObj = SelObj.GetSpecificFeature
PlaneParams = SelObj.GetRefPlaneParams
mvarVectorX = PlaneParams(6)
mvarVectorY = PlaneParams(7)
mvarVectorZ = PlaneParams(8)
SetNormalDirection = True
Case swSelFACES
PlaneParams = SelObj.Normal ' get normal vector for face from SW
If Not (PlaneParams(0) = 0 And PlaneParams(1) = 0 And PlaneParams(2) = 0) Then
' normal vector returned, face IS a plane
mvarVectorX = PlaneParams(0)
mvarVectorY = PlaneParams(1)
mvarVectorZ = PlaneParams(2)
SetNormalDirection = True
End If
End Select
End If
End Function
Public Property Get VectorZ() As Double
Attribute VectorZ.VB_Description = "Unit vector, Z component"
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.VectorZ
VectorZ = mvarVectorZ
End Property
Public Property Get VectorY() As Double
Attribute VectorY.VB_Description = "Unit vector, Y component"
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.VectorY
VectorY = mvarVectorY
End Property
Public Property Get VectorX() As Double
Attribute VectorX.VB_Description = "Unit vector, X component"
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.VectorX
VectorX = mvarVectorX
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -