hexagon logo

A hand with coding????

guys,

this is probably easier than reading the English language to most of you folks, but I'm stumped. What I'm trying to do is extract the start and end angles from the following autocircle (by the way, this is 4.2 MR1) and then swap them

CIR3 =FEAT/CONTACT/CIRCLE,CARTESIAN,IN,LEAST_SQR
THEO/<0,2,0>,<0,0,1>,1,0,35
ACTL/<0,2,0>,<0,0,1>,1,0,35
TARG/<0,2,0>,<0,0,1>
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW ADVANCED MEASUREMENT OPTIONS=NO
SHOW_CONTACT_PARAMETERS=YES
NUMHITS=3,DEPTH=0,PITCH=0
SAMPLE HITS=0,SPACER=0
AVOIDANCE MOVE=NO,DISTANCE=0.5
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOWHITS=NO

At this point, I cannot get anywhere with this. I tried to simplify my program and statically set the start angle of the autocircle. I can't get that to work either, so maybe one of you folks knows how to do this?

Private Sub cmd_Execute_Click()

Dim DMISApp As Object
Set DMISApp = CreateObject("PCDLRN.Application")
Dim DMISPart As Object
Set DMISPart = DMISApp.ActivePartProgram
Dim Feature As String
Feature = txt_Feature.Text
Dim StartAng As Double
Dim EndAng As Double

Dim Cmds As Object
Set Cmds = DMISPart.Commands
Dim Cmd As Object


'GET RID OF THIS NEXT LINE WHEN YOU COMPILE
Feature = "CIR3"


For Each Cmd In Cmds
If Cmd.ID = Feature And Cmd.Type = AUTO_CIRCLE Then
MsgBox (Cmd.StartAngle)
Cmd.PutText 15, StartAngle, 0
Cmd.ReDraw
End If
Next Cmd

End Sub


Thanks,
Parents
  • in case anyone is interested...I wrote a script to flip auto circles around because the original release of PCDMIS 4.2 will sometimes take a program that was written in a prior version and flip the circles. It looks like this was fixed in MR1, but I thought it would be fun to try to write the code anyways. This is my first real automation script, so if you see any flaws with it, please let me know. Otherwise, enjoy!

    Option Explicit

    Private Sub cmd_Execute_Click()

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim Cmds As Object
    Dim Cmd As Object

    Dim tStartAng As String
    Dim tEndAng As String
    Dim Direction As String
    Dim Count As Integer
    Dim Feature As String
    Dim Flag As Boolean

    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set Cmds = DmisPart.Commands
    Feature = txt_Feature.Text
    pic_Output.Print "Searching for " & Feature & "..."
    Flag = False

    For Each Cmd In Cmds
    If Cmd.Type = AUTO_CIRCLE And UCase(Cmd.ID) = UCase(Feature) Then

    tStartAng = Cmd.GetText(THEO_START_ANG, 0)
    tEndAng = Cmd.GetText(THEO_END_ANG, 0)

    Cmd.PutText tEndAng, THEO_START_ANG, 1
    Cmd.PutText tStartAng, THEO_END_ANG, 1
    Cmd.ReDraw

    pic_Output.Print "Reversed start and end angles for " & Feature

    txt_Feature.Text = ""
    txt_Feature.SetFocus
    Flag = True
    End If
    Next Cmd

    If Flag = False Then
    pic_Output.Print "Did not find " & Feature
    End If

    End Sub
Reply
  • in case anyone is interested...I wrote a script to flip auto circles around because the original release of PCDMIS 4.2 will sometimes take a program that was written in a prior version and flip the circles. It looks like this was fixed in MR1, but I thought it would be fun to try to write the code anyways. This is my first real automation script, so if you see any flaws with it, please let me know. Otherwise, enjoy!

    Option Explicit

    Private Sub cmd_Execute_Click()

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim Cmds As Object
    Dim Cmd As Object

    Dim tStartAng As String
    Dim tEndAng As String
    Dim Direction As String
    Dim Count As Integer
    Dim Feature As String
    Dim Flag As Boolean

    Set DmisApp = CreateObject("PCDLRN.Application")
    Set DmisPart = DmisApp.ActivePartProgram
    Set Cmds = DmisPart.Commands
    Feature = txt_Feature.Text
    pic_Output.Print "Searching for " & Feature & "..."
    Flag = False

    For Each Cmd In Cmds
    If Cmd.Type = AUTO_CIRCLE And UCase(Cmd.ID) = UCase(Feature) Then

    tStartAng = Cmd.GetText(THEO_START_ANG, 0)
    tEndAng = Cmd.GetText(THEO_END_ANG, 0)

    Cmd.PutText tEndAng, THEO_START_ANG, 1
    Cmd.PutText tStartAng, THEO_END_ANG, 1
    Cmd.ReDraw

    pic_Output.Print "Reversed start and end angles for " & Feature

    txt_Feature.Text = ""
    txt_Feature.SetFocus
    Flag = True
    End If
    Next Cmd

    If Flag = False Then
    pic_Output.Print "Did not find " & Feature
    End If

    End Sub
Children
No Data