Your Products have been synced, click here to refresh
' mark after find first If bMarking Then ' <- here is the mistake Cmd.Marked = True End If ' should be: If ((bMarking) And (Cmd.IsDimension)) Or ((bMarking) And (Cmd.Type = DIMENSION_END_LOCATION)) Then Cmd.Marked = True End If
Sub Main_230920() ' Dim something --------------------------- Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Set Cmd = Nothing Dim sSF As String Dim sEF As String Dim bMarking As Boolean Dim bLast As Boolean ' get User input sSF = InputBox("Enter the start feature :", "StartFeature") sEF = InputBox("Enter the end feature :", "EndFeature") ' search bMarking = False bLast = False For Each Cmd In Cmds ' find first DIMENSION with input REF_ID "sSF" If (Cmd.Type = DIMENSION_START_LOCATION) And (Cmd.GetText(REF_ID, 0) = sSF) Then bMarking = True End If ' mark after find first If ((bMarking) And (Cmd.IsDimension)) Or ((bMarking) And (Cmd.Type = DIMENSION_END_LOCATION)) Then Cmd.Marked = True End If End If ' find last DIMENSION with input REF_ID "sEF" If (Cmd.Type = DIMENSION_START_LOCATION) And (Cmd.GetText(REF_ID, 0) = sEF) Then bLast = True End If ' exit after find last If (Cmd.Type = DIMENSION_END_LOCATION) And (bLast) Then Exit For End If Next Cmd Part.RefreshPart ' unDim something --------------------------- Set Cmd = Nothing Set Cmds = Nothing Set Part = Nothing Set App = Nothing End Sub
' mark after find first If bMarking Then ' <- here is the mistake Cmd.Marked = True End If ' should be: If ((bMarking) And (Cmd.IsDimension)) Or ((bMarking) And (Cmd.Type = DIMENSION_END_LOCATION)) Then Cmd.Marked = True End If
Sub Main_230920() ' Dim something --------------------------- Dim App As Object Set App = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Set Cmd = Nothing Dim sSF As String Dim sEF As String Dim bMarking As Boolean Dim bLast As Boolean ' get User input sSF = InputBox("Enter the start feature :", "StartFeature") sEF = InputBox("Enter the end feature :", "EndFeature") ' search bMarking = False bLast = False For Each Cmd In Cmds ' find first DIMENSION with input REF_ID "sSF" If (Cmd.Type = DIMENSION_START_LOCATION) And (Cmd.GetText(REF_ID, 0) = sSF) Then bMarking = True End If ' mark after find first If ((bMarking) And (Cmd.IsDimension)) Or ((bMarking) And (Cmd.Type = DIMENSION_END_LOCATION)) Then Cmd.Marked = True End If End If ' find last DIMENSION with input REF_ID "sEF" If (Cmd.Type = DIMENSION_START_LOCATION) And (Cmd.GetText(REF_ID, 0) = sEF) Then bLast = True End If ' exit after find last If (Cmd.Type = DIMENSION_END_LOCATION) And (bLast) Then Exit For End If Next Cmd Part.RefreshPart ' unDim something --------------------------- Set Cmd = Nothing Set Cmds = Nothing Set Part = Nothing Set App = Nothing End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |