hexagon logo

How to declare an array in DMIS

I want to write a code to calculate the circle center of three points and radius among dozens points in order to find the radius which is closest to my target radius. First I have to assign the points' x, y, z into an array then calculate them by do loop. I followed the page's array code however it seems not the case :
https://docs.hexagonmi.com/pcdmis/2019.1/en/helpcenter/mergedProjects/core/26_expression_topics/Variable_Arrays.htm
Parents
  • Assigning hits in an array works like this :
    ASSIGN/V1=CIRC1.HIT[1..CIRC1.NUMHITS].XYZ

    If you're looking for a special radius, you have to calculate all the radii :
    ASSIGN/V2=SQRT(DOT(V1-CIRC1.XYZ,V1-CIRC1.XYZ))

    The three hits closest to the target value are :
    ASSIGN/V3=CIRC1.TR....................................... ..(theo radius of CIRC1 : your target value ?)
    ASSIGN/V4=ABS(V2-V3)......................................positive difference between all radii and target
    ASSIGN/V5=MININDICES(V4).............................sorting radii indices
    ASSIGN/V6="CIRC1.HIT["+V5[1]+"]"
    ASSIGN/V7="CIRC1.HIT["+V5[2]+"]"
    ASSIGN/V8="CIRC1.HIT["+V5[3]+"]"
    F1 =GENERIC/POINT,DEPENDENT,CARTESIAN,$
    NOM/XYZ,<V6.X,V6.Y,V6.Z>,$
    MEAS/XYZ,<V6.X,V6.Y,V6.Z>,$
    NOM/IJK,<V6.I,V6.J,V6.K>,$
    MEAS/IJK,<V6.I,V6.J,V6.K>
    F2 =GENERIC/POINT,DEPENDENT,CARTESIAN,$
    NOM/XYZ,<V7.X,V7.Y,V7.Z>,$
    MEAS/XYZ,<V7.X,V7.Y,V7.Z>,$
    NOM/IJK,<V7.I,V7.J,V7.K>,$
    MEAS/IJK,<V7.I,V7.J,V7.K>​
    ​​​​​​​F3 =GENERIC/POINT,DEPENDENT,CARTESIAN,$
    NOM/XYZ,<V8.X,V8.Y,V8.Z>,$
    MEAS/XYZ,<V8.X,V8.Y,V8.Z>,$
    NOM/IJK,<V8.I,V8.J,V8.K>,$
    MEAS/IJK,<V8.I,V8.J,V8.K>


    Then construct the circle with F1,F2,F3.​​
  • : this is not "code", this can be written directly in the edit window, or using insert/assignment.
    The toolbox of PC-DMIS is a great tool, I prefer using it as adding external scripts.
Reply Children
No Data