create array based on vector range of a scan

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • create array based on vector range of a scan

    Hi all, I've got a closed scan that consists of mainly 8 arc-segments. I'm trying to extract 4 of the eight arc segments, which make a pattern in the scan. I can do it just fine with hit numbers, but the hit counts and vectors shift a bit between parts and runs, so i'm trying to make an assignment to extract an array, based upon an angle range of the vector points, to construct each circle (arc segment).

    I don't know if this is possible or not. anyone willing to give it a shot?
    Below Scan F34 is the example code. For the first array segment, I want the array to start as soon as I vector is < -0.89. Then once I vector is < -0.45, I want to stop the defined array segment.
    --I understand that this will likely need to be a 2d array analysis (sampling K vector as second array), but if we get it running 1d, I'm sure I can work it into 2d.

    something like this (maybe a while loop is required?)
    Assign/V1=if(array(f34.hit[1..f34.numhits].I > -0.89 AND f34.hit[1..f34.numhits].K < -0.46, add index# to newly defined array)
    i know this doesn't work properly, please consider it pseudocode to get the concept across.

    Here's some sample code for the scan:
    Code:
    F34        =FEAT/SCAN,LINEARCLOSE,NUMBER OF HITS=600,SHOW HITS=YES,SHOWALLPARAMS=NO
                MEAS/SCAN
                BASICSCAN/LINE,NUMBER OF HITS=600,SHOW HITS=YES,SHOWALLPARAMS=NO
               --Omitted points to truncate post---
                HIT/VECTOR,<-0.07751,0.39999,-0.18957>,<-0.9072013,-0.0043577,-0.4206743>,<-0.07751,0.39999,-0.18957>,T=0
                HIT/VECTOR,<-0.07948,0.39999,-0.18539>,<-0.9046261,-0.0043534,-0.4261838>,<-0.07948,0.39999,-0.18539>,T=0
                HIT/VECTOR,<-0.08149,0.39999,-0.18125>,<-0.8993904,-0.0043442,-0.4371247>,<-0.08149,0.39999,-0.18125>,T=0
                HIT/VECTOR,<-0.08358,0.39998,-0.17713>,<-0.8919115,-0.0043305,-0.4521893>,<-0.08358,0.39998,-0.17713>,T=0
                HIT/VECTOR,<-0.08574,0.39998,-0.17306>,<-0.8831919,-0.0043136,-0.4689921>,<-0.08574,0.39998,-0.17306>,T=0 <---Start arc 1
                HIT/VECTOR,<-0.08798,0.39997,-0.16903>,<-0.8735597,-0.0042938,-0.4866981>,<-0.08798,0.39997,-0.16903>,T=0
                HIT/VECTOR,<-0.09031,0.39997,-0.16505>,<-0.863718,-0.0042727,-0.5039573>,<-0.09031,0.39997,-0.16505>,T=0
                HIT/VECTOR,<-0.09271,0.39996,-0.16111>,<-0.8537315,-0.0042503,-0.5206961>,<-0.09271,0.39996,-0.16111>,T=0
                HIT/VECTOR,<-0.09519,0.39996,-0.15722>,<-0.8433996,-0.0042262,-0.5372701>,<-0.09519,0.39996,-0.15722>,T=0
                HIT/VECTOR,<-0.09774,0.39995,-0.15338>,<-0.8326828,-0.0042004,-0.5537344>,<-0.09774,0.39995,-0.15338>,T=0
                HIT/VECTOR,<-0.10037,0.39994,-0.14959>,<-0.8216439,-0.004173,-0.5699859>,<-0.10037,0.39994,-0.14959>,T=0
                HIT/VECTOR,<-0.10307,0.39994,-0.14585>,<-0.8103061,-0.0041439,-0.5859922>,<-0.10307,0.39994,-0.14585>,T=0
                HIT/VECTOR,<-0.10585,0.39993,-0.14217>,<-0.7986603,-0.0041134,-0.6017681>,<-0.10585,0.39993,-0.14217>,T=0
                HIT/VECTOR,<-0.10869,0.39992,-0.13854>,<-0.7867015,-0.0040812,-0.61732>,<-0.10869,0.39992,-0.13854>,T=0
                HIT/VECTOR,<-0.11161,0.39991,-0.13497>,<-0.7744382,-0.0040474,-0.6326366>,<-0.11161,0.39991,-0.13497>,T=0
                HIT/VECTOR,<-0.1146,0.39991,-0.13146>,<-0.7617778,-0.0040118,-0.647826>,<-0.1146,0.39991,-0.13146>,T=0
                HIT/VECTOR,<-0.11765,0.3999,-0.128>,<-0.7491295,-0.0039755,-0.6624117>,<-0.11765,0.3999,-0.128>,T=0
                HIT/VECTOR,<-0.12078,0.39989,-0.12461>,<-0.735885,-0.0039368,-0.6770951>,<-0.12078,0.39989,-0.12461>,T=0
                HIT/VECTOR,<-0.12397,0.39988,-0.12128>,<-0.7224608,-0.0038969,-0.6914009>,<-0.12397,0.39988,-0.12128>,T=0
                HIT/VECTOR,<-0.12722,0.39987,-0.11801>,<-0.7087589,-0.0038555,-0.7054403>,<-0.12722,0.39987,-0.11801>,T=0
                HIT/VECTOR,<-0.13054,0.39986,-0.1148>,<-0.6947833,-0.0038126,-0.719209>,<-0.13054,0.39986,-0.1148>,T=0
                HIT/VECTOR,<-0.13392,0.39985,-0.11167>,<-0.6805414,-0.0037683,-0.7327>,<-0.13392,0.39985,-0.11167>,T=0
                HIT/VECTOR,<-0.13736,0.39984,-0.10859>,<-0.6660364,-0.0037224,-0.74591>,<-0.13736,0.39984,-0.10859>,T=0
                HIT/VECTOR,<-0.14085,0.39982,-0.10559>,<-0.6512762,-0.0036752,-0.7588318>,<-0.14085,0.39982,-0.10559>,T=0
                HIT/VECTOR,<-0.14441,0.39981,-0.10266>,<-0.6362643,-0.0036265,-0.7714626>,<-0.14441,0.39981,-0.10266>,T=0
                HIT/VECTOR,<-0.14803,0.3998,-0.09979>,<-0.6210085,-0.0035765,-0.7837956>,<-0.14803,0.3998,-0.09979>,T=0
                HIT/VECTOR,<-0.1517,0.39979,-0.097>,<-0.6055129,-0.0035251,-0.7958277>,<-0.1517,0.39979,-0.097>,T=0
                HIT/VECTOR,<-0.15542,0.39978,-0.09428>,<-0.589785,-0.0034723,-0.8075529>,<-0.15542,0.39978,-0.09428>,T=0
                HIT/VECTOR,<-0.1592,0.39976,-0.09163>,<-0.5738294,-0.0034182,-0.8189677>,<-0.1592,0.39976,-0.09163>,T=0
                HIT/VECTOR,<-0.16303,0.39975,-0.08906>,<-0.5576535,-0.0033627,-0.830067>,<-0.16303,0.39975,-0.08906>,T=0
                HIT/VECTOR,<-0.1669,0.39974,-0.08656>,<-0.5412628,-0.003306,-0.840847>,<-0.1669,0.39974,-0.08656>,T=0
                HIT/VECTOR,<-0.17083,0.39972,-0.08414>,<-0.5246636,-0.003248,-0.8513034>,<-0.17083,0.39972,-0.08414>,T=0
                HIT/VECTOR,<-0.1748,0.39971,-0.0818>,<-0.5078631,-0.0031887,-0.8614319>,<-0.1748,0.39971,-0.0818>,T=0
                HIT/VECTOR,<-0.17882,0.39969,-0.07954>,<-0.4908663,-0.0031282,-0.8712293>,<-0.17882,0.39969,-0.07954>,T=0
                HIT/VECTOR,<-0.18288,0.39968,-0.07735>,<-0.4736814,-0.0030666,-0.8806909>,<-0.18288,0.39968,-0.07735>,T=0
                HIT/VECTOR,<-0.18699,0.39967,-0.07525>,<-0.4563129,-0.0030037,-0.8898143>,<-0.18699,0.39967,-0.07525>,T=0  <--End arc 1
               --Omitted points to truncate post---

  • #2
    You can try the "Construct CIRCLE from SCAN SEGMENT"
    AndersI
    SW support - Hexagon Metrology Nordic AB

    Comment


    • louisd
      louisd commented
      Editing a comment
      didn't even know that was a thing, thanks AndersI

  • #3
    Andersi's mention of circle from scan segment is a wonderful surprise that I've never had the joy of using. I'm kinda speechless to see such a great tool as part of the demon. I'm so used to workarounds.

    Comment


    • #4
      I would try some arrays, but I can't check if it works...
      ASSIGN/V1=F34.HIT[1..F34.NUMHITS].I+0.89 gives an array where all the positives values are >-0.89
      ASSIGN/V2=(V1+ABS(V1))/(V1+ABS(V1)) should give an array of 0 and 1 (1for all values >-0.89)
      ASSIGN/V3=F34.HIT[1..F34.NUMHITS].K+0.46
      ASSIGN/V4=(V3-ABS(V3))/(V3-ABS(V3))
      ASSIGN/V5=SUM(V2*V4) should give the max index of values
      ASSIGN/V6=MININDEX(V2*V4*F34.HIT[1..F34.NUMHITS].I) should give the first index
      ASSIGN/V7="F34.HIT["+V6+".."+V5+"]" should give the right hits
      Then, use V7 in a feature set.

      Comment


      • #5
        There are also the functions

        LINESEGMENTSTARTINDEX(ID, index, tol1, tol2)
        LINESEGMENTENDINDEX
        ARCSEGMENTSTARTINDEX
        ARCSEGMENTENDINDEX

        to specifically find the n:th LINE or ARC in a scan. These seem to be helpful when the absolute position of a segment is unknown. Quoting the Help...

        Originally posted by Help
        LINESEGMENTSTARTINDEX

        This returns the index number of the starting point of a specified line segment from a scan: LINESEGMENTSTARTINDEX(<ID>, <index>,<tol1>,<tol2>).

        <ID> - The first parameter is a string value of the ID of the scan on which this function pulls out the index number of the start point for the line segment. This can either be the ID in quotation marks or any expression that when coerced to type string ends up being the ID of a scan.

        <index> - The second parameter is the index number for the line segment from which you want to get the start point number. This is a one-based value. For example, the line segment index number would be 3 if you want the start point number for the third line in the scan.

        <tol1> - The third parameter is the general feature tolerance. It is a maximum form error used to break up the scan into lines and arcs.

        <tol2> - The fourth parameter is the refine tolerance. Generally, this tighter tolerance is used to drop points from either end of the feature until the form error of the segment is within this tolerance.

        There is an additional parameter that controls whether an identified line segment in a scan is acceptable. This can only be changed with the PC-DMIS Settings Editor. Any line segment of a length less than the value for the MinimumLineSegmentLengthInMM registry entry is rejected. The default value for this parameter is 2 mm.

        Once you have the Start and End indices for a line segment, you can use these points inside a constructed feature to construct a separate line feature. See "Example of a Line Feature Created from a Scan Segment" for an example.

        I haven't tried this before, but Wow! See below:

        arcsegemnt_code.PNG
        arcsegment_cad.PNG
        Last edited by AndersI; 05-03-2019, 06:01 AM.
        AndersI
        SW support - Hexagon Metrology Nordic AB

        Comment

        Related Topics

        Collapse

        Working...
        X