AnsweredAssumed Answered

Property manager question

Question asked by Vincent Pomerleau on Apr 9, 2018
Latest reply on Apr 10, 2018 by Vincent Pomerleau

Hello!

the pm_Selection.SingleEntityOnly  property doesn't work in this macro, I'm able to select more than one entity, any idea

 

' Handler for PropertyManager page controls

 

 

Implements PropertyManagerPage2Handler9

 

 

' Control objects required for the PropertyManager page

 

 

Public pm_Page                              As PropertyManagerPage2

 

 

Public pm_GroupEntities                     As PropertyManagerPageGroup

Public pm_GroupTool                         As PropertyManagerPageGroup

Public pm_GroupFS                           As PropertyManagerPageGroup

Public pm_GroupContourSide                  As PropertyManagerPageGroup

Public pm_GroupContourDepth                 As PropertyManagerPageGroup

Public pm_GroupContourMethod                As PropertyManagerPageGroup

Public pm_GroupContourChamfer               As PropertyManagerPageGroup

Public pm_GroupDrill                        As PropertyManagerPageGroup

Public pm_GroupNC_Rapid                     As PropertyManagerPageGroup

Public pm_GroupNC_Clear                     As PropertyManagerPageGroup

Public pm_GroupNC_Feed                      As PropertyManagerPageGroup

Public pm_GroupNC_Retract                   As PropertyManagerPageGroup

Public pm_GroupNC_CNC_Comp                  As PropertyManagerPageGroup

Public pm_GroupNC_TP_Comp                   As PropertyManagerPageGroup

Public pm_GroupMirror                       As PropertyManagerPageGroup

Public pm_GroupLeadin                       As PropertyManagerPageGroup

 

 

Public pm_ToolTab                           As PropertyManagerPageTab

Public pm_FSTab                             As PropertyManagerPageTab

Public pm_ContourTab                        As PropertyManagerPageTab

Public pm_DrillTab                          As PropertyManagerPageTab

Public pm_NCTab                             As PropertyManagerPageTab

Public pm_MirrorTab                         As PropertyManagerPageTab

Public pm_LeadinTab                         As PropertyManagerPageTab

 

 

Public pm_Selection                         As PropertyManagerPageSelectionbox

'Public pm_Selection1                        As PropertyManagerPageSelectionbox

 

 

Public pm_OperList                          As PropertyManagerPageListbox

Public pm_ToolcribList                      As PropertyManagerPageListbox

Public pm_MachineList                       As PropertyManagerPageListbox

 

 

Public pm_CheckboxMaintainClimb             As PropertyManagerPageCheckbox

Public pm_CheckboxKeepOriginal              As PropertyManagerPageCheckbox

Public pm_CheckboxSideSingleCut             As PropertyManagerPageCheckbox

Public pm_CheckboxSideIgnoreAirSeg          As PropertyManagerPageCheckbox

Public pm_CheckboxSideZigZag                As PropertyManagerPageCheckbox

Public pm_CheckboxChamfer                   As PropertyManagerPageCheckbox

Public pm_CheckboxNCrapidUseSetupDef        As PropertyManagerPageCheckbox

Public pm_CheckboxNCclearUseSetupDef        As PropertyManagerPageCheckbox

Public pm_CheckboxNCUseSkimPlane            As PropertyManagerPageCheckbox

 

 

Public pm_LabelMachineList                  As PropertyManagerPageLabel

Public pm_LabelTool                         As PropertyManagerPageLabel

Public pm_LabelOffsetX                      As PropertyManagerPageLabel

Public pm_LabelOffsetY                      As PropertyManagerPageLabel

Public pm_LabelAxis                         As PropertyManagerPageLabel

Public pm_LabelRPM                          As PropertyManagerPageLabel

Public pm_LabelFeed                         As PropertyManagerPageLabel

Public pm_LabelZFeed                        As PropertyManagerPageLabel

Public pm_LabelLeadFeed                     As PropertyManagerPageLabel

Public pm_LabelFinalFeed                    As PropertyManagerPageLabel

Public pm_LabelSideAllow                    As PropertyManagerPageLabel

Public pm_LabelSideCutAmt                   As PropertyManagerPageLabel

Public pm_LabelSideFinCutAmt                As PropertyManagerPageLabel

Public pm_LabelSidePrevAllow                As PropertyManagerPageLabel

Public pm_LabelSideSpringPass               As PropertyManagerPageLabel

Public pm_LabelSideZigZag                   As PropertyManagerPageLabel

Public pm_LabelSideSingleCut                As PropertyManagerPageLabel

Public pm_LabelSideIgnoreAirSeg             As PropertyManagerPageLabel

Public pm_LabelFSmethod                     As PropertyManagerPageLabel

Public pm_LabelDepthMethod                  As PropertyManagerPageLabel

Public pm_LabelDepthRamp                    As PropertyManagerPageLabel

Public pm_LabelDepthAllow                   As PropertyManagerPageLabel

Public pm_LabelDepthFirstCut                As PropertyManagerPageLabel

Public pm_LabelDepthMaxCut                  As PropertyManagerPageLabel

Public pm_LabelDepthFinCut                  As PropertyManagerPageLabel

Public pm_LabelDepthRampAngle               As PropertyManagerPageLabel

Public pm_LabelChamferAngle                 As PropertyManagerPageLabel

Public pm_LabelChamferLength                As PropertyManagerPageLabel

Public pm_LabelChamferClear                 As PropertyManagerPageLabel

Public pm_LabelChamferFeatEdge              As PropertyManagerPageLabel

Public pm_LabelDrillCycle                   As PropertyManagerPageLabel

Public pm_LabelDrillFirstPeck               As PropertyManagerPageLabel

Public pm_LabelDrillSubPeck                 As PropertyManagerPageLabel

Public pm_LabelDrillDwell                   As PropertyManagerPageLabel

Public pm_LabelNCrapidDist                  As PropertyManagerPageLabel

Public pm_LabelNCclearDist                  As PropertyManagerPageLabel

Public pm_LabelNCfeedDist                   As PropertyManagerPageLabel

Public pm_LabelNCretractDist                As PropertyManagerPageLabel

 

 

Public pm_NumberTool                        As PropertyManagerPageNumberbox

Public pm_NumberRPM                         As PropertyManagerPageNumberbox

Public pm_NumberFeed                        As PropertyManagerPageNumberbox

Public pm_NumberZFeed                       As PropertyManagerPageNumberbox

Public pm_NumberLeadFeed                    As PropertyManagerPageNumberbox

Public pm_NumberFinalFeed                   As PropertyManagerPageNumberbox

Public pm_NumberSideAllow                   As PropertyManagerPageNumberbox

Public pm_NumberSideCutAmt                  As PropertyManagerPageNumberbox

Public pm_NumberSideFinCutAmt               As PropertyManagerPageNumberbox

Public pm_NumberSidePrevAllow               As PropertyManagerPageNumberbox

Public pm_NumberSideSpringPass              As PropertyManagerPageNumberbox

Public pm_NumberOffsetX                     As PropertyManagerPageNumberbox

Public pm_NumberOffsetY                     As PropertyManagerPageNumberbox

Public pm_NumberDepthAllow                  As PropertyManagerPageNumberbox

Public pm_NumberDepthFirstCut               As PropertyManagerPageNumberbox

Public pm_NumberDepthMaxCut                 As PropertyManagerPageNumberbox

Public pm_NumberDepthFinCut                 As PropertyManagerPageNumberbox

Public pm_NumberDepthRampAngle              As PropertyManagerPageNumberbox

Public pm_NumberChamferAngle                As PropertyManagerPageNumberbox

Public pm_NumberChamferLength               As PropertyManagerPageNumberbox

Public pm_NumberChamferClear                As PropertyManagerPageNumberbox

Public pm_NumberDrillFirstPeck              As PropertyManagerPageNumberbox

Public pm_NumberDrillSubPeck                As PropertyManagerPageNumberbox

Public pm_NumberDrillDwell                  As PropertyManagerPageNumberbox

Public pm_NumberNCrapidDist                 As PropertyManagerPageNumberbox

Public pm_NumberNCclearDist                 As PropertyManagerPageNumberbox

Public pm_NumberNCfeedDist                  As PropertyManagerPageNumberbox

Public pm_NumberNCretractDist               As PropertyManagerPageNumberbox

 

 

Public pm_ButtonCancelMirror                As PropertyManagerPageButton

 

 

Public pm_ComboFSmethod                     As PropertyManagerPageCombobox

Public pm_ComboDepthMethod                  As PropertyManagerPageCombobox

Public pm_ComboDepthRamp                    As PropertyManagerPageCombobox

Public pm_ComboChamferFeatEdge              As PropertyManagerPageCombobox

Public pm_ComboDrillCycle                   As PropertyManagerPageCombobox

Public pm_ComboNC_Rapid                     As PropertyManagerPageCombobox

Public pm_ComboNC_Clear                     As PropertyManagerPageCombobox

Public pm_ComboNC_Feed                      As PropertyManagerPageCombobox

 

Public pm_RadioClimb                        As PropertyManagerPageOption

Public pm_RadioConventional                 As PropertyManagerPageOption

 

 

Public pm_Slider                            As PropertyManagerPageSlider

Public pm_BMPButton                         As PropertyManagerPageBitmapButton

Public pm_BMPButton1                        As PropertyManagerPageBitmapButton

Public pm_Bitmap                            As PropertyManagerPageBitmap

Public pm_ActiveX                           As PropertyManagerPageActiveX

 

 

Public PartDoc                              As CWPartDoc

Public cwSelMgr                             As CWSelectionMgr

Public swSelMgr                             As selectionMgr

Public featManager                          As FeatureManager

Public activeComp                           As SldWorks.Component2

Public cwDoc                                As cwDoc

Public cwTlCrib                             As CWToolcrib

Public cwTl                                 As CWTool

Public currFeat                             As feature

Public subFeat                              As feature

Public cwMach                               As CWMachine

Public cwToolList                           As CWDispatchCollection

Public millOperation                        As CWMillOperation

Public cwNCParams                           As CWNCParam

Public swFeat                               As feature

Public FeatList                             As New Collection

Public features                             As New Collection

Public setup                                As Object

Public mirrorAxis                           As Object

Public setupSelected                        As Object

Public Operations                           As Object

Public userUnits                            As Object

Public axisbl                               As Boolean

Public ClickedCancel                        As Boolean

Public OpsOnly                              As Boolean

Public blDisable                            As Boolean

Public blMaintainClimb                      As Boolean

Public blKeepOriginal                       As Boolean

Public m_bLinkToFSLibrary                   As Boolean

Public m_bLeadinFeedrateByPercent           As Boolean

Public bAreOperationsSelected               As Boolean

Public m_bZFeedrateByPercent                As Boolean

Public dConversionFactor                    As Double

Public m_dSpindleSpeed                      As Double

Public m_dXYFeed                            As Double

Public m_dZFeedrate                         As Double

Public m_dLeadinFeedrate                    As Double

Public retVal                               As Long

Public options                              As Long

Public longerrors                           As Long

Public controlType                          As Long

Public alignment                            As Long

Public featCount                            As Long

Public featArr                              As Variant

Public components                           As Variant

Public intType                              As Integer

Public activeTab                            As Integer

Public sketchStr                            As String

Public strPlaneAxis                         As String

Public PageTitle                            As String

Public caption                              As String

Public tip                                  As String

Dim listItems(50)                           As String

 

 

Sub Show()

 

 

    pm_Page.Show2 0

 

 

End Sub

' Run when a new instance of the class is created

 

 

Public Sub Class_Initialize()

 

 

    Set swApp = Application.SldWorks

    Set swModel = swApp.activeDoc

    Set swSelMgr = swModel.SelectionManager

    Set cwapp = New CAMWORKSLib.cwapp

    Set cwDoc = cwapp.IGetActiveDoc

    Set cwSelMgr = cwDoc.IGetSelectionMgr

 

 

       

    ' Set the variables for the page

    PageTitle = "CAMWorks NC Manager"

 

 

    options = swPropertyManager_OkayButton _

        + swPropertyManager_CancelButton _

        + swPropertyManagerOptions_PushpinButton _

        '+ swPropertyManagerOptions_LockedPage _

 

 

    ' Create the PropertyManager page

    Set pm_Page = swApp.CreatePropertyManagerPage(PageTitle, options, Me, longerrors)

   

    ' Make sure that the page was created properly

    If longerrors = swPropertyManagerPage_Okay Then

  

       

       

        'Add selected entities group

       

        Set pm_GroupEntities = pm_Page.AddGroupBox(78, "Selected Entities", 12)

        Set pm_OperList = pm_GroupEntities.AddControl2(79, swControlType_Listbox, "", 1, 3, "Select Operation in the list")

        pm_OperList.Style = swPropMgrPageListBoxStyle_MultipleItemSelect

       

        ' Add tabs

        Set pm_ToolTab = pm_Page.AddTab(1, "Tools", "", 0)

        Set pm_FSTab = pm_Page.AddTab(2, "F/S", "", 0)

        Set pm_ContourTab = pm_Page.AddTab(3, "Contour", "", 0)

        Set pm_DrillTab = pm_Page.AddTab(4, "Drilling", "", 0)

        Set pm_NCTab = pm_Page.AddTab(5, "NC", "", 0)

        Set pm_MirrorTab = pm_Page.AddTab(6, "Mirror", "", 0)

        Set pm_LeadinTab = pm_Page.AddTab(7, "Leadin", "", 0)

       

        pm_MirrorTab.Activate

        activeTab = 10

       

        ' Add group boxes to tabs

        Set pm_GroupTool = pm_ToolTab.AddGroupBox(8, "ToolCrib", 12)

        Set pm_GroupFS = pm_FSTab.AddGroupBox(9, "Feed/Speed Parameters", 12)

        Set pm_GroupContourSide = pm_ContourTab.AddGroupBox(10, "Side Parameters", 12)

        Set pm_GroupContourDepth = pm_ContourTab.AddGroupBox(11, "Depth Parameters", 12)

        Set pm_GroupContourChamfer = pm_ContourTab.AddGroupBox(12, "Chamfer Machining", 5)

        Set pm_GroupContourMethod = pm_ContourTab.AddGroupBox(13, "Cut Method", 12)

        Set pm_GroupDrill = pm_DrillTab.AddGroupBox(14, "Drill Parameters", 12)

        Set pm_GroupNC_Rapid = pm_NCTab.AddGroupBox(93, "Rapid Plane", 12)

        Set pm_GroupNC_Clear = pm_NCTab.AddGroupBox(94, "Clearance Plane", 12)

        Set pm_GroupNC_Feed = pm_NCTab.AddGroupBox(95, "Feed Plane", 12)

        Set pm_GroupNC_Retract = pm_NCTab.AddGroupBox(96, "Retract Between Features", 12)

        Set pm_GroupNC_CNC_Comp = pm_NCTab.AddGroupBox(97, "CNC Compensation", 12)

        Set pm_GroupNC_TP_Comp = pm_NCTab.AddGroupBox(98, "Toolpath Compensation", 12)

        Set pm_GroupMirror = pm_MirrorTab.AddGroupBox(16, "Mirror Parameters", 12)

        Set pm_GroupLeadin = pm_LeadinTab.AddGroupBox(17, "Leadin Parameters", 12)

 

 

'Tools

 

 

        ' Add a toolcrib list box

        Set pm_ToolcribList = pm_GroupTool.AddControl2(18, swControlType_Listbox, "", 1, 3, tip)

        pm_ToolcribList.Style = swPropMgrPageListBoxStyle_MultipleItemSelect

               

        ' Add a tool number label & a number box

        Set pm_LabelTool = pm_GroupTool.AddControl2(19, swControlType_Label, "Station Number:", 1, 3, "")

        Set pm_NumberTool = pm_GroupTool.AddControl2(20, swControlType_Numberbox, "", 1, 3, "Enter Station Number")

        pm_NumberTool.SetRange2 swNumberBox_UnitlessInteger, -100, 100, True, 1, 1, 1

   

        ' Add a machine toolList label & a list box

        Set pm_LabelMachineList = pm_GroupTool.AddControl2(21, swControlType_Label, "Machine Tool List", 1, 3, "")

        Set pm_MachineList = pm_GroupTool.AddControl2(22, swControlType_Listbox, "", 1, 3, "")

        pm_MachineList.Style = 2

 

 

'FS

 

 

        'Add F&S method combobox

        Set pm_LabelFSmethod = pm_GroupFS.AddControl2(23, swControlType_Label, "Defined by:", 1, 3, "")

        Set pm_ComboFSmethod = pm_GroupFS.AddControl2(24, swControlType_Combobox, "", 2, 3, "Select F&S Method")

        pm_ComboFSmethod.AddItems ("Operation")

        pm_ComboFSmethod.AddItems ("Library")

        pm_ComboFSmethod.AddItems ("Tool")

        pm_LabelFSmethod.Top = 10

        pm_ComboFSmethod.Top = 10

        pm_LabelFSmethod.Width = 15

        pm_LabelFSmethod.Style = 4

       

        'Add RPM Label & number box

        Set pm_LabelRPM = pm_GroupFS.AddControl2(25, swControlType_Label, "Spindle Speed (RPM):", 1, 3, "")

        Set pm_NumberRPM = pm_GroupFS.AddControl2(26, swControlType_Numberbox, "", 2, 3, "Enter Spindle Speed")

        pm_NumberRPM.SetRange2 swNumberBox_UnitlessInteger, 0, 12000, True, 1000, 1000, 1000

        pm_LabelRPM.Top = 20

        pm_NumberRPM.Top = 20

        pm_LabelRPM.Width = 15

        pm_LabelRPM.Style = 4

        'pm_NumberRPM.Style = 8

        'pm_LabelRPM.Height = 25

        'pm_LabelRPM.Underline(0, 50) = True

        'pm_LabelRPM.LineOffset(0, 50) = 6

        'pm_LabelRPM.Bold(0, 50) = True

 

 

        'Add XY Feedrate Label & number box

        Set pm_LabelFeed = pm_GroupFS.AddControl2(27, swControlType_Label, "XY Feedrate (inch/min):", 1, 3, "")

        Set pm_NumberFeed = pm_GroupFS.AddControl2(28, swControlType_Numberbox, "", 2, 3, "Enter XY Feedrate")

        pm_NumberFeed.SetRange2 swNumberBox_UnitlessDouble, 0, 1000, True, 5, 5, 5

        pm_LabelFeed.Top = 30

        pm_NumberFeed.Top = 30

        pm_LabelFeed.Width = 15

        pm_LabelFeed.Style = 4

 

 

        'Add Z Feedrate Label & number box

        Set pm_LabelZFeed = pm_GroupFS.AddControl2(29, swControlType_Label, "Z Feedrate:", 1, 3, "")

        Set pm_NumberZFeed = pm_GroupFS.AddControl2(30, swControlType_Numberbox, "", 2, 3, "Enter Z Feedrate")

        pm_NumberZFeed.SetRange2 swNumberBox_Percent, 0, 100, True, 10, 10, 10

        pm_LabelZFeed.Top = 40

        pm_NumberZFeed.Top = 40

        pm_LabelZFeed.Width = 15

        pm_LabelZFeed.Style = 4

 

 

        'Add Leadin Feedrate Label & number box

        Set pm_LabelLeadFeed = pm_GroupFS.AddControl2(31, swControlType_Label, "Leadin Feedrate:", 1, 3, "")

        Set pm_NumberLeadFeed = pm_GroupFS.AddControl2(32, swControlType_Numberbox, "", 2, 3, "Enter Leadin Feedrate")

        pm_NumberLeadFeed.SetRange2 swNumberBox_Percent, 0, 100, True, 10, 10, 10

        pm_LabelLeadFeed.Top = 50

        pm_NumberLeadFeed.Top = 50

        pm_LabelLeadFeed.Width = 15

        pm_LabelLeadFeed.Style = 4

       

        'Add Final Feedrate Label & number box

        Set pm_LabelFinalFeed = pm_GroupFS.AddControl2(33, swControlType_Label, "Finish Pass Feedrate:", 1, 3, "")

        Set pm_NumberFinalFeed = pm_GroupFS.AddControl2(34, swControlType_Numberbox, "", 2, 3, "Enter Final Feedrate")

        pm_NumberFinalFeed.SetRange2 swNumberBox_Percent, 0, 100, True, 10, 10, 10

        pm_LabelFinalFeed.Top = 60

        pm_NumberFinalFeed.Top = 60

        pm_LabelFinalFeed.Width = 15

        pm_LabelFinalFeed.Style = 4

       

'Side Contour

 

 

        'Add Side Allowance Label & number box

        Set pm_LabelSideAllow = pm_GroupContourSide.AddControl2(35, swControlType_Label, "Allowance:", 1, 7, "")

        Set pm_NumberSideAllow = pm_GroupContourSide.AddControl2(36, swControlType_Numberbox, "", 2, 7, "Enter Side Allowance")

        pm_NumberSideAllow.SetRange2 swNumberBox_Length, -1000, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelSideAllow.Top = 10

        pm_NumberSideAllow.Top = 10

        pm_LabelSideAllow.Width = 15

        pm_LabelSideAllow.Style = 4

       

        'Add Side cut amount Label & number box

        Set pm_LabelSideCutAmt = pm_GroupContourSide.AddControl2(37, swControlType_Label, "Cut Amount:", 1, 7, "")

        Set pm_NumberSideCutAmt = pm_GroupContourSide.AddControl2(38, swControlType_Numberbox, "", 2, 7, "Enter Side Cut Amount")

        pm_NumberSideCutAmt.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelSideCutAmt.Top = 20

        pm_NumberSideCutAmt.Top = 20

        pm_LabelSideCutAmt.Width = 15

        pm_LabelSideCutAmt.Style = 4

       

        'Add Side previous allowance Label & number box

        Set pm_LabelSidePrevAllow = pm_GroupContourSide.AddControl2(39, swControlType_Label, "Previous Allowance:", 1, 7, "")

        Set pm_NumberSidePrevAllow = pm_GroupContourSide.AddControl2(40, swControlType_Numberbox, "", 2, 7, "Enter Previous Allowance")

        pm_NumberSidePrevAllow.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelSidePrevAllow.Top = 30

        pm_NumberSidePrevAllow.Top = 30

        pm_LabelSidePrevAllow.Width = 15

        pm_LabelSidePrevAllow.Style = 4

       

        'Add ZigZag checkbox

        Set pm_LabelSideZigZag = pm_GroupContourSide.AddControl2(90, swControlType_Label, "Zig Zag:", 1, 7, "")

        Set pm_CheckboxSideZigZag = pm_GroupContourSide.AddControl2(41, swControlType_Checkbox, " ", 2, 7, "Both Cutting Direction")

        pm_CheckboxSideZigZag.Checked = False

        pm_LabelSideZigZag.Top = 40

        pm_CheckboxSideZigZag.Top = 40

        pm_LabelSideZigZag.Width = 15

        pm_LabelSideZigZag.Style = 4

       

        'Add Side final cut amount Label & number box

        Set pm_LabelSideFinCutAmt = pm_GroupContourSide.AddControl2(42, swControlType_Label, "Final Cut Amount:", 1, 3, "")

        Set pm_NumberSideFinCutAmt = pm_GroupContourSide.AddControl2(43, swControlType_Numberbox, "", 2, 3, "Enter Final Cut Amount")

        pm_NumberSideFinCutAmt.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelSideFinCutAmt.Top = 50

        pm_NumberSideFinCutAmt.Top = 50

        pm_LabelSideFinCutAmt.Width = 15

        pm_LabelSideFinCutAmt.Style = 4

 

 

        'Add Side spring passes & number box

        Set pm_LabelSideSpringPass = pm_GroupContourSide.AddControl2(44, swControlType_Label, "Spring Passes:", 1, 7, "")

        Set pm_NumberSideSpringPass = pm_GroupContourSide.AddControl2(45, swControlType_Numberbox, "", 2, 7, "Enter Spring Passes")

        pm_NumberSideSpringPass.SetRange2 swNumberBox_UnitlessInteger, 0, 10, True, 1, 1, 1

        pm_LabelSideSpringPass.Top = 60

        pm_NumberSideSpringPass.Top = 60

        pm_LabelSideSpringPass.Width = 15

        pm_LabelSideSpringPass.Style = 4

 

 

        'Add Single cut checkbox

        Set pm_LabelSideSingleCut = pm_GroupContourSide.AddControl2(91, swControlType_Label, "Single Cut Depth:", 1, 7, "")

        Set pm_CheckboxSideSingleCut = pm_GroupContourSide.AddControl2(46, swControlType_Checkbox, " ", 2, 7, "Both Cutting Direction")

        pm_CheckboxSideSingleCut.Checked = True

        pm_LabelSideSingleCut.Top = 70

        pm_CheckboxSideSingleCut.Top = 70

        pm_LabelSideSingleCut.Width = 15

        pm_LabelSideSingleCut.Style = 4

 

 

        'Add Ignore Air Seg checkbox

        Set pm_LabelSideIgnoreAirSeg = pm_GroupContourSide.AddControl2(92, swControlType_Label, "Ignore Air Segment:", 1, 3, "")

        Set pm_CheckboxSideIgnoreAirSeg = pm_GroupContourSide.AddControl2(47, swControlType_Checkbox, " ", 2, 3, "Ignore Air Segments On Open Geometries")

        pm_CheckboxSideIgnoreAirSeg.Checked = True

        pm_LabelSideIgnoreAirSeg.Top = 80

        pm_CheckboxSideIgnoreAirSeg.Top = 80

        pm_LabelSideIgnoreAirSeg.Width = 15

        pm_LabelSideIgnoreAirSeg.Style = 4

 

 

'Depth contour

       

        'Add Depth Ramp combobox

        Set pm_LabelDepthRamp = pm_GroupContourDepth.AddControl2(57, swControlType_Label, "Ramp:", 1, 7, "")

        Set pm_ComboDepthRamp = pm_GroupContourDepth.AddControl2(58, swControlType_Combobox, "", 2, 7, "Select Ramp Method")

        pm_ComboDepthRamp.AddItems ("Off")

        pm_ComboDepthRamp.AddItems ("Angle")

        pm_ComboDepthRamp.AddItems ("Cut Amount")

        pm_ComboDepthRamp.AddItems ("Leadin Only")

        pm_LabelDepthRamp.Top = 10

        pm_ComboDepthRamp.Top = 10

        pm_LabelDepthRamp.Width = 15

        pm_LabelDepthRamp.Style = 4

       

        'Add Depth Ramp angle Label & number box

        Set pm_LabelDepthRampAngle = pm_GroupContourDepth.AddControl2(80, swControlType_Label, "Ramp Angle:", 1, 7, "")

        Set pm_NumberDepthRampAngle = pm_GroupContourDepth.AddControl2(81, swControlType_Numberbox, "", 2, 7, "Enter Ramp Angle")

        pm_NumberDepthRampAngle.SetRange2 swNumberBox_Angle, 0, 1000, True, 5, 5, 5

        pm_LabelDepthRampAngle.Top = 20

        pm_NumberDepthRampAngle.Top = 20

        pm_LabelDepthRampAngle.Width = 15

        pm_LabelDepthRampAngle.Style = 4

       

        'Add Depth method combobox

        Set pm_LabelDepthMethod = pm_GroupContourDepth.AddControl2(55, swControlType_Label, "Depth Method:", 1, 7, "")

        Set pm_ComboDepthMethod = pm_GroupContourDepth.AddControl2(56, swControlType_Combobox, "", 2, 7, "Select Depth Method")

        pm_ComboDepthMethod.AddItems ("Equal")

        pm_ComboDepthMethod.AddItems ("Exact")

        pm_ComboDepthMethod.AddItems ("Distance Along")

        pm_LabelDepthMethod.Top = 30

        pm_ComboDepthMethod.Top = 30

        pm_LabelDepthMethod.Width = 15

        pm_LabelDepthMethod.Style = 4

       

        'Add Depth Allow Label & number box

        Set pm_LabelDepthAllow = pm_GroupContourDepth.AddControl2(59, swControlType_Label, "Allowance:", 1, 7, "")

        Set pm_NumberDepthAllow = pm_GroupContourDepth.AddControl2(60, swControlType_Numberbox, "", 2, 7, "Enter Depth Allowance")

        pm_NumberDepthAllow.SetRange2 swNumberBox_Length, -1000, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelDepthAllow.Top = 40

        pm_NumberDepthAllow.Top = 40

        pm_LabelDepthAllow.Width = 15

        pm_LabelDepthAllow.Style = 4

       

        'Add 1st cut amt Label & number box

        Set pm_LabelDepthFirstCut = pm_GroupContourDepth.AddControl2(61, swControlType_Label, "First Cut Amount:", 1, 7, "")

        Set pm_NumberDepthFirstCut = pm_GroupContourDepth.AddControl2(62, swControlType_Numberbox, "", 2, 7, "Enter First Cut Amount")

        pm_NumberDepthFirstCut.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelDepthFirstCut.Top = 50

        pm_NumberDepthFirstCut.Top = 50

        pm_LabelDepthFirstCut.Width = 15

        pm_LabelDepthFirstCut.Style = 4

       

        'Add max. cut amt Label & number box

        Set pm_LabelDepthMaxCut = pm_GroupContourDepth.AddControl2(63, swControlType_Label, "Max. Cut Amount:", 1, 7, "")

        Set pm_NumberDepthMaxCut = pm_GroupContourDepth.AddControl2(64, swControlType_Numberbox, "", 2, 7, "Enter Max. Cut Amount")

        pm_NumberDepthMaxCut.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelDepthMaxCut.Top = 60

        pm_NumberDepthMaxCut.Top = 60

        pm_LabelDepthMaxCut.Width = 15

        pm_LabelDepthMaxCut.Style = 4

       

        'Add Final cut amt & number box

        Set pm_LabelDepthFinCut = pm_GroupContourDepth.AddControl2(65, swControlType_Label, "Final Cut Amount:", 1, 7, "")

        Set pm_NumberDepthFinCut = pm_GroupContourDepth.AddControl2(66, swControlType_Numberbox, "", 2, 7, "Enter Final Cut Amount")

        pm_NumberDepthFinCut.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelDepthFinCut.Top = 70

        pm_NumberDepthFinCut.Top = 70

        pm_LabelDepthFinCut.Width = 15

        pm_LabelDepthFinCut.Style = 4

 

 

'Chamfer contour

 

 

        'Add Chamfer Angle Label & number box

        Set pm_LabelChamferAngle = pm_GroupContourChamfer.AddControl2(49, swControlType_Label, "Angle:", 1, 7, "")

        Set pm_NumberChamferAngle = pm_GroupContourChamfer.AddControl2(50, swControlType_Numberbox, "", 2, 7, "")

        pm_NumberChamferAngle.SetRange swNumberBox_Angle, 0, 90, 0.1, True

        pm_NumberChamferAngle.Enabled = False

        pm_NumberChamferAngle.Style = 8

        pm_LabelChamferAngle.Top = 10

        pm_NumberChamferAngle.Top = 10

        pm_LabelChamferAngle.Width = 15

        pm_LabelChamferAngle.Style = 4

       

        'Add Chamfer Length Label & number box

        Set pm_LabelChamferLength = pm_GroupContourChamfer.AddControl2(51, swControlType_Label, "Length:", 1, 7, "")

        Set pm_NumberChamferLength = pm_GroupContourChamfer.AddControl2(52, swControlType_Numberbox, "", 2, 7, "Enter Chamfer Length")

        pm_NumberChamferLength.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelChamferLength.Top = 50

        pm_NumberChamferLength.Top = 50

        pm_LabelChamferLength.Width = 15

        pm_LabelChamferLength.Style = 4

       

        'Add Chamfer Clearance Label & number box

        Set pm_LabelChamferClear = pm_GroupContourChamfer.AddControl2(53, swControlType_Label, "Clearance:", 1, 7, "")

        Set pm_NumberChamferClear = pm_GroupContourChamfer.AddControl2(54, swControlType_Numberbox, "", 2, 7, "Enter Chamfer Clearance")

        pm_NumberChamferClear.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelChamferClear.Top = 70

        pm_NumberChamferClear.Top = 70

        pm_LabelChamferClear.Width = 15

        pm_LabelChamferClear.Style = 4

       

        'Add Chamfer Feature Edge method combobox

        Set pm_LabelChamferFeatEdge = pm_GroupContourChamfer.AddControl2(55, swControlType_Label, "Method:", 1, 7, "")

        Set pm_ComboChamferFeatEdge = pm_GroupContourChamfer.AddControl2(56, swControlType_Combobox, "", 2, 7, "Select Depth Method")

        pm_ComboChamferFeatEdge.AddItems ("Apex")

        pm_ComboChamferFeatEdge.AddItems ("Outer Edge")

        pm_LabelChamferFeatEdge.Top = 90

        pm_ComboChamferFeatEdge.Top = 90

        pm_LabelChamferFeatEdge.Width = 15

        pm_LabelChamferFeatEdge.Style = 4

       

        'Add Cut Method radio buttons

        Set pm_RadioClimb = pm_GroupContourMethod.AddControl2(67, swControlType_Option, "Climb", 1, 7, "Select Cutting Direction")

        Set pm_RadioConventional = pm_GroupContourMethod.AddControl2(68, swControlType_Option, "Conventional", 2, 7, "SelectCutting Direction")

        pm_RadioClimb.Top = 10

        pm_RadioClimb.Width = 15

        pm_RadioConventional.Top = 10

        pm_RadioClimb.Checked = True

        pm_RadioConventional.Checked = False

'Drill

        'Add Drill cycle type combobox

        Set pm_LabelDrillCycle = pm_GroupDrill.AddControl2(82, swControlType_Label, "Type:", 1, 3, "")

        Set pm_ComboDrillCycle = pm_GroupDrill.AddControl2(83, swControlType_Combobox, "", 2, 3, "Select Drill Cycle")

        pm_ComboDrillCycle.AddItems ("Drill")

        pm_ComboDrillCycle.AddItems ("Pecking")

        pm_ComboDrillCycle.AddItems ("High Speed Pecking")

        pm_LabelDrillCycle.Top = 10

        pm_ComboDrillCycle.Top = 10

        pm_LabelDrillCycle.Width = 15

        pm_LabelDrillCycle.Style = 4

       

        'Add First Peck Label & number box

        Set pm_LabelDrillFirstPeck = pm_GroupDrill.AddControl2(84, swControlType_Label, "First Peck:", 1, 3, "")

        Set pm_NumberDrillFirstPeck = pm_GroupDrill.AddControl2(85, swControlType_Numberbox, "", 2, 3, "Enter First Peck Amount")

        pm_NumberDrillFirstPeck.SetRange2 swNumberBox_Length, 0, 1000, True, 0.000508, 0.000508, 0.000508

        pm_LabelDrillFirstPeck.Top = 20

        pm_NumberDrillFirstPeck.Top = 20

        pm_LabelDrillFirstPeck.Width = 15

        pm_LabelDrillFirstPeck.Style = 4

 

 

        'Add Sub Peck Label & number box

        Set pm_LabelDrillSubPeck = pm_GroupDrill.AddControl2(86, swControlType_Label, "Sub Peck:", 1, 3, "")

        Set pm_NumberDrillSubPeck = pm_GroupDrill.AddControl2(87, swControlType_Numberbox, "", 2, 3, "Enter Sub Peck Amount")

        pm_NumberDrillSubPeck.SetRange2 swNumberBox_Length, 0, 1000, True, 0.000508, 0.000508, 0.000508

        pm_LabelDrillSubPeck.Top = 30

        pm_NumberDrillSubPeck.Top = 30

        pm_LabelDrillSubPeck.Width = 15

        pm_LabelDrillSubPeck.Style = 4

 

 

        'Add Dwell Label & number box

        Set pm_LabelDrillDwell = pm_GroupDrill.AddControl2(88, swControlType_Label, "Dwell:", 1, 3, "")

        Set pm_NumberDrillDwell = pm_GroupDrill.AddControl2(89, swControlType_Numberbox, "", 2, 3, "Enter Dwell")

        pm_NumberDrillDwell.SetRange2 swNumberBox_Time, 0, 10, True, 0.2, 0.2, 0.2

        pm_LabelDrillDwell.Top = 40

        pm_NumberDrillDwell.Top = 40

        pm_LabelDrillDwell.Width = 15

        pm_LabelDrillDwell.Style = 4

       

'NC Rapid

 

 

        'Add Rapid parameters combobox

        Set pm_ComboNC_Rapid = pm_GroupNC_Rapid.AddControl2(99, swControlType_Combobox, "", 1, 7, "Select Rapid Method")

        pm_ComboNC_Rapid.AddItems ("Top Of Feature")

        pm_ComboNC_Rapid.AddItems ("Setup Origin")

        pm_ComboNC_Rapid.AddItems ("Clearance Plane")

        pm_ComboNC_Rapid.AddItems ("Top Of Stock")

        pm_ComboNC_Rapid.Top = 10

 

 

        'Add rapid distance Label & number box

        Set pm_LabelNCrapidDist = pm_GroupNC_Rapid.AddControl2(100, swControlType_Label, "Distance:", 1, 7, "")

        Set pm_NumberNCrapidDist = pm_GroupNC_Rapid.AddControl2(101, swControlType_Numberbox, "", 2, 7, "Enter Rapid Distance")

        pm_NumberNCrapidDist.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelNCrapidDist.Top = 20

        pm_NumberNCrapidDist.Top = 20

        pm_LabelNCrapidDist.Width = 15

        pm_LabelNCrapidDist.Style = 4

       

        'Add use setup def checkbox

        Set pm_CheckboxNCrapidUseSetupDef = pm_GroupNC_Rapid.AddControl2(102, swControlType_Checkbox, "Use Setup Definition", 1, 3, "")

 

 

'NC Clear

 

 

        'Add Rapid parameters combobox

        Set pm_ComboNC_Clear = pm_GroupNC_Clear.AddControl2(103, swControlType_Combobox, "", 1, 7, "Select Clearance Method")

        pm_ComboNC_Clear.AddItems ("Top Of Feature")

        pm_ComboNC_Clear.AddItems ("Setup Origin")

        pm_ComboNC_Clear.AddItems ("Previous Machined Depth")

        pm_ComboNC_Clear.AddItems ("Top Of Stock")

        pm_ComboNC_Clear.AddItems ("Skim Plane")

        pm_ComboNC_Clear.Top = 10

 

 

        'Add rapid distance Label & number box

        Set pm_LabelNCclearDist = pm_GroupNC_Clear.AddControl2(104, swControlType_Label, "Distance:", 1, 7, "")

        Set pm_NumberNCclearDist = pm_GroupNC_Clear.AddControl2(105, swControlType_Numberbox, "", 2, 7, "Enter Feed Distance")

        pm_NumberNCclearDist.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelNCclearDist.Top = 20

        pm_NumberNCclearDist.Top = 20

        pm_LabelNCclearDist.Width = 15

        pm_LabelNCclearDist.Style = 4

 

 

        'Add use setup def checkbox

        Set pm_CheckboxNCclearUseSetupDef = pm_GroupNC_Clear.AddControl2(106, swControlType_Checkbox, "Use Setup Definition", 1, 3, "")

 

 

'NC Feed

 

 

        'Add Rapid parameters combobox

        Set pm_ComboNC_Feed = pm_GroupNC_Feed.AddControl2(107, swControlType_Combobox, "", 1, 7, "Select Feed Method")

        pm_ComboNC_Feed.AddItems ("Previous Machined Depth")

        pm_ComboNC_Feed.AddItems ("Current Machined Depth")

        pm_ComboNC_Feed.Top = 10

 

 

        'Add rapid distance Label & number box

        Set pm_LabelNCfeedDist = pm_GroupNC_Feed.AddControl2(108, swControlType_Label, "Distance:", 1, 7, "")

        Set pm_NumberNCfeedDist = pm_GroupNC_Feed.AddControl2(109, swControlType_Numberbox, "", 2, 7, "Enter Feed Distance")

        pm_NumberNCfeedDist.SetRange2 swNumberBox_Length, 0, 1000, True, 0.0015875, 0.0015875, 0.0015875

        pm_LabelNCfeedDist.Top = 20

        pm_NumberNCfeedDist.Top = 20

        pm_LabelNCfeedDist.Width = 15

        pm_LabelNCfeedDist.Style = 4

 

 

'NC Retract

       

        'Add use setup def checkbox

        'Set pm_CheckboxNCfeedUseSetupDef = pm_GroupNC_Feed.AddControl2(102, swControlType_Checkbox, "Use Setup Definition", 1, 3, "")

 

 

'Mirror

 

 

        ' Add a label & selection box

        Set pm_LabelAxis = pm_GroupMirror.AddControl2(69, swControlType_Label, "Axis:", 1, 3, "")

        tip = "Select an edge, face, sketch segment, plane, or an axis"

        Set pm_Selection = pm_GroupMirror.AddControl2(70, swControlType_Selectionbox, "", 1, 3, tip)

  

        Dim filters(4) As Long

        filters(0) = swSelEDGES

        filters(1) = swSelFACES

        filters(2) = swSelEXTSKETCHSEGS

        filters(3) = swSelDATUMPLANES

        filters(4) = swSelDATUMAXES

 

 

        pm_Selection.AllowMultipleSelectOfSameEntity = False

        pm_Selection.SingleEntityOnly = True

        pm_Selection.Height = 50

        pm_Selection.SetSelectionFilters filters

 

 

        'Add mirror options checkboxes

 

 

        Set pm_CheckboxMaintainClimb = pm_GroupMirror.AddControl2(71, swControlType_Checkbox, "Maintain Climb or Conventional", 1, 3, "Cutting Direction")

        Set pm_CheckboxKeepOriginal = pm_GroupMirror.AddControl2(72, swControlType_Checkbox, "Keep Original", 1, 3, "Keep Original")

        pm_CheckboxMaintainClimb.Checked = True

        pm_CheckboxKeepOriginal.Checked = False

       

        ' Add mirror x offset label & number box

        Set pm_LabelOffsetX = pm_GroupMirror.AddControl2(73, swControlType_Label, "X Offset", 1, 3, "")

        Set pm_NumberOffsetX = pm_GroupMirror.AddControl2(74, swControlType_Numberbox, "X Offset:", 1, 3, "X Offset")

        pm_NumberOffsetX.SetRange2 swNumberBox_Length, -1000, 1000, True, 0.0015875, 0.0015875, 0.0015875

       

        ' Add mirror y offset label & number box

        Set pm_LabelOffsetY = pm_GroupMirror.AddControl2(75, swControlType_Label, "Y Offset", 1, 3, "")

        Set pm_NumberOffsetY = pm_GroupMirror.AddControl2(76, swControlType_Numberbox, "Y Offset:", 1, 3, "Y Offset")

        pm_NumberOffsetY.SetRange2 swNumberBox_Length, -1000, 1000, True, 0.0015875, 0.0015875, 0.0015875

 

 

        ' Add cancel mirror button

        Set pm_ButtonCancelMirror = pm_GroupMirror.AddControl2(77, swControlType_Button, "Cancel Mirror", 1, 3, "Click")

 

 

        ' Check selected items

        If cwDoc.GetDocType = CW_DOCUMENT_ASSEMBLY Then

            Set setupSelected = cwSelMgr.GetSelectionsOfType(18, 1)

        ElseIf cwDoc.GetDocType = CW_DOCUMENT_PART Then

            Set setupSelected = cwSelMgr.GetSelectionsOfType(7, 1)

        End If

       

        If setupSelected Is Nothing Then

            Set Operations = cwSelMgr.GetSelectionsOfType(3, 1)

            If Operations Is Nothing Then

'                MsgBox "Please select a setup or operations!"

'                pm_Page.Close (True)

'                Set pm = Nothing

'                Exit Sub

            Else

                If Not pm_OperList Is Nothing Then

                    For k = 0 To Operations.Count - 1

                        Set operation = Operations.Item(k)

                        listItems(k) = operation.GetName

                    Next k

                    pm_OperList.Height = Operations.Count * 11.5

                    pm_OperList.AddItems (listItems)

                End If

            End If

            OpsOnly = True

        Else

            If Not pm_OperList Is Nothing Then

                For j = 0 To setupSelected.Count - 1

                    Set setup = setupSelected.Item(j)

                    listItems(j) = setup.GetName

                Next j

                pm_OperList.Height = setupSelected.Count * 11.5

                pm_OperList.AddItems (listItems)

            End If

        End If

 

 

        'Get machine

        If cwDoc.GetDocType = CW_DOCUMENT_ASSEMBLY Then

            Set machines = cwDoc.IGetEnumMachines

            Set cwMach = machines.Item(0)

        ElseIf cwDoc.GetDocType = CW_DOCUMENT_PART Then

            Set cwMach = cwDoc.IGetMachine

        End If

       

        'Get toolcrib

        Set cwTlCrib = cwMach.IGetToolcrib

        Set cwOpSetups = cwMach.IGetEnumOpSetups

        Set cwToolList = cwTlCrib.GetAllTools()

        For i = 0 To cwToolList.Count - 1

            Set cwTl = cwToolList.Item(i)

            pm_ToolcribList.AddItems "T" & cwTl.StnNo & "=" & cwTl.Comment

        Next i

        pm_ToolcribList.Height = cwToolList.Count * 8.55

       

        'Machine Current Tooling

        Set objFSO = CreateObject("Scripting.FileSystemObject")

        Set myFile = objFSO.OpenTextFile("D:\Tooling.txt", 1, True)

        i = 0

        Do While Not myFile.AtEndofStream

            pm_MachineList.AddItems myFile.ReadLine

            i = i + 1

        Loop

        pm_MachineList.Height = i * 8.5

        myFile.Close

       

        Set helperobject = New UtilityClass             'utility functions

        bAreOperationsSelected = True

       

        'Check if any doc is open

        Dim modelDoc As Object

        Set modelDoc = swApp.activeDoc

        If modelDoc Is Nothing Then

            GoTo Exit_error

        End If

       

        Set userUnits = modelDoc.GetUserUnit(swLengthUnit)

        If userUnits Is Nothing Then

            GoTo Exit_error

        End If

        dConversionFactor = userUnits.GetConversionFactor

       

        nNumSelectedOperations = 0

       

        'Get the list of all selected operation

       

        Call helperobject.GetSelectedCWObjects(selectedOperations, nNumSelectedOperations, MW_SELNSET_TYPE_MILL_OPERATIONS, OPPLAN_BROWSER)

        If nNumSelectedOperations = 0 Then

            bAreOperationsSelected = False

            'Set pm_FSTab = Nothing

            'Set pm_MirrorTab = Nothing

        End If

   

        If bAreOperationsSelected = True Then

            Call GetParametersFromOperations(0)

            pm_OperList.SetSelectedItem 0, True

        End If

        Exit Sub

   

Exit_error:

 

 

       strMsg = "No document open or document units error!"

       MsgBox strMsg, vbOKOnly, caption

   

    Else

 

 

        MsgBox "An error occurred while attempting to create the PropertyManager Page", vbCritical

 

 

    End If

      

End Sub

'To Get Parameters From Operations

 

 

Public Function GetParametersFromOperations(SelectedOp As Integer)

   

    Set millOperation = selectedOperations(SelectedOp)

    Set cwNCParams = millOperation.IGetNCParam

   

    m_bLinkToFSLibrary = cwNCParams.GetLinkSFStatus

    m_dSpindleSpeed = cwNCParams.GetSpndlSpeed

    m_dXYFeed = cwNCParams.XYFeed

    Call cwNCParams.GetZFeedrate2(m_dZFeedrate, m_bZFeedrateByPercent)

    Call cwNCParams.GetLeadinFeedrate(m_dLeadinFeedrate, m_bLeadinFeedrateByPercent)

    If m_bZFeedrateByPercent = False Then

       m_dZFeedrate = 100 * (m_dZFeedrate / m_dXYFeed)

    End If

    If m_bLeadinFeedrateByPercent = False Then

       m_dLeadinFeedrate = 100 * (m_dLeadinFeedrate / m_dXYFeed)

    End If

   

    Call SetControlsWithActiveValues

   

End Function

 

 

'Apply the Parameters To Operations

 

 

Public Sub ApplyParametersToOperations()

   

    m_dSpindleSpeed = Val(txtSpindleSpeed.Text)

    m_dXYFeed = Val(txtXYFeedRate.Text)

    m_dLeadinFeedrate = Val(txtLeadinFeedrate.Text)

    m_dZFeedrate = Val(txtZFeedrate.Text)

   

    For i = 0 To nNumSelectedOperations - 1

               

        Set millOperation = selectedOperations(i)

        Set cwNCParams = millOperation.IGetNCParam

       

        If chkModifySpindleSpeed.Value = True Then

            cwNCParams.SetSpndlSpeed (m_dSpindleSpeed)

        End If

       

        If chkModifyXYFeedrate.Value = True Then

            cwNCParams.XYFeed = m_dXYFeed

        End If

       

        If chkModifyZFeedRate.Value = True Then

            m_bZFeedrateByPercent = True

            Call cwNCParams.SetZFeedrate(m_dZFeedrate, m_bZFeedrateByPercent)

        End If

       

        If chkModifyLeadinFeedRate.Value = True Then

            m_bLeadinFeedrateByPercent = True

            Call cwNCParams.SetLeadinFeedrate(m_dLeadinFeedrate, m_bLeadinFeedrateByPercent)

        End If

   

        If chkAssignTool.Value = True Then

            Set cwTl = cwToolList(ToolListBox.ListIndex)

            Call millOperation.SetTool(cwTl)

        End If

       

        If IsNumeric(tlStation.Value) Then

            cwTl.StnNo = tlStation.Value

            cwDoc.UpdateCAMWorksTreeViews

        End If

       

        millOperation.GenerateToolpath

    Next i

End Sub

 

 

'Set the UI Controls With Active Values

 

 

Public Sub SetControlsWithActiveValues()

 

 

    pm_NumberRPM.Value = Round(m_dSpindleSpeed, 0)

    pm_NumberFeed.Value = Round(m_dXYFeed, 2)

 

 

    pm_NumberZFeed.Value = m_dZFeedrate

 

 

    pm_NumberLeadFeed.Value = m_dLeadinFeedrate

   

End Sub

 

 

Public Function ShowPlanes(ShowThem As Boolean)

 

 

    Dim PlaneArr As Variant

    PlaneArr = Array("Face", "Dessus", "Droite")

 

 

    For i = 0 To UBound(PlaneArr)

        Call swModel.Extension.SelectByID2(PlaneArr(i), "PLANE", 0, 0, 0, False, 0, Nothing, 0)

        If ShowThem = True Then

            Call swModel.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayPlanes, True)

            swModel.UnBlankRefGeom

        Else

            Call swModel.SetUserPreferenceToggle(swUserPreferenceToggle_e.swDisplayPlanes, False)

            swModel.BlankRefGeom

        End If

    Next i

 

 

    Call swModel.ClearSelection2(True)

End Function

 

 

Public Function Mirroring()

 

 

        If OpsOnly = True Then GoTo 0

        blMaintainClimb = pm_CheckboxMaintainClimb.State

        blKeepOriginal = pm_CheckboxKeepOriginal.State

       

        'Mirror selected operations

         For j = 0 To setupSelected.Count - 1

            Set setup = setupSelected.Item(j)

            Set Operations = setup.IGetEnumOperations

0:

            For k = 0 To Operations.Count - 1

 

 

                Set currentop = Operations.Item(k)

                If blDisable = True Then

                    Call currentop.DisableMirrorToolpath

                    If Left(currentop.GetName, 4) = "/|\-" Then currentop.SetName Right(currentop.GetName, (Len(currentop.GetName) - 4))

                    Call currentop.GenerateToolpath

                    GoTo 1

                End If

 

 

                Set mirrorAxis = swSelMgr.GetSelectedObject6(1, -1)

 

 

                If mirrorAxis Is Nothing Then

                    MsgBox "Restart Macro And Select A Mirror Entity!", vbInformation, "Mirror Selected Setup"

                    blDisable = True

                    GoTo 3

                End If

 

 

                Call currentop.SetMirrorToolpath(blMaintainClimb, blKeepOriginal, mirrorAxis, True, False, pm_NumberOffsetX.Value * 39.3700787401575, pm_NumberOffsetY.Value * 39.3700787401575)

                If Left(currentop.GetName, 4) <> "/|\-" Then currentop.SetName "/|\-" & currentop.GetName

                Call currentop.GenerateToolpath

1:

            Next k

        If OpsOnly = True Then GoTo 3

2:

        Next j

3:

        Call ShowPlanes(False)

        If blDisable = True Then

            pm_Page.Close (True)

        End If

 

 

        cwDoc.UpdateCAMWorksTreeViews

4:

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnClose(ByVal Reason As Long)

 

 

    If Reason = swPropertyManagerPageClose_Cancel Then

 

 

        ' Cancel button clicked

        ClickedCancel = True

        If activeTab = 6 Then

            Call ShowPlanes(False)

            cwDoc.UpdateCAMWorksTreeViews

        End If

        pm_Page.Close (True)

 

 

    ElseIf Reason = swPropertyManagerPageClose_Okay Then

 

 

        'OK button clicked

        ClickedCancel = False

        If activeTab = 6 Then

            Call Mirroring

        End If

   

    End If

 

 

    End

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnTabClicked(ByVal Id As Long) As Boolean

    activeTab = Id

    If Id = 6 Then Call ShowPlanes(True)

    If Id <> 6 Then Call ShowPlanes(False)

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnNumberboxChanged(ByVal Id As Long, ByVal Value As Double)

   

    If IsNumeric(pm_NumberTool.Value) And Id = 20 Then

        cwTl.StnNo = pm_NumberTool.Value

        cwDoc.UpdateCAMWorksTreeViews

        Set cwToolList = cwTlCrib.GetAllTools()

        pm_ToolcribList.Clear

        For i = 0 To cwToolList.Count - 1

            Set cwTl = cwToolList.Item(i)

            pm_ToolcribList.AddItems "T" & cwTl.StnNo & "=" & cwTl.Comment

        Next i

        pm_NumberTool.Value = 0

    End If

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnListboxSelectionChanged(ByVal Id As Long, ByVal Item As Long)

    If Id = 79 Then

        Call GetParametersFromOperations(pm_OperList.IGetSelectedItems(1))

    End If

   

    If Id = 18 Then

        Set cwTl = cwToolList(pm_ToolcribList.IGetSelectedItems(1))

        pm_NumberTool.Value = cwTl.StnNo

    End If

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnButtonPress(ByVal Id As Long)

   

    If Id = 77 Then

        blDisable = True

        Call Mirroring

    End If

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnGainedFocus(ByVal Id As Long)

  

   Dim varArray As Variant

 

 

   Debug.Print "Control box " & Id & " gained focus"

 

 

   varArray = pm_List.GetSelectedItems

 

 

   pm_Combo.CurrentSelection = varArray(0)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSelectionboxListChanged(ByVal Id As Long, ByVal Count As Long)

   

    pm_Page.SetCursor (swPropertyManagerPageCursors_Advance)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_AfterClose()

 

 

    ' Destroy the class

    Set pm = Nothing

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_AfterActivation()

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnActiveXControlCreated(ByVal Id As Long, ByVal Status As Boolean) As Long

 

 

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnCheckboxCheck(ByVal Id As Long, ByVal Checked As Boolean)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnComboboxEditChanged(ByVal Id As Long, ByVal Text As String)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnComboboxSelectionChanged(ByVal Id As Long, ByVal Item As Long)

 

 

End Sub

 

Public Sub PropertyManagerPage2Handler9_OnGroupCheck(ByVal Id As Long, ByVal Checked As Boolean)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnGroupExpand(ByVal Id As Long, ByVal Expanded As Boolean)

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnHelp() As Boolean

 

 

End Function

 

 

Public Function PropertyManagerPage2Handler9_OnKeystroke(ByVal Wparam As Long, ByVal Message As Long, ByVal Lparam As Long, ByVal Id As Long) As Boolean

 

 

End Function

 

 

Public Function PropertyManagerPage2Handler9_OnNextPage() As Boolean

 

 

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnOptionCheck(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnPopupMenuItem(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnPopupMenuItemUpdate(ByVal Id As Long, retVal As Long)

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnPreview() As Boolean

 

 

End Function

 

 

Public Function PropertyManagerPage2Handler9_OnPreviousPage() As Boolean

 

 

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnRedo()

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSelectionboxCalloutCreated(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSelectionboxCalloutDestroyed(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSelectionboxFocusChanged(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSliderPositionChanged(ByVal Id As Long, ByVal Value As Double)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnSliderTrackingCompleted(ByVal Id As Long, ByVal Value As Double)

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnSubmitSelection(ByVal Id As Long, ByVal Selection As Object, ByVal SelType As Long, ItemText As String) As Boolean

 

 

    PropertyManagerPage2Handler9_OnSubmitSelection = True

 

 

End Function

 

 

Public Sub PropertyManagerPage2Handler9_OnTextboxChanged(ByVal Id As Long, ByVal Text As String)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnUndo()

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnWhatsNew()

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnLostFocus(ByVal Id As Long)

 

 

End Sub

 

 

Public Sub PropertyManagerPage2Handler9_OnListBoxRMBUp(ByVal Id As Long, ByVal posX As Long, ByVal posY As Long)

 

 

End Sub

 

 

Public Function PropertyManagerPage2Handler9_OnWindowFromHandleControlCreated(ByVal Id As Long, ByVal Status As Boolean) As Long

 

 

End Function

 

Public Sub PropertyManagerPage2Handler9_OnNumberboxTrackingCompleted(ByVal Id As Long, ByVal Value As Double)

 

 

End Sub

Outcomes