hexagon logo

Setting the ID as the ID of a Previous Command

I am still having problems getting the ID to set properly for Dimension locations and true position variables. When testing using message boxes, the way that PCDMIS reads them is

ID = CIR2 (just an example)
AX =
MEAS = 0.000
ID =
AX = D (again example)
MEAS = 4.500

So, I was going through the help files and found the Command.Prev page, but it was not very useful.

Does anyone have experience with this command? And if so, what does it do? And what is the proper syntax for it?

And as a follow up to that. Has anyone set an ID to the ID of a previous command? And if you did, how did you do it?

Thank you so much. I know I am asking a lot of questions.
  • You'd have to use a placeholder for the current ID and the previous ID.

    Pseudocode:
    if Len(PCDCommand.ID) > 0 then
      PrevID = CurID
      CurID = PCDCommand.ID
    end if
    


    Kind of...
  • You'd have to use a placeholder for the current ID and the previous ID.

    Pseudocode:
    if Len(PCDCommand.ID) > 0 then
      PrevID = CurID
      CurID = PCDCommand.ID
    end if
    


    Kind of...


    Thanks. I will play with this and hopefully get it to work. I had tried to simply call it out saying DIMENSION_START_LOCATION and DIMENSION_TRUE_START_POSITION but PC DMIS still insists on giving me the blank place holders. It is making me crazy. Most dimensions I have figured out how to call them out from the feature commands and get the proper measurements, but for true position, it is figure out how to call it out or start doing a lot of math.

    Again, thanks. I do appreciate your vast well of knowledge working with this program.
  • That is freaking genius! Just so others can see what it does, here is the code that pops up the information in a message box.

    Dim ObjApp As Object
          Dim ObjCmds As Object
          Dim ObjCmd As Object
          Dim ObjPart As Object
          Dim ObjDimCmd as Object
          Set ObjApp = CreateObject("PCDLRN.Application")
          Set ObjPart = ObjApp.ActivePartProgram
          Set ObjCmds = ObjPart.Commands
    
    Dim MyID As String
    Dim PrevID As String
    Dim Meas As String
    Dim MyAx As String 
          
    For Each ObjCmd In ObjCmds
    If ObjCmd.IsDimension Then 
    Set ObjDimCmd = ObjCmd.DimensionCommand
    If Len(ObjDimCmd.ID) > 0 Then
       PrevID = MyID 
       MyID = ObjDimCmd.ID
    End If  
    Meas = ObjDimCmd.Measured
    MyAx = ObjDimCmd.AxisLetter
    c = ","
    MsgBox MyID & c & MyAx & c & Meas
    End If
    Next


    Now, when I get it to work as desired in the OLE, I can post that as well. Slight smile
  • Great! Glad to have helped!


    You have helped a ton. I have been playing with this and trying different ideas to do this and was getting no where. I never thought about the Len function. It is amazing how easily that works.
  • Thanks to both of you for your online tutorials.

    Lots of great ideas.

    Keep up the good work.