hexagon logo

Dimensioning Torus

I have a question about a measured torus hopefully someone can answer. This is also my first post here, so bear with me Slight smile. I've searched a bit but I haven't seen anything that answers my question. Basically, I need to figure out the minor diameter of this torus. If I hover over that feature in the Edit toolbar, under the ACTL measurements I can see the measurement i’m looking for (the .25027). I’m trying to figure out a way to dimension it or manually extract it using a variable or anything related to that. Any suggestions?


Parents
  • Neil,
    I added generic features for the outer and inner diameter to your script. Pcdmis Feature Location cannot dimension this directly from the Torus.

    
    'Part 1:
    '================================================= ==========================
    ' Report torus
    '
    ' lists all Torus features In measurement routine And gives the Option To report minor And major diameters
    '
    ' attach this script To a custom icon On the toolbar And Each time the icon is clicked it will display the dialogue
    '
    '================================================= ==========================
    
    Sub Main()
    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    Dim PCDFeatCmd
    Dim prbhit
    Dim numhits As Integer
    
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands
    
    Dim cmd As Object
    Dim Fcntr As Integer
    Dim FeatureList$(999)
    
    Dim TorID,TX, TY, TZ, TI, TJ, TK, TD, TMD As String
    Dim MX, MY, MZ, MI, MJ, MK, MD, MMD As String
    
    '***** Predialog START
    Fcntr = 0
    ' Enumerate commands
    For Each cmd In PCDCommands
    ' 200 = Measured (learned) torus feature
    If cmd.Type = 200 Then
    FeatureList(Fcntr) = cmd.ID
    Fcntr = Fcntr + 1
    End If
    Next cmd
    '*****
    
    '***** Dialog START
    Begin Dialog DIALOG_1 31,48, 172, 141, "Point Extraction"
    ListBox 68,8,96,128, FeatureList$(), .ListBox
    PushButton 8,80,52,12, "Create", .PointsBtn
    PushButton 8,120,52,12, "Cancel", .CancelBtn
    End Dialog
    
    Dim Dlg1 As DIALOG_1
    button = Dialog(Dlg1)
    ' button 1 = create selected
    ' button 2 = Cancel selected
    '*****
    
    '***** Generic feature generation
    
    If button = 1 Then
    Set PCDCommand = PCDCommands.Item(FeatureList(Dlg1.Listbox))
    Set PCDFeatCmd = PCDCommand.FeatureCommand
    TorID=PCDCommand.id
    
    ' Get X, Y, Z, major diameter & minor diameter from selected torus & feed into generic circles
    
    Set PCDCommand = PCDCommands.Add(GENERIC_CONSTRUCTION, True)
    PCDCommand.Marked = True
    retval = PCDCommand.PutText ("0", THEO_X, 0)
    retval = PCDCommand.PutText ("0", THEO_Y, 0)
    retval = PCDCommand.PutText ("0", THEO_Z, 0)
    retval = PCDCommand.PutText ("0", THEO_X2, 0)
    retval = PCDCommand.PutText ("0", THEO_Y2, 0)
    retval = PCDCommand.PutText ("0", THEO_Z2, 0)
    retval = PCDCommand.PutText ("0", THEO_I, 0)
    retval = PCDCommand.PutText ("0", THEO_J, 0)
    retval = PCDCommand.PutText ("1", THEO_K, 0)
    retval = PCDCommand.PutText ("4", THEO_RADIUS, 0)
    retval = PCDCommand.PutText ("0", MEAS_X, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z, 0)
    retval = PCDCommand.PutText ("0", MEAS_X2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z2, 0)
    retval = PCDCommand.PutText ("0", MEAS_I, 0)
    retval = PCDCommand.PutText ("0", MEAS_J, 0)
    retval = PCDCommand.PutText ("1", MEAS_K, 0)
    retval = PCDCommand.PutText ("4", MEAS_RADIUS, 0)
    retval = PCDCommand.PutText (TorID & "_MAJOR_DIA", ID, 0)
    retval = PCDCommand.SetToggleString (4, GEN_FEAT_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, GEN_ALIGN_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, COORD_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, INOUT_TYPE, 0)
    Result = PCDCommand.SetExpression("GETTEXT(34,0,{" & TorID & "})/2", THEO_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(29,0,{" & TorID & "})/2", MEAS_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(7,0,{" & TorID & "})", THEO_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(8,0,{" & TorID & "})", THEO_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(9,0,{" & TorID & "})", THEO_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(16,0,{" & TorID & "})", THEO_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(17,0,{" & TorID & "})", THEO_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(18,0,{" & TorID & "})", THEO_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(22,0,{" & TorID & "})", MEAS_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(23,0,{" & TorID & "})", MEAS_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(24,0,{" & TorID & "})", MEAS_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(25,0,{" & TorID & "})", MEAS_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(26,0,{" & TorID & "})", MEAS_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(27,0,{" & TorID & "})", MEAS_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(40,0,{" & TorID & "})",INOUT_TYPE,0)
    PCDCommand.ReDraw
    PCDPartProgram.RefreshPart
    
    Set PCDCommand = PCDCommands.Add(GENERIC_CONSTRUCTION, True)
    PCDCommand.Marked = True
    retval = PCDCommand.PutText ("0", THEO_X, 0)
    retval = PCDCommand.PutText ("0", THEO_Y, 0)
    retval = PCDCommand.PutText ("0", THEO_Z, 0)
    retval = PCDCommand.PutText ("0", THEO_X2, 0)
    retval = PCDCommand.PutText ("0", THEO_Y2, 0)
    retval = PCDCommand.PutText ("0", THEO_Z2, 0)
    retval = PCDCommand.PutText ("0", THEO_I, 0)
    retval = PCDCommand.PutText ("0", THEO_J, 0)
    retval = PCDCommand.PutText ("1", THEO_K, 0)
    retval = PCDCommand.PutText ("1", THEO_RADIUS, 0)
    retval = PCDCommand.PutText ("0", MEAS_X, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z, 0)
    retval = PCDCommand.PutText ("0", MEAS_X2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z2, 0)
    retval = PCDCommand.PutText ("0", MEAS_I, 0)
    retval = PCDCommand.PutText ("0", MEAS_J, 0)
    retval = PCDCommand.PutText ("1", MEAS_K, 0)
    retval = PCDCommand.PutText ("1", MEAS_RADIUS, 0)
    retval = PCDCommand.PutText (TorID & "_MINOR_DIA", ID, 0)
    retval = PCDCommand.SetToggleString (4, GEN_FEAT_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, GEN_ALIGN_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, COORD_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, INOUT_TYPE, 0)
    Result = PCDCommand.SetExpression("GETTEXT(920,0,{" & TorID & "})/2", THEO_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(921,0,{" & TorID & "})/2", MEAS_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(7,0,{" & TorID & "})", THEO_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(8,0,{" & TorID & "})", THEO_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(9,0,{" & TorID & "})", THEO_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(16,0,{" & TorID & "})", THEO_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(17,0,{" & TorID & "})", THEO_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(18,0,{" & TorID & "})", THEO_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(22,0,{" & TorID & "})", MEAS_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(23,0,{" & TorID & "})", MEAS_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(24,0,{" & TorID & "})", MEAS_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(25,0,{" & TorID & "})", MEAS_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(26,0,{" & TorID & "})", MEAS_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(27,0,{" & TorID & "})", MEAS_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(40,0,{" & TorID & "})",INOUT_TYPE,0)
    PCDCommand.ReDraw
    PCDPartProgram.RefreshPart
    
    
    
Reply
  • Neil,
    I added generic features for the outer and inner diameter to your script. Pcdmis Feature Location cannot dimension this directly from the Torus.

    
    'Part 1:
    '================================================= ==========================
    ' Report torus
    '
    ' lists all Torus features In measurement routine And gives the Option To report minor And major diameters
    '
    ' attach this script To a custom icon On the toolbar And Each time the icon is clicked it will display the dialogue
    '
    '================================================= ==========================
    
    Sub Main()
    Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand
    Dim PCDFeatCmd
    Dim prbhit
    Dim numhits As Integer
    
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set PCDPartPrograms = PCDApp.PartPrograms
    Set PCDPartProgram = PCDApp.ActivePartProgram
    Set PCDCommands = PCDPartProgram.Commands
    
    Dim cmd As Object
    Dim Fcntr As Integer
    Dim FeatureList$(999)
    
    Dim TorID,TX, TY, TZ, TI, TJ, TK, TD, TMD As String
    Dim MX, MY, MZ, MI, MJ, MK, MD, MMD As String
    
    '***** Predialog START
    Fcntr = 0
    ' Enumerate commands
    For Each cmd In PCDCommands
    ' 200 = Measured (learned) torus feature
    If cmd.Type = 200 Then
    FeatureList(Fcntr) = cmd.ID
    Fcntr = Fcntr + 1
    End If
    Next cmd
    '*****
    
    '***** Dialog START
    Begin Dialog DIALOG_1 31,48, 172, 141, "Point Extraction"
    ListBox 68,8,96,128, FeatureList$(), .ListBox
    PushButton 8,80,52,12, "Create", .PointsBtn
    PushButton 8,120,52,12, "Cancel", .CancelBtn
    End Dialog
    
    Dim Dlg1 As DIALOG_1
    button = Dialog(Dlg1)
    ' button 1 = create selected
    ' button 2 = Cancel selected
    '*****
    
    '***** Generic feature generation
    
    If button = 1 Then
    Set PCDCommand = PCDCommands.Item(FeatureList(Dlg1.Listbox))
    Set PCDFeatCmd = PCDCommand.FeatureCommand
    TorID=PCDCommand.id
    
    ' Get X, Y, Z, major diameter & minor diameter from selected torus & feed into generic circles
    
    Set PCDCommand = PCDCommands.Add(GENERIC_CONSTRUCTION, True)
    PCDCommand.Marked = True
    retval = PCDCommand.PutText ("0", THEO_X, 0)
    retval = PCDCommand.PutText ("0", THEO_Y, 0)
    retval = PCDCommand.PutText ("0", THEO_Z, 0)
    retval = PCDCommand.PutText ("0", THEO_X2, 0)
    retval = PCDCommand.PutText ("0", THEO_Y2, 0)
    retval = PCDCommand.PutText ("0", THEO_Z2, 0)
    retval = PCDCommand.PutText ("0", THEO_I, 0)
    retval = PCDCommand.PutText ("0", THEO_J, 0)
    retval = PCDCommand.PutText ("1", THEO_K, 0)
    retval = PCDCommand.PutText ("4", THEO_RADIUS, 0)
    retval = PCDCommand.PutText ("0", MEAS_X, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z, 0)
    retval = PCDCommand.PutText ("0", MEAS_X2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z2, 0)
    retval = PCDCommand.PutText ("0", MEAS_I, 0)
    retval = PCDCommand.PutText ("0", MEAS_J, 0)
    retval = PCDCommand.PutText ("1", MEAS_K, 0)
    retval = PCDCommand.PutText ("4", MEAS_RADIUS, 0)
    retval = PCDCommand.PutText (TorID & "_MAJOR_DIA", ID, 0)
    retval = PCDCommand.SetToggleString (4, GEN_FEAT_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, GEN_ALIGN_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, COORD_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, INOUT_TYPE, 0)
    Result = PCDCommand.SetExpression("GETTEXT(34,0,{" & TorID & "})/2", THEO_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(29,0,{" & TorID & "})/2", MEAS_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(7,0,{" & TorID & "})", THEO_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(8,0,{" & TorID & "})", THEO_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(9,0,{" & TorID & "})", THEO_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(16,0,{" & TorID & "})", THEO_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(17,0,{" & TorID & "})", THEO_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(18,0,{" & TorID & "})", THEO_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(22,0,{" & TorID & "})", MEAS_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(23,0,{" & TorID & "})", MEAS_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(24,0,{" & TorID & "})", MEAS_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(25,0,{" & TorID & "})", MEAS_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(26,0,{" & TorID & "})", MEAS_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(27,0,{" & TorID & "})", MEAS_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(40,0,{" & TorID & "})",INOUT_TYPE,0)
    PCDCommand.ReDraw
    PCDPartProgram.RefreshPart
    
    Set PCDCommand = PCDCommands.Add(GENERIC_CONSTRUCTION, True)
    PCDCommand.Marked = True
    retval = PCDCommand.PutText ("0", THEO_X, 0)
    retval = PCDCommand.PutText ("0", THEO_Y, 0)
    retval = PCDCommand.PutText ("0", THEO_Z, 0)
    retval = PCDCommand.PutText ("0", THEO_X2, 0)
    retval = PCDCommand.PutText ("0", THEO_Y2, 0)
    retval = PCDCommand.PutText ("0", THEO_Z2, 0)
    retval = PCDCommand.PutText ("0", THEO_I, 0)
    retval = PCDCommand.PutText ("0", THEO_J, 0)
    retval = PCDCommand.PutText ("1", THEO_K, 0)
    retval = PCDCommand.PutText ("1", THEO_RADIUS, 0)
    retval = PCDCommand.PutText ("0", MEAS_X, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z, 0)
    retval = PCDCommand.PutText ("0", MEAS_X2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Y2, 0)
    retval = PCDCommand.PutText ("0", MEAS_Z2, 0)
    retval = PCDCommand.PutText ("0", MEAS_I, 0)
    retval = PCDCommand.PutText ("0", MEAS_J, 0)
    retval = PCDCommand.PutText ("1", MEAS_K, 0)
    retval = PCDCommand.PutText ("1", MEAS_RADIUS, 0)
    retval = PCDCommand.PutText (TorID & "_MINOR_DIA", ID, 0)
    retval = PCDCommand.SetToggleString (4, GEN_FEAT_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, GEN_ALIGN_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, COORD_TYPE, 0)
    retval = PCDCommand.SetToggleString (1, INOUT_TYPE, 0)
    Result = PCDCommand.SetExpression("GETTEXT(920,0,{" & TorID & "})/2", THEO_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(921,0,{" & TorID & "})/2", MEAS_RADIUS, 0)
    Result = PCDCommand.SetExpression("GETTEXT(7,0,{" & TorID & "})", THEO_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(8,0,{" & TorID & "})", THEO_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(9,0,{" & TorID & "})", THEO_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(16,0,{" & TorID & "})", THEO_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(17,0,{" & TorID & "})", THEO_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(18,0,{" & TorID & "})", THEO_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(22,0,{" & TorID & "})", MEAS_X, 0)
    Result = PCDCommand.SetExpression("GETTEXT(23,0,{" & TorID & "})", MEAS_Y, 0)
    Result = PCDCommand.SetExpression("GETTEXT(24,0,{" & TorID & "})", MEAS_Z, 0)
    Result = PCDCommand.SetExpression("GETTEXT(25,0,{" & TorID & "})", MEAS_I, 0)
    Result = PCDCommand.SetExpression("GETTEXT(26,0,{" & TorID & "})", MEAS_J, 0)
    Result = PCDCommand.SetExpression("GETTEXT(27,0,{" & TorID & "})", MEAS_K, 0)
    Result = PCDCommand.SetExpression("GETTEXT(40,0,{" & TorID & "})",INOUT_TYPE,0)
    PCDCommand.ReDraw
    PCDPartProgram.RefreshPart
    
    
    
Children
No Data