I need to iterate through all the commands in a program looking for any GeoTol dimensions that are Profile of a Surface with no datums.
How would I do this?
Your Products have been synced, click here to refresh
I need to iterate through all the commands in a program looking for any GeoTol dimensions that are Profile of a Surface with no datums.
How would I do this?
hi
here is a basic script that does this, you can start it from pcDMIS or as an Excel macro.
Output goes to "C:\Users\Public\Documents\ProfilSearchOutput.txt"
only works with geotol profile
Sub Main() ' Error On Error Resume Next ' Dim something Dim DmisApp As Object Dim DmisPart As Object Dim DmisCommands As Object Dim DmisCommand As Object Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set DmisCommands = DmisPart.Commands Dim iCmdCount, iProfilCount, iNoDatumCount As Integer Dim sPath As String 'sPath = DmisApp.GetSystemDocuments(False) sPath = "C:\Users\Public\Documents\ProfilSearchOutput.txt" ' open file Open sPath For Output As #1 Print #1, DmisPart.FullName Print #1, DmisPart.ProgramVersionName Print #1, " " ' search part iCmdCount = 0 iProfilCount = 0 iNoDatumCount = 0 For Each DmisCommand In DmisCommands iCmdCount = iCmdCount + 1 If (DmisCommand.Type = ISO_TOLERANCE_COMMAND) Or (DmisCommand.Type = ASME_TOLERANCE_COMMAND) Then 'retval = DmisCommand.SetToggleString(8, SEGMENT_TYPE_TOGGLE, 1) -> line 'retval = DmisCommand.SetToggleString(9, SEGMENT_TYPE_TOGGLE, 1) -> plane If (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 8) Or (DmisCommand.GetToggleValue(SEGMENT_TYPE_TOGGLE, 1) = 9) Then iProfilCount = iProfilCount + 1 If DmisCommand.GetTextEx(DATUM_ID, 1, "SEG=1") = "" Then iNoDatumCount = iNoDatumCount + 1 Print #1, "Nr: " & CStr(iCmdCount) & " " & DmisCommand.ID End If End If End If Next DmisCommand ' close file Print #1, " " Print #1, "Command Count: " & CStr(iCmdCount) Print #1, "Profil Count: " & CStr(iProfilCount) Print #1, "no Datum Count: " & CStr(iNoDatumCount) Close #1 ' unDim something Set DmisCommand = Nothing Set DmisCommands = Nothing Set DmisPart = Nothing Set DmisApp = Nothing End Sub
Thank you thank you thank you!
That was exactly what I needed.
What the heck is ToggleValue used for anyway? Seems like a catchall.
in a togglebox the return value is an index of what is clicked in the display list of this box.
This return value was called ToggleValue instead of index in pcdmis.
This togglebox "SEGMENT_TYPE_TOGGLE" shows which geotol type is currently being use for each geotol-command
regarding reading the togglebox, I think this is how it is handled in most programming languages
The list used by "SEGMENT_TYPE_TOGGLE"-Togglebox will probably not change in the future and the valueindex "8" is the profile line, "9" is the profile plane
in a togglebox the return value is an index of what is clicked in the display list of this box.
This return value was called ToggleValue instead of index in pcdmis.
This togglebox "SEGMENT_TYPE_TOGGLE" shows which geotol type is currently being use for each geotol-command
regarding reading the togglebox, I think this is how it is handled in most programming languages
The list used by "SEGMENT_TYPE_TOGGLE"-Togglebox will probably not change in the future and the valueindex "8" is the profile line, "9" is the profile plane
© 2025 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |