hexagon logo

Script to pull nominal and tols

I am attempting to have a script create a csv file for later use. What I would like is to gain the output_id, and for each respective axis it reports obtain the nom, ptol, mtol.
Currently I have modified some script and what I found is when I have a location/tp output the output_id appears with 0,0,0. Then in the next 'instance' the output_id = 0 and I get the appropriate nom, ptol, mtol value. Almost every other output style (in legacy) will pull the output_id, nom, ptol, mtol without a gap. Here is the code I am using so far:

Dim Axs As String, Nom As String, Oid As String, Uptol As String, Lowtol As String

Part_S = ""
i = 0
For Each Cmd In DmisCommands
If Cmd.IsDimension Then
k = k + 1
Set dcmd = Cmd.dimensioncommand
Ax_s = Cmd.TypeDescription
O_id = CStr(dcmd.ID)
No_m = CStr(dcmd.Nominal)
Up_tol = CStr(dcmd.Plus)
Low_tol = CStr(dcmd.Minus)

If Ax_s = "Datum Definition" Then
GoTo Skip
End If

If Ax_s = "Dimension Position" Or Ax_s = "Dimension Location" Then
O_id_h = O_id
Mult_i = "True"
i = i+1
Else
Mult_i = "False"
i = 0
End If

If Mult_i = "False" Then
If k = 1 Then
Part_S = O_id & "," & No_m & "," & Up_tol & "," & Low_tol
End If
If k > 1 Then
Part_S = Part_S & "," & O_id & "," & No_m & "," & Up_tol & "," & Low_tol
End If
End If
If Mult_i = "True" Then
If k = 1 Then
Part_S = O_id_h
End If
If k > 1 Then
Part_S = Part_S & "," & O_id_h & "," & No_m & "," & Up_tol & "," & Low_tol
End If
End If

Skip:
End If
Next Cmd
Part_S = SerNum & "," & Part_S

Private Sub MakeStatusFile()
Open INFOPath For Append As #1
Print #1, Part_S
Close #1
Exit Sub
End Sub


For example the following output will appear as "LOC_FORM",0,0,0,,"5.4756","4.0000","0.002",,"0","5.0000","0":
DIM LOC_FORM= LOCATION OF CIRCLE CIR_A1 UNITS=IN ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH HALF ANGLE=NO
AX MEAS NOMINAL +TOL -TOL DEV OUTTOL
D 5.47560 5.47560 4.00000 0.00200 0.00000 0.00000 #---
RN 0.00000 0.00000 5.00000 0.00000 0.00000 0.00000 #---
END OF DIMENSION LOC_FORM


I'd like it to be: "LOC_FORM","5.4756","4.0000","0.002","LOC_FORM","0","5.0000","0"
TYIA
Parents
  • retval = DmisCommand.PutTextEx ("DF", SUMMARY_AXIS, 6, "SEG=1")
    

    Above line of code appears in the exported basic script with a Geotol output that has the size of the feature, "DF" box checked.

    The below code can test a Positional output for the check boxes use.
    If cmd.GetTextEx(SUMMARY_AXIS, 6, "SEG=1") <> "DF" Then
    


    Why do none of the other GeoTol outputs have something like this line when the "DF" box is checked?
    When I Export to Basic and compare the outputs about the "DF" box being checked I can find 4 additional lines:
    Set UAME SIZE Item 1 = #####
    retval = DmisCommand.PutText("#####", UPPER_SIZE, 1)
    Set LOCAL SIZE Item 1 = #####
    retval = DmisCommand.PutText("#####", LOWER_SIZE, 1)
    


    In some efforts I have checked to find these lines, regardless of the "DF" box being un/checked, this information exists.
    I'm trying to determine how to skip the size information when "DF" is not checked.
Reply
  • retval = DmisCommand.PutTextEx ("DF", SUMMARY_AXIS, 6, "SEG=1")
    

    Above line of code appears in the exported basic script with a Geotol output that has the size of the feature, "DF" box checked.

    The below code can test a Positional output for the check boxes use.
    If cmd.GetTextEx(SUMMARY_AXIS, 6, "SEG=1") <> "DF" Then
    


    Why do none of the other GeoTol outputs have something like this line when the "DF" box is checked?
    When I Export to Basic and compare the outputs about the "DF" box being checked I can find 4 additional lines:
    Set UAME SIZE Item 1 = #####
    retval = DmisCommand.PutText("#####", UPPER_SIZE, 1)
    Set LOCAL SIZE Item 1 = #####
    retval = DmisCommand.PutText("#####", LOWER_SIZE, 1)
    


    In some efforts I have checked to find these lines, regardless of the "DF" box being un/checked, this information exists.
    I'm trying to determine how to skip the size information when "DF" is not checked.
Children
No Data