hexagon logo

Does anyone know an easy way to project all the points in a group to a plane?

I have a group of points (a plane for example) and I want to project them all to a plane (simplest case == WORKPLANE). Is there some smart way to do it all at once (a.k.a. "the JEFMAN way") or is it only possible with a loop? I haven't found anything yet...

The object of this is to create a secondary tangent plane perpendicular to the primary by the following method:

- measure the secondary plane
- project all points up/down to the primary (WORKPLANE)
- construct a tangent plane from the original plane points + the projected points (guaranteed to be perpendicular to the primary as that is our projection direction)

As a follow-up question: How can I use an ARRAY variable in the same way as .HIT[...] in the construction of a tangent plane?
  • Try changing the F1, F2 and F3 points to (0,-1,0).
  • Already done. It doesn't matter as it is the wrong points that has been selected to create F1, F2, F3.
  • : I believe it's the problem of cross product, I will try tomorrow an if statement to give a result with the right sign.
    In a first time, you can try to change only
    ASSIGN/V2=CROSS(PL1.IJK,LN1.IJK)
    by
    ASSIGN/V2=CROSS(LN1.IJK,PL1.IJK)
    And I hope it will work...

    Or maybe change MAXINDICES by MININDICES...
  • , can you post the points coordinates, please ?
    I would like to play with Slight smile
  • I thought during the night...
    The projection is a good idea only when the angle is >90°.
    If the angle is less, the intersection line should give a better result.
    I will try to post a "enhanced" code quickly !
  • , can you post the points coordinates, please ?
    I would like to play with Slight smile


    Those are on front (YMINUS) of the Hexagon part, easier test case PNT2-PNT5 (just a slight angle of the plane, centroid Y=0, high point -1, tangent plane touching two points), harder (balancing on high point Y=-2, tangent plane touching just this point) when including PNT6.

    PNT2       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<38,0,-6>,<0,-1,0>
                ACTL/<38,-1,-6>,<0,-1,0>
                TARG/<38,-1,-6>,<0,-1,0>
    
    PNT3       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<38,0,-29>,<0,-1,0>
                ACTL/<38,1,-29>,<0,-1,0>
                TARG/<38,1,-29>,<0,-1,0>
    
    PNT4       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<180,0,-6>,<0,-1,0>
                ACTL/<180,-1,-6>,<0,-1,0>
                TARG/<180,-1,-6>,<0,-1,0>
    
    PNT5       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<180,0,-29>,<0,-1,0>
                ACTL/<180,1,-29>,<0,-1,0>
                TARG/<180,1,-29>,<0,-1,0>
    
    PNT6       =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<115,0,-17>,<0,-1,0>
                ACTL/<115,-2,-17>,<0,-1,0>
                TARG/<115,-2,-17>,<0,-1,0>
    
    


    but I think there's a problem with the IJK of the projected points, at least in my way of using PROJ to WORKPLANE as this will give the workplane IJK to the projected points, with the effect that my method also may calculate a tangent plane on the wrong side Angry...
  • : I tried with Your points, it seems to work...
    I just add an if statement on V2 direction, to ensure that the sign doesn't change.
    At the end, I change PL3 in Y+ just to check if there are 2 points at 0 en the others negatives.
    Hope this help...
    ​​​​​​​
    F1         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<38,0,-6>,$
                MEAS/XYZ,<38,-1,-6>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F2         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<38,0,-29>,$
                MEAS/XYZ,<38,1,-29>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F3         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<180,0,-6>,$
                MEAS/XYZ,<180,-1,-6>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F4         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<180,0,-29>,$
                MEAS/XYZ,<180,1,-29>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F5         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<115,0,-17>,$
                MEAS/XYZ,<115,-2,-17>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    PL1        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<110.2,0,-17.4>,<0,-1,0>
                ACTL/<110.2,-1.9535,-17.5351>,<0,-0.9962406,-0.0866296>
                CONSTR/PLANE,TANGENT,F1,F2,F3,F4,F5,,
                MATH_TYPE/CONSTRAINED_MINMAX,BFRE
    PL2        =FEAT/PLANE,CARTESIAN,TRIANGLE,NO
                THEO/<0,0,0>,<0,0,1>
                ACTL/<0,0,0>,<0,0,1>
                CONSTR/PLANE,ALIGN,WORKPLANE
    LN1        =FEAT/LINE,CARTESIAN,UNBOUNDED,NO
                THEO/<55.1,0,0>,<-1,0,0>
                ACTL/<55.1,-3.4783,0>,<-1,0,0>
                CONSTR/LINE,INTOF,PL1,PL2
                ASSIGN/V1=PL1.HIT[1..5].XYZ*MPOINT(1,1,0)
    [COLOR=#FF0000]ASSIGN/V2=CROSS(PL2.IJK,LN1.IJK)
                IF/DOT(V2.IJK,PL1.IJK)<0
                  ASSIGN/V2=-V2
                END_IF/[/COLOR]
                ASSIGN/V3=DOT(PL1.HIT[1..5].XYZ-LN1.XYZ,V2)
                ASSIGN/V4=MAXINDICES(V3)
                ASSIGN/V5=V4[1]
                ASSIGN/V6=V4[2]
                ASSIGN/V7=PL1.HIT[V5].XYZ*MPOINT(1,1,0)
    F6         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<PL1.HIT[V5].X,PL1.HIT[V5].Y,PL1.HIT[V5].Z>,$
                MEAS/XYZ,<PL1.HIT[V5].X,PL1.HIT[V5].Y,PL1.HIT[V5].Z>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F7         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<PL1.HIT[V6].X,PL1.HIT[V6].Y,PL1.HIT[V6].Z>,$
                MEAS/XYZ,<PL1.HIT[V6].X,PL1.HIT[V6].Y,PL1.HIT[V6].Z>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    F8         =GENERIC/POINT,DEPENDENT,CARTESIAN,$
                NOM/XYZ,<V7.X,V7.Y,V7.Z>,$
                MEAS/XYZ,<V7.X,V7.Y,V7.Z>,$
                NOM/IJK,<0,-1,0>,$
                MEAS/IJK,<0,-1,0>
    PL3        =FEAT/PLANE,CARTESIAN,OUTLINE,NO
                THEO/<132.6667,1,-19.3333>,<0,-1,0>
                ACTL/<89.3333,-1.6667,-7.6667>,<-0.0129859,-0.9999157,0>
                CONSTR/PLANE,BF,F6,F7,F8,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
                ASSIGN/V8=DOT(PL1.HIT[1..5].XYZ-PL3.XYZ,PL3.IJK)
    REF1       =ALIGNMENT/START,RECALL[emoticon:6D505171FAA4497C85C5CA27290C555D]ÉMARRAGE,LIST=YES
                  ALIGNMENT/LEVEL,YPLUS,PL3
                  ALIGNMENT/TRANS,YAXIS,PL3
                ALIGNMENT/END
    DIM LOC1= LOCATION OF POINT F1  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    Y       0.0000     0.0500     0.0500     0.0000     0.0000     0.0000 ----#----
    END OF DIMENSION LOC1
    DIM LOC2= LOCATION OF POINT F2  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    Y       0.0000     0.0500     0.0500    -1.9998    -1.9998     1.9498 <--------
    END OF DIMENSION LOC2
    DIM LOC3= LOCATION OF POINT F3  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    Y       0.0000     0.0500     0.0500    -1.8440    -1.8440     1.7940 <--------
    END OF DIMENSION LOC3
    DIM LOC4= LOCATION OF POINT F4  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    Y       0.0000     0.0500     0.0500    -3.8438    -3.8438     3.7938 <--------
    END OF DIMENSION LOC4
    DIM LOC5= LOCATION OF POINT F5  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    Y       0.0000     0.0500     0.0500     0.0000     0.0000     0.0000 ----#----
    END OF DIMENSION LOC5
  • just a few clarifications :

    ASSIGN/V1=PL1.HIT[1..5].XYZ*MPOINT(1,1,0) .............is the projection of PL1 hits on the plane PL2 (primary datum here, even if it's PL2 !)
    V2=CROSS(PL2.IJK,LN1.IJK) .........................................is a vector perp to PL2 and to LN1, so approximatly perp to PL1, but the direction is not fixed (depends on orientation of planes 1 & 2)
    IF/DOT(V2.IJK,PL1.IJK)<0
    ASSIGN/V2=-V2
    END_IF/............................................................................allows to fix the direction in the right side
    ASSIGN/V3=DOT(PL1.HIT[1..5].XYZ-LN1.XYZ,V2)........calculates the signed distances between hits and line along V2
    ASSIGN/V4=MAXINDICES(V3).......................................create an array of sorted numbers of distances from the higher to the smaller.

    In case 1, all the values of V3 are negatives, so the higher has the min absolute value.
    In the case 2, the max value is the biggest distance.
    In the case 1, another solution could be directly using the intersection as origin for B, it wouldn't be more wrong than the projection of hits...
    Just a thougth...
  • Nice work ! But...

    What happens if the surface is twisted, so the part in one end looks like case 1, but in the other looks like case 2?
  • Nice work ! But...

    What happens if the surface is twisted, so the part in one end looks like case 1, but in the other looks like case 2?


    Thanks, Anders, you're welcome !
    I would say that case 2 is the worst case, and include the 1, even if the surface is twisted.
    If you think about a square that you apply on the surface, it will be tangent on the "case 2" side before "case1" side.
    Depends on the number of hits, but If there's only one point on the case 2 and others in the case 1 (big twist here !), the MAXINDICES should do the job as well.