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
  • Thanks

    Can anyone help me out with the script? I guess I cannot write the red highlighted part as I get a syntax error.

    Sub Main

    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    Dim tX, tY, tZ, tRound, mX, mY, mZ, tD, mD, mRoundMax, mRoundMin, mRound, featName As String
    Dim FMcd As Object
    Dim cmd As Object

    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands

    Dim iCnt As Integer

    Dim savePath
    Dim repFolder
    Dim repName

    repName = format(now(),"YYYYMMDDHHNNSS")
    savePath = "D:\PC-DMIS Data\Scripts\TEMP"
    repFolder = left(PCDPartProgram.Name,len(PCDPartProgram.Name)-4)

    Open savePath & repFolder & repName & ".TXT" For Append As Home
    For iCnt = 1 To PCDCommands.Count
    Set PCDCommand = PCDCommands.Item(iCnt)

    If Left(PCDCommand.ID, 3) = "CIR" Then

    tX = PCDCommand.GetText(THEO_X, 0)
    tY = PCDCommand.GetText(THEO_Y, 0)
    tZ = PCDCommand.GetText(THEO_Z, 0)
    tD = PCDCommand.GetText(THEO_DIAM, 0)
    tRound = 0


    mX = PCDCommand.GetText(MEAS_X, 0)
    mY = PCDCommand.GetText(MEAS_Y, 0)
    mZ = PCDCommand.GetText(MEAS_Z, 0)
    mD = PCDCommand.GetText(MEAS_DIAM, 0)

    featName = PCDCommand.ID

    mRoundMax = featName.HIT[1..featName.NumHits].XYZ
    mRoundMax = MAX(SQRT(DOT(featName.HIT[1..featName.NumHits].XYZ - featName.XYZ, featName.HIT[1..featName.NumHits].XYZ - featName.XYZ)))
    mRoundMin = MIN(SQRT(DOT(featName.HIT[1..featName.NumHits].XYZ-featName.XYZ,featName.HIT[1..featName.NumHits].XYZ-featName.XYZ)))
    mRound = mRoundMax - mRoundMin


    Write #1, PCDCommand.ID & ", " & tX & ", " & tY & ", " & tZ & ", " & tD & ", " & tRound & ", " & mX & ", " & mY & ", " & mZ & ", " & mD & ", " & mRound

    End If

    Next iCnt

    Close Home
    Set PCDCommands = Nothing
    Set PCDPartProgram = Nothing
    Set PCDPartPrograms = Nothing
    Set PCDApp = Nothing

    End Sub​
Reply
  • Thanks

    Can anyone help me out with the script? I guess I cannot write the red highlighted part as I get a syntax error.

    Sub Main

    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    Dim tX, tY, tZ, tRound, mX, mY, mZ, tD, mD, mRoundMax, mRoundMin, mRound, featName As String
    Dim FMcd As Object
    Dim cmd As Object

    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands

    Dim iCnt As Integer

    Dim savePath
    Dim repFolder
    Dim repName

    repName = format(now(),"YYYYMMDDHHNNSS")
    savePath = "D:\PC-DMIS Data\Scripts\TEMP"
    repFolder = left(PCDPartProgram.Name,len(PCDPartProgram.Name)-4)

    Open savePath & repFolder & repName & ".TXT" For Append As Home
    For iCnt = 1 To PCDCommands.Count
    Set PCDCommand = PCDCommands.Item(iCnt)

    If Left(PCDCommand.ID, 3) = "CIR" Then

    tX = PCDCommand.GetText(THEO_X, 0)
    tY = PCDCommand.GetText(THEO_Y, 0)
    tZ = PCDCommand.GetText(THEO_Z, 0)
    tD = PCDCommand.GetText(THEO_DIAM, 0)
    tRound = 0


    mX = PCDCommand.GetText(MEAS_X, 0)
    mY = PCDCommand.GetText(MEAS_Y, 0)
    mZ = PCDCommand.GetText(MEAS_Z, 0)
    mD = PCDCommand.GetText(MEAS_DIAM, 0)

    featName = PCDCommand.ID

    mRoundMax = featName.HIT[1..featName.NumHits].XYZ
    mRoundMax = MAX(SQRT(DOT(featName.HIT[1..featName.NumHits].XYZ - featName.XYZ, featName.HIT[1..featName.NumHits].XYZ - featName.XYZ)))
    mRoundMin = MIN(SQRT(DOT(featName.HIT[1..featName.NumHits].XYZ-featName.XYZ,featName.HIT[1..featName.NumHits].XYZ-featName.XYZ)))
    mRound = mRoundMax - mRoundMin


    Write #1, PCDCommand.ID & ", " & tX & ", " & tY & ", " & tZ & ", " & tD & ", " & tRound & ", " & mX & ", " & mY & ", " & mZ & ", " & mD & ", " & mRound

    End If

    Next iCnt

    Close Home
    Set PCDCommands = Nothing
    Set PCDPartProgram = Nothing
    Set PCDPartPrograms = Nothing
    Set PCDApp = Nothing

    End Sub​
Children
No Data