Your Products have been synced, click here to refresh
Sub GetPCDMISdata() Dim app As PCDLRN.Application Dim pp As PCDLRN.PartPrograms Dim cmds As PCDLRN.Commands Dim cmd As PCDLRN.Command Dim CurAlign As String Dim CurWP As Integer Set app = CreateObject("PCDLRN.Application") Set part = app.ActivePartProgram Set cmds = part.Commands Dim pd As PointData Set pd = CreateObject("PCDLRN.POINTDATA") For Each cmd In cmds If cmd.IsComment Then Rows(i).Select Selection.Font.ColorIndex = 0 Set ComCmd = cmd.CommentCommand ActiveSheet.Cells(i, 3) = ComCmd.CommentType ActiveSheet.Cells(i, 4) = ComCmd.Comment ActiveSheet.Cells(i, 8) = ComCmd.Input ElseIf cmd.IsAlignment Then CurAlign = cmd.AlignmentCommand.ID ActiveSheet.Cells(i, 3) = CurAlign ElseIf cmd.Type = SET_WORKPLANE Then CurWP = cmd.ModalCommand.Workplane ActiveSheet.Cells(i, 3) = CurWP ElseIf cmd.IsFeature Then If Not cmd.IsHit Then Rows(i).Select Selection.Font.ColorIndex = 42 Set FeatCommand = cmd.FeatureCommand If FeatCommand.Polar Then Result = FeatCommand.GetData(pd, FDATA_CENTROID, FDATA_MEAS, FDATA_POLAR, CurAlign, CurWP) If Result Then ActiveSheet.Cells(i, 6) = pd.X ActiveSheet.Cells(i, 7) = pd.Y ActiveSheet.Cells(i, 8) = pd.Z End If Else Result = FeatCommand.GetPoint(FPOINT_CENTROID, FDATA_MEAS, fx, fy, fz) If Result Then ActiveSheet.Cells(i, 6) = fx ActiveSheet.Cells(i, 7) = fy ActiveSheet.Cells(i, 8) = fz End If End If Result = FeatCommand.GetVector(FVECTOR_VECTOR, FDATA_MEAS, fi, fj, fk) If Result Then ActiveSheet.Cells(i, 9) = fi ActiveSheet.Cells(i, 10) = fj ActiveSheet.Cells(i, 11) = fk End If If cmd.IsDCCFeature Then HitPoints = FeatCommand.GetPoints(FHITDATA_CENTROID, FDATA_MEAS, FDATA_PART, CurAlign, CurWP) HitVectors = FeatCommand.GetPoints(FHITDATA_VECTOR, FDATA_MEAS, FDATA_PART, CurAlign, CurWP) For HitNo = 0 To FeatCommand.NumHits - 1 i = i + 1 Rows(i).Select Selection.Font.ColorIndex = 42 ActiveSheet.Cells(i, 6) = HitPoints(HitNo * 3 + 0) ActiveSheet.Cells(i, 7) = HitPoints(HitNo * 3 + 1) ActiveSheet.Cells(i, 8) = HitPoints(HitNo * 3 + 2) ActiveSheet.Cells(i, 9) = HitVectors(HitNo * 3 + 0) ActiveSheet.Cells(i, 10) = HitVectors(HitNo * 3 + 1) ActiveSheet.Cells(i, 11) = HitVectors(HitNo * 3 + 2) Next HitNo End If Else Rows(i).Select Selection.Font.ColorIndex = 42 Set FeatCommand = cmd.FeatureCommand Result = FeatCommand.GetPoint(FHITDATA_CENTROID, FDATA_MEAS, fx, fy, fz) ActiveSheet.Cells(i, 6) = fx ActiveSheet.Cells(i, 7) = fy ActiveSheet.Cells(i, 8) = fz Result = FeatCommand.GetVector(FVECTOR_VECTOR, FDATA_MEAS, fi, fj, fk) If Result Then ActiveSheet.Cells(i, 9) = fi ActiveSheet.Cells(i, 10) = fj ActiveSheet.Cells(i, 11) = fk End If End If next end sub
Sub GetPCDMISdata() Dim app As PCDLRN.Application Dim pp As PCDLRN.PartPrograms Dim cmds As PCDLRN.Commands Dim cmd As PCDLRN.Command Dim CurAlign As String Dim CurWP As Integer Set app = CreateObject("PCDLRN.Application") Set part = app.ActivePartProgram Set cmds = part.Commands Dim pd As PointData Set pd = CreateObject("PCDLRN.POINTDATA") For Each cmd In cmds If cmd.IsComment Then Rows(i).Select Selection.Font.ColorIndex = 0 Set ComCmd = cmd.CommentCommand ActiveSheet.Cells(i, 3) = ComCmd.CommentType ActiveSheet.Cells(i, 4) = ComCmd.Comment ActiveSheet.Cells(i, 8) = ComCmd.Input ElseIf cmd.IsAlignment Then CurAlign = cmd.AlignmentCommand.ID ActiveSheet.Cells(i, 3) = CurAlign ElseIf cmd.Type = SET_WORKPLANE Then CurWP = cmd.ModalCommand.Workplane ActiveSheet.Cells(i, 3) = CurWP ElseIf cmd.IsFeature Then If Not cmd.IsHit Then Rows(i).Select Selection.Font.ColorIndex = 42 Set FeatCommand = cmd.FeatureCommand If FeatCommand.Polar Then Result = FeatCommand.GetData(pd, FDATA_CENTROID, FDATA_MEAS, FDATA_POLAR, CurAlign, CurWP) If Result Then ActiveSheet.Cells(i, 6) = pd.X ActiveSheet.Cells(i, 7) = pd.Y ActiveSheet.Cells(i, 8) = pd.Z End If Else Result = FeatCommand.GetPoint(FPOINT_CENTROID, FDATA_MEAS, fx, fy, fz) If Result Then ActiveSheet.Cells(i, 6) = fx ActiveSheet.Cells(i, 7) = fy ActiveSheet.Cells(i, 8) = fz End If End If Result = FeatCommand.GetVector(FVECTOR_VECTOR, FDATA_MEAS, fi, fj, fk) If Result Then ActiveSheet.Cells(i, 9) = fi ActiveSheet.Cells(i, 10) = fj ActiveSheet.Cells(i, 11) = fk End If If cmd.IsDCCFeature Then HitPoints = FeatCommand.GetPoints(FHITDATA_CENTROID, FDATA_MEAS, FDATA_PART, CurAlign, CurWP) HitVectors = FeatCommand.GetPoints(FHITDATA_VECTOR, FDATA_MEAS, FDATA_PART, CurAlign, CurWP) For HitNo = 0 To FeatCommand.NumHits - 1 i = i + 1 Rows(i).Select Selection.Font.ColorIndex = 42 ActiveSheet.Cells(i, 6) = HitPoints(HitNo * 3 + 0) ActiveSheet.Cells(i, 7) = HitPoints(HitNo * 3 + 1) ActiveSheet.Cells(i, 8) = HitPoints(HitNo * 3 + 2) ActiveSheet.Cells(i, 9) = HitVectors(HitNo * 3 + 0) ActiveSheet.Cells(i, 10) = HitVectors(HitNo * 3 + 1) ActiveSheet.Cells(i, 11) = HitVectors(HitNo * 3 + 2) Next HitNo End If Else Rows(i).Select Selection.Font.ColorIndex = 42 Set FeatCommand = cmd.FeatureCommand Result = FeatCommand.GetPoint(FHITDATA_CENTROID, FDATA_MEAS, fx, fy, fz) ActiveSheet.Cells(i, 6) = fx ActiveSheet.Cells(i, 7) = fy ActiveSheet.Cells(i, 8) = fz Result = FeatCommand.GetVector(FVECTOR_VECTOR, FDATA_MEAS, fi, fj, fk) If Result Then ActiveSheet.Cells(i, 9) = fi ActiveSheet.Cells(i, 10) = fj ActiveSheet.Cells(i, 11) = fk End If End If next end sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |