hexagon logo

Editing Features/Constructed Features Inside Loop Array?

Hello All,

Fairly new to loops in PCdmis and hoping someone can shed some light on this.

I have a simple loop setup to go through 2 parts. I found (through some extensive searching) that I can change which part is being dimensioned by adding a "[1]" or "[2]" to the feature being dimensioned.
If I add "[1]" to Point1 it will call up Point1 on Part 1. As seen in the code here:

DIM DIM1= LOCATION OF POINT POINT [1] UNITS=MM ,$
GRAPH=OFF TEXT=OFF MULT=10.00 OUTPUT=BOTH
AX MEAS NOMINAL +TOL -TOL DEV OUTTOL
X 19.969 20.000 0.050 0.050 -0.031 0.000 -#-------
Y 19.996 20.000 0.050 0.050 -0.004 0.000 ----#----
Z 0.005 0.000 0.050 0.050 0.005 0.000 ----#----
T 0.005 0.000 0.050 0.050 0.005 0.000 ----#----
END OF DIMENSION DIM1​

This works great, and I can add the bracketed numbers to each dimension to individually edit them. My question is: How do I do the same thing, but actually edit the feature itself, instead of just the measurement of it?

TLDR: I want to edit a single instance of a feature in a looping program without affecting the other instances of it. Is that possible?
  • You will need to control it with a variable. This if grouping will exist within the loop itself.
    If loop=="1"
    assign/Edit_Val={original value here}
    Endif
    If loop=="2"
    assign/Edit_Val={change val}
    Endif

    Now you can have the same feature in your loop use 2 different values.
  • You will need to control it with a variable. This if grouping will exist within the loop itself.
    If loop=="1"
    assign/Edit_Val={original value here}
    Endif
    If loop=="2"
    assign/Edit_Val={change val}
    Endif


    So lets say somewhere in my program I have a linear open scan. After the loop is completed and both parts have been measured I say I want to edit ONLY the scan on that first part. Would I be able to do that using your method?
  • Once you complete the loop run, the scan data will only represent the last measured unit. It doesn't store the part1 data for you to manipulate after.

    I would recommend 2 separate scans, you can control which one runs using the if style I previously shared.
  • Once you complete the loop run, the scan data will only represent the last measured unit. It doesn't store the part1 data for you to manipulate after.

    I would recommend 2 separate scans, you can control which one runs using the if style I previously shared.


    Thank you for your help, if statements controlling which scan runs worked out great. Now I'm onto the next problem.

    Let's say I want to be able to rerun one of these scans on part number 1. When I execute that block, despite whatever my loop counter is, it will always run the scan on the latest part in the loop. I understand this is because the loop has updated the alignment with an offset to the next part, so even if I tell PCdmis to run the first scan it has no "part number 1 alignment" to return to.

    Any thoughts on how I might approach this?

    Really appreciate the assist, we're making progress!
  • If you want independent ability to rerun aspects of your program file, it may make more sense to have individual sections of code.
    However, if you want to be able to rerun segments for part1 vs part2, you may need to look into flow control (IF_GOTO/labels). The problem you may face is that you will not rerun the scan to the identical datum pick up 1 run to the next, it should be a small amount of deviation, but it will be deviation none the less.
  • If you want independent ability to rerun aspects of your program file, it may make more sense to have individual sections of code.
    However, if you want to be able to rerun segments for part1 vs part2, you may need to look into flow control (IF_GOTO/labels). The problem you may face is that you will not rerun the scan to the identical datum pick up 1 run to the next, it should be a small amount of deviation, but it will be deviation none the less.


    Ok let me try to understand this. You say it may make more sense to have individual sections of code, do you mean actually duplicating the code for a part in the same program might be better for this? My first thought when starting to loop was "paste with pattern the entire thing" but I've always been told copying code was bad practice in software development so I figured I shouldn't.


    Would IF_GOTO/lables remedy the alignment having been overwritten/offset from the first part to the second? Just trying to wrap my head around the solution.

    Thanks.


  • Paste w/ Pattern is a built-in feature with PC-DMIS, so that is not a bad practice. Just be sure to have an indexable value at the end of every feature you are copy/pasting to prevent archaic naming from occurring to your freshly pasted features. (I add '_1' to every feature/alignment I plan to use paste w/ pattern on, if reporting/constructing features later in the program, it is now very easy to find which points go together to build/report)

    I suppose in rereading this, you could potentially store the alignment for part1 as an 'external' alignment, then save part2 as another 'external' alignment, using the flow control (IF/ENDIF) you can manage which alignment should be used and recall them explicitly. I believe this would enable you to remeasure a scan, but it would cause a restructure of your current program.

    Loop processes do not lend themselves to be helpful when you need to rerun a specific feature for anything other than the last unit.

    IF_GOTO/lables can enable you to jump through your program isolating only the data you need to remeasure. This could be something to speed up your over-checks, but it takes a great deal of forethought and architecture in your program.

  • Paste w/ Pattern is a built-in feature with PC-DMIS, so that is not a bad practice. Just be sure to have an indexable value at the end of every feature you are copy/pasting to prevent archaic naming from occurring to your freshly pasted features. (I add '_1' to every feature/alignment I plan to use paste w/ pattern on, if reporting/constructing features later in the program, it is now very easy to find which points go together to build/report)

    I suppose in rereading this, you could potentially store the alignment for part1 as an 'external' alignment, then save part2 as another 'external' alignment, using the flow control (IF/ENDIF) you can manage which alignment should be used and recall them explicitly. I believe this would enable you to remeasure a scan, but it would cause a restructure of your current program.

    Loop processes do not lend themselves to be helpful when you need to rerun a specific feature for anything other than the last unit.

    IF_GOTO/lables can enable you to jump through your program isolating only the data you need to remeasure. This could be something to speed up your over-checks, but it takes a great deal of forethought and architecture in your program.



    Alright I think I understand. We're currently trying to decide if it would be worth it to pay for the Inspect 5.1 pallet function. Our parts are really complex with a lot of small features and scans, so we end up with a lot of alignment steps to really drill down to where we need to be. It's really a necessity that certain features be able to be remeasured after a loop has been completed. Maybe a bunch of external alignments might save me here.

    Thank you for your help. I have some stuff to try yet so I might be back here with another batch of questions tomorrow.
  • Paste w/ Pattern is a built-in feature with PC-DMIS, so that is not a bad practice. Just be sure to have an indexable value at the end of every feature you are copy/pasting to prevent archaic naming from occurring to your freshly pasted features. (I add '_1' to every feature/alignment I plan to use paste w/ pattern on, if reporting/constructing features later in the program, it is now very easy to find which points go together to build/report)

    I suppose in rereading this, you could potentially store the alignment for part1 as an 'external' alignment, then save part2 as another 'external' alignment, using the flow control (IF/ENDIF) you can manage which alignment should be used and recall them explicitly. I believe this would enable you to remeasure a scan, but it would cause a restructure of your current program.

    Loop processes do not lend themselves to be helpful when you need to rerun a specific feature for anything other than the last unit.

    IF_GOTO/lables can enable you to jump through your program isolating only the data you need to remeasure. This could be something to speed up your over-checks, but it takes a great deal of forethought and architecture in your program.




    We found a way to be able to rerun individual features/scans! Basically we ended up using the if statement you recommended and created a bespoke alignment using generic features and recalling an alignment outside the loop. (That way the next iteration in the loop doesn't affect it when it remakes the basic alignments) Then we return to the previous alignment before exiting the if statement. It's a little bit of a workaround but it gives us the result we wanted and is far less code than using paste with pattern on 3500 lines of code. lol

    Just coming back to say thank you for your help!