hexagon logo

How to get data from dimension of profile?

Hi, I first take five points and construct them to be a feature set. And then i caculate the profile.
how can i get the "T" for every point by the profile dimension with VB or VAB or C#? I use PCDMIS
2013. Thank you very much
Parents
  • You have to get the feature set from the profile, then get the points from the feature set, then calculate the deviation from the theo and meas XYZ values of the points:
            Dim oPcd As PCDLRN.Application = New PCDLRN.Application
            Dim oCmds As Object = oPcd.ActivePartProgram.Commands
            Dim oPnt As Command
            Dim mX As Double
            Dim mY As Double
            Dim mZ As Double
            Dim tX As Double
            Dim tY As Double
            Dim tZ As Double
            Dim sVals As String = ""
    
            oPcd.Visible = False
    
            For Each oCmd As Command In oCmds
                If oCmd.IsDimension AndAlso oCmd.Type = DIMENSION_PROFILE Then
                    sVals &= oCmd.ID & vbCrLf
                    Dim fs As Command = oCmds.item(oCmd.DimensionCommand.Feat1) 'get the referenced feature set
                    For i As Integer = 1 To fs.FeatureCommand.NumHits 'iterate through each point in the feature set
                        oPnt = oCmds.item(fs.GetText(REF_ID, i)) 'get the point command
                        oPnt.FeatureCommand.GetPoint(FPOINT_TYPES.FPOINT_CENTROID, FDATA_DATASET.FDATA_MEAS, mX, mY, mZ) 'get measured values
                        oPnt.FeatureCommand.GetPoint(FPOINT_TYPES.FPOINT_CENTROID, FDATA_DATASET.FDATA_TARG, tX, tY, tZ) 'get theo values
                        Dim dDeviation As Double = Math.Sqrt((tX - mX) ^ 2 + (tY - mY) ^ 2 + (tZ - mZ) ^ 2) 'calculate deviation
                        sVals &= "   " & oPnt.ID & " " & dDeviation.ToString("###0.0000") & vbCrLf
                    Next
                End If
            Next
            oPcd.Visible = True
            oCmds = Nothing
            oPcd = Nothing
            Console.WriteLine(sVals)
Reply
  • You have to get the feature set from the profile, then get the points from the feature set, then calculate the deviation from the theo and meas XYZ values of the points:
            Dim oPcd As PCDLRN.Application = New PCDLRN.Application
            Dim oCmds As Object = oPcd.ActivePartProgram.Commands
            Dim oPnt As Command
            Dim mX As Double
            Dim mY As Double
            Dim mZ As Double
            Dim tX As Double
            Dim tY As Double
            Dim tZ As Double
            Dim sVals As String = ""
    
            oPcd.Visible = False
    
            For Each oCmd As Command In oCmds
                If oCmd.IsDimension AndAlso oCmd.Type = DIMENSION_PROFILE Then
                    sVals &= oCmd.ID & vbCrLf
                    Dim fs As Command = oCmds.item(oCmd.DimensionCommand.Feat1) 'get the referenced feature set
                    For i As Integer = 1 To fs.FeatureCommand.NumHits 'iterate through each point in the feature set
                        oPnt = oCmds.item(fs.GetText(REF_ID, i)) 'get the point command
                        oPnt.FeatureCommand.GetPoint(FPOINT_TYPES.FPOINT_CENTROID, FDATA_DATASET.FDATA_MEAS, mX, mY, mZ) 'get measured values
                        oPnt.FeatureCommand.GetPoint(FPOINT_TYPES.FPOINT_CENTROID, FDATA_DATASET.FDATA_TARG, tX, tY, tZ) 'get theo values
                        Dim dDeviation As Double = Math.Sqrt((tX - mX) ^ 2 + (tY - mY) ^ 2 + (tZ - mZ) ^ 2) 'calculate deviation
                        sVals &= "   " & oPnt.ID & " " & dDeviation.ToString("###0.0000") & vbCrLf
                    Next
                End If
            Next
            oPcd.Visible = True
            oCmds = Nothing
            oPcd = Nothing
            Console.WriteLine(sVals)
Children
No Data