hexagon logo

Counting with Variable Bug

Working on a new program using Paste with Pattern. I am currently using CAD++ 2024.1 release.

The rotations are a bit unusual (31 in a 360° pattern or 11.6129° each), so I decided to use variables to keep track of the rotation angle and also to figure the closest tip angles to use. All was going well until I hit 17. The variables are not returning anything beyond that. Tried a couple different things including testing v2016 with the same results. No Windows (10) updates. Restarted computer. Will not give anything after the 17th increment. Even used default variables to count.

ASSIGN/ADD=ADD+1 repeats once it hit 17.    ASSIGN/COUNT=COUNT+RT repeats 197.4194 (17th increment)

ASSIGN/COUNT=0
ASSIGN/ADD=0
ASSIGN/RT=360/31
ASSIGN/ADD=ADD+1                  (returns 1)
ASSIGN/COUNT=COUNT+RT     (returns 11.6129)
ASSIGN/ADD=ADD+1                  (returns 2)
ASSIGN/COUNT=COUNT+RT     (returns 23.2258)
ASSIGN/ADD=ADD+1                  (returns 3)
ASSIGN/COUNT=COUNT+RT     (returns 34.8387)

...

ASSIGN/ADD=ADD+1                  (returns 16)
ASSIGN/COUNT=COUNT+RT     ( returns 185.8065)
ASSIGN/ADD=ADD+1                  (returns 17)
ASSIGN/COUNT=COUNT+RT     (returns 197.4194)
ASSIGN/ADD=ADD+1                  (returns 17)
ASSIGN/COUNT=COUNT+RT     (returns 197.4194)

Even simple variables only go to 17

ASSIGN/V1=0
ASSIGN/V1=V1+1 (returns 1)
ASSIGN/V1=V1+1(returns 2)

ASSIGN/V1=V1+1
ASSIGN/V1=V1+1
ASSIGN/V1=V1+1 (returns 15)
ASSIGN/V1=V1+1 (returns 16)
ASSIGN/V1=V1+1 (returns 17)
ASSIGN/V1=V1+1 (returns 17)
ASSIGN/V1=V1+1 (returns 17)

Did I miss something? Is this the max that's ever been allowed? Maybe a setting in editor needs checked on or off?

Parents
  •    Press F5 and check whether this setting has any impact on your angle calculations...

    Also, can you please post the complete code from the relevant section of your program?  Reading through your 1st comment, it doesn't make sense.

    ASSIGN/COUNT=0
    ASSIGN/ADD=0
    ASSIGN/RT=360/31
    ASSIGN/ADD=ADD+1                  (returns 1)
    ASSIGN/COUNT=COUNT+RT     (returns 11.6129)
    ASSIGN/ADD=ADD+1                  (returns 2)
    ASSIGN/COUNT=COUNT+RT     (returns 23.2258) 
    ASSIGN/ADD=ADD+1                  (returns 3)
    ASSIGN/COUNT=COUNT+RT     (returns 34.8387) 

    You do not appear to be using the ADD variable, should the assignment be ASSIGN/COUNT=RT*ADD maybe?

Reply
  •    Press F5 and check whether this setting has any impact on your angle calculations...

    Also, can you please post the complete code from the relevant section of your program?  Reading through your 1st comment, it doesn't make sense.

    ASSIGN/COUNT=0
    ASSIGN/ADD=0
    ASSIGN/RT=360/31
    ASSIGN/ADD=ADD+1                  (returns 1)
    ASSIGN/COUNT=COUNT+RT     (returns 11.6129)
    ASSIGN/ADD=ADD+1                  (returns 2)
    ASSIGN/COUNT=COUNT+RT     (returns 23.2258) 
    ASSIGN/ADD=ADD+1                  (returns 3)
    ASSIGN/COUNT=COUNT+RT     (returns 34.8387) 

    You do not appear to be using the ADD variable, should the assignment be ASSIGN/COUNT=RT*ADD maybe?

Children
  • My default is 0 to 360. Switched over to the 0 to ±180 with no difference.

    The code that I am showing really is just a quick sample that I put together to test whether or not I had made a mistake on my actual program. The ADD+1 is just to keep track of how many times before it just started repeating. Not using it for anything else.

    ADD=ADD+1 stops at 17

    RT=360/31 is the number of rotations I have in my original program. Once it hits the 17th time it just keeps repeating.

    Not an earth-shattering thing at this moment. Don't want it to be if I ever do need it. These are only being used as a calculator to help visualize rotations and tip angles. Here is my entire test program:

    STARTUP =ALIGNMENT/START,RECALL:USE_PART_SETUP,LIST=YES
    ALIGNMENT/END
    MODE/MANUAL
    MOVESPEED/ 65
    FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ;NOM,TOL,MEAS,DEV,OUTTOL, ,
    LOADPROBE/TOOL_F6
    TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
    ASSIGN/COUNT=0
    ASSIGN/ADD=0
    ASSIGN/RT=360/31
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/ADD=ADD+1
    ASSIGN/COUNT=COUNT+RT
    ASSIGN/V1=0
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1
    ASSIGN/V1=V1+1