hexagon logo

Have the roundness of an auto-circle in a variable

Hi there,

I am trying to have the roundness of an auto-element in a variable. I cannot use a dimension as I have 30,000 circles and try to export all of these roudnesses via a script to a txt file.

Does anyone knows how to call the roundness of an auto-circle into a variable?

Thanks in advance.
Parents
  • Hello,

    I haven't tested it, forgive me if there's a typo somewhere​
    (works only with "CONTACT_CIRCLE_FEATURE")

    
    [...]
    
    ' Dim Something
    Dim iPointCount As Integer
    Dim iCount As Integer
    Dim dVectorX, dVectorY, dVectorZ As Double
    Dim dRadius As Double
    Dim dMax, dMin, dRound As Double
    
    ' Center from Cirle
    CirCenterX = PCDCommand.GetText(MEAS_X, 0)
    CirCenterY = PCDCommand.GetText(MEAS_Y, 0)
    CirCenterZ = PCDCommand.GetText(MEAS_Z, 0)
    
    iPointCount = PCDCommand.GetText(N_HITS, 0)
    ' each Point
    For iCount = 1 To iPointCount
    ' Vector "CIR1.HIT[1..CIR1.NUMHITS].XYZ-CIR1.XYZ"
    dVectorX = PCDCommand.GetText(MEAS_X, iCount) - CirCenterX
    dVectorY = PCDCommand.GetText(MEAS_Y, iCount) - CirCenterY
    dVectorZ = PCDCommand.GetText(MEAS_Z, iCount) - CirCenterZ
    
    ' Radius from each point "SQRT(DOT())"
    dRadius = Sqr((dVectorX * dVectorX) + (dVectorY * dVectorY) + (dVectorZ * dVectorZ))
    
    ' remember max min "MAX(V1)"
    If iCount = 1 Then
    dMax = dRadius
    dMin = dRadius
    End If
    
    If dMax < dRadius Then dMax = dRadius
    If dMin > dRadius Then dMin = dRadius
    Next iCount
    
    ' result "ROUNDNESS=MAX(V1)-MIN(V1)"
    dRound = dMax - dMin​
    
    [...]
    
    
Reply
  • Hello,

    I haven't tested it, forgive me if there's a typo somewhere​
    (works only with "CONTACT_CIRCLE_FEATURE")

    
    [...]
    
    ' Dim Something
    Dim iPointCount As Integer
    Dim iCount As Integer
    Dim dVectorX, dVectorY, dVectorZ As Double
    Dim dRadius As Double
    Dim dMax, dMin, dRound As Double
    
    ' Center from Cirle
    CirCenterX = PCDCommand.GetText(MEAS_X, 0)
    CirCenterY = PCDCommand.GetText(MEAS_Y, 0)
    CirCenterZ = PCDCommand.GetText(MEAS_Z, 0)
    
    iPointCount = PCDCommand.GetText(N_HITS, 0)
    ' each Point
    For iCount = 1 To iPointCount
    ' Vector "CIR1.HIT[1..CIR1.NUMHITS].XYZ-CIR1.XYZ"
    dVectorX = PCDCommand.GetText(MEAS_X, iCount) - CirCenterX
    dVectorY = PCDCommand.GetText(MEAS_Y, iCount) - CirCenterY
    dVectorZ = PCDCommand.GetText(MEAS_Z, iCount) - CirCenterZ
    
    ' Radius from each point "SQRT(DOT())"
    dRadius = Sqr((dVectorX * dVectorX) + (dVectorY * dVectorY) + (dVectorZ * dVectorZ))
    
    ' remember max min "MAX(V1)"
    If iCount = 1 Then
    dMax = dRadius
    dMin = dRadius
    End If
    
    If dMax < dRadius Then dMax = dRadius
    If dMin > dRadius Then dMin = dRadius
    Next iCount
    
    ' result "ROUNDNESS=MAX(V1)-MIN(V1)"
    dRound = dMax - dMin​
    
    [...]
    
    
Children