hexagon logo

Subroutine Circle Construction Errors

I created a main program to run 3 subroutines. I am constructing circles using 2 auto circles, then construct a scan, then update the scan to hits cir1.hit[1..cir1.numhits],cir2.hit[1..cir2.numhits] method. Finally constructing a circle out of the scan and dimension. The problem is the construction is failing when I run my main program. It works fine when I run the sub routine as a stand alone program but it gives me an construction error when I run this through main program as a subroutine.

CIR1 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<0,0,-0.6>,<0,0,1>,2.42
ACTL/<0,0,-0.6>,<0,0,1>,2.42
TARG/<0,0,-0.6>,<0,0,1>
START ANG=22.6607,END ANG=67.3393
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=YES
NUMHITS=5,DEPTH=0,PITCH=0
SAMPLE METHOD=SAMPLE_HITS
SAMPLE HITS=0,SPACER=0
AVOIDANCE MOVE=NO,DISTANCE=0.2
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOW HITS=NO

CIR2 =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
THEO/<0,0,-0.6>,<0,0,1>,2.42
ACTL/<0,0,-0.6>,<0,0,1>,2.42
TARG/<0,0,-0.6>,<0,0,1>
START ANG=202.6607,END ANG=247.3393
ANGLE VEC=<1,0,0>
DIRECTION=CCW
SHOW FEATURE PARAMETERS=NO
SHOW CONTACT PARAMETERS=YES
NUMHITS=6,DEPTH=0,PITCH=0
SAMPLE METHOD=SAMPLE_HITS
SAMPLE HITS=0,SPACER=0
AVOIDANCE MOVE=NO,DISTANCE=0.2
FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
SHOW HITS=NO

SCN1 =FEAT/SET,CARTESIAN
THEO/<-0.0763,-0.0763,-0.6>,<0,0,1>
ACTL/<-0.0763,-0.0763,-0.6>,<0,0,1>
CONSTR/SET,BASIC,CIR1.HIT[1..CIR1.NUMHITS],CIR2.HIT[1..CIR2.NUMHITS],,

2420_ID_CIR=FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
THEO/<0,0,-0.6>,<0,0,1>,2.42
ACTL/<0,0,-0.6>,<0,0,1>,2.42
CONSTR/CIRCLE,BF,3D,SCN1,,
OUTLIER_REMOVAL/OFF,3​


  • I did a test where I used the "to points" method and then constructed a circle from all the points and it worked. I like using auto circles because I can then adjust the number of points and the spread is always even BUT I guess I just need to do whatever works. Unless someone has something that I can try?
  • Hello,

    this works for me =

    * 1
    I made the construct circle from 2D and selected the correct working plane.
    Maybe your working plane is wrong, i cant see it in your post.

    C1         =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<-154.214,0,-159.693>,<0,-1,0>,17.5
                ACTL/<-154.214,0,-159.693>,<0,-1,0>,17.5
                TARG/<-154.214,0,-159.693>,<0,-1,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO
    C2         =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<-154.214,18.5,-159.693>,<0,1,0>,17.5
                ACTL/<-154.214,18.5,-159.693>,<0,1,0>,17.5
                TARG/<-154.214,18.5,-159.693>,<0,1,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<-1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO
    
    SCN1       =FEAT/SET,CARTESIAN
                THEO/<-154.214,9.25,-159.693>,<0,0,1>
                ACTL/<-154.214,9.25,-159.693>,<0,0,1>
                CONSTR/SET,BASIC,C1.HIT[..],C2.HIT[..],,
    
    C3         =FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
                THEO/<-154.214,9.25,-159.693>,<0,-1,0>,17.5
                ACTL/<-154.214,9.25,-159.693>,<0,-1,0>,17.5
                CONSTR/CIRCLE,BF,2D,SCN1,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,UPR=0​
    



    * 2
    By the way, you can enter the points directly into the circle, the detour via "SCN" is not necessary
    C4         =FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
                THEO/<-154.214,9.25,-159.693>,<0,-1,0>,17.5
                ACTL/<-154.214,9.25,-159.693>,<0,-1,0>,17.5
                CONSTR/CIRCLE,BF,2D,C1.HIT[..],C2.HIT[..],,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,UPR=0​
    



    * 3
    which version do you have? Is it perhaps possible that in your version a circle input from a feature set is not allowed?
  • In this case, I would try:
    ASSIGN/V1="CIR1.HIT[1..CIR1.NUMHITS]"
    ASSIGN/V2="CIR2.HIT[1..CIR2.NUMHITS]"
    2420_ID_CIR=FEAT/CIRCLE,CARTESIAN,IN,LEAST_SQR,NO
    THEO/<0,0,-0.6>,<0,0,1>,2.42
    ACTL/<0,0,-0.6>,<0,0,1>,2.42
    CONSTR/CIRCLE,BF,3D,V1,V2,,
    OUTLIER_REMOVAL/OFF,3​

  • I changed the circle to 3D to see if it made a difference and it didn't. Using 2019. I'll try yours and 's methods.
  • I can't get either method to work. Did you try to run this as a subroutine? My method works as a stand alone program but when I convert that into a subroutine and run it through my main pcdmis program, that is when all my circle constructions fail.
  • Have you tried with a generic feature instead of a constructed circle? I ran into that error the other day (without using subroutines) and was able to get around it with a generic circle.
  • You can't just use points or elements from a subroutine.

    Either you construct the circle directly in the subroutine or you pass the element as a variable.
    I personally haven't tried the second one and so I don't know exactly how to do it at the moment.
  • Might be some subroutine referencing issue. Post your code as it is in subroutines, I believe the code you shared above is 'standalone'. There are ways you can test/debug this to narrow the issue down.
  • This is what is strange. I actually have 3 sets of 2 auto circles that are constructed into circles using create scan and cirx.hit[1...cirx.numhits], etc... Those give me the errors. I have 2 more sets of circles that use 4 auto circles using the same method and they work just fine.

    For now I ended up re creating my problem circles using the to points method, construct circles out of the points and they work in my subroutine.