hexagon logo

How do you get data from a loop?

Hey everyone,

I'm still new and learning PC-DMIS. I want to learn more about looping and variables as I can see it being an important tool to make programming quicker.

So I have a round part and it has 12 tabs around it every 30 degrees. What I want is for it to loop around the part grabbing a point on the outer tab. After I want to construct a circle (best fit) and output the dia for my report.

How can I go about this?

So the code I have so far is this
V1         =LOOP/START,ID=YES,NUMBER=12,START=1,SKIP=,
              OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=30
OUTER-RAD-TAB_1  =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
              THEO/<0,-7.546,-0.15>,<0,-1,0>
              ACTL/<0,-7.546,-0.15>,<0,-1,0>
              TARG/<0,-7.546,-0.15>,<0,-1,0>
              SNAP=NO
              SHOW FEATURE PARAMETERS=NO
              SHOW CONTACT PARAMETERS=YES
                AVOIDANCE MOVE=NO,DISTANCE=0
              SHOW HITS=NO
            LOOP/END​
  • Look up offsetting alignments in a loop.
    There are a lot of ways to accomplish your goal.

    But if you are trying to construct a feature with the measured points, I would recommend paste w/ pattern over a loop.
    One input feature will not be enough to create your diameter. And I'm not sure that using the outer-rad-tab_1[1],[2]-[11],outer-rad-tab_1[12] will work in a circle construction.
  • So, Looping isn't enough to catch other points? I guess I'm a little confused on what looping would be used for in this situation. I'll give what you recommended a go.
  • You can construct the circle from "OUTER-RAD-TAB_1[1..12] " directly.
    The easiest way to do it is creating a feature set selecting "OUTER-RAD-TAB_1" in the list, then ad brackets with1..12 in the edit window, and then construct the circle.
    You can dirctly construct the circle, but the demon could say that you can't construct a circle from 1 point Disappointed...

    In addition, you shouldn't use "-" in the feature name, prefer "_".
  • Looping in PC-Dmis is tricky (coming from other softwares, or other types of programming in general it's difficult to let go of this concept but it's never straightforward) -and I'm not one to say because something is difficult it shouldn't be done.

    Looping programs (measuring multiple parts is okay) but whilst looping sections of a program as you are suggesting is possible, paste with pattern is the preferred method.

    The same is true for subroutines, it's the passing of data back and forth that's prohibitive.



  • stupid question but why shouldn't I use "-" in the feature name, but prefer "_"? new to programming in general.
  • pcdmis is a big calculator so it may see a "-" as outer minus rad minus tab and try to actually calculate something when its just a title. So its encouraged to use "_" in the place of spaces.