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 Reply
  • Straight out of the Settings Editor help file with a warning:

    MaxCalculateLearnDepth
    This entry lets you change the learn depth used when PC-DMIS recursively performs calculations. This is helpful if you have a measurement routine that contains many ASSIGN/VALUE = VALUE + 1 (or other similar recursive statements), and PC-DMIS crashes when trying to calculate such statements.

    In versions prior to 2009 MR1, this learn depth value was hard coded into the software, and it sometimes caused PC-DMIS to crash if PC-DMIS recursed too deeply.

    As with other factory-set parameters, you should only adjust the value for this entry when someone from Hexagon Technical Support directs you to do so.

    Neil Challinor - can this be a potential problem for me in the future?

Children
  • I think it would be more likely to cause problems if you set the number to low (like you saw with the default value of 15) - especially if you do these types of assignments regularly.  The only side effect I can think of when setting the number higher would be performance, but on a modern PC, it should be negligible.  Based on the settings editor help snippet you posted, this was originally a problem prior to 2009, PC hardware, operating systems and PC-DMIS have gotten considerably better in the 16+ years since then.

  • Hey Neil, this may be a bit off topic, but related to Variable assign statements. Is there any reliable way for when creating assignments to not encounter the line limit error and add a line feed from inside the assignment?

    Constructions do it automatically. Feature names exaggerated just to show example.

    Since assignments are hand typed, they do not get the luxury of being auto-generated by PC-DMIS. And if you do it from the Assignment Window the Assignment becomes blank/not visible after applying a very long statement. But still appears to be functioning. I see PC-DMIS uses ,$ for line breaks, but it seems we cannot use that ourselves for a line break.

  • Setting the value too high (depends on what is being done and PRG) could lead to crashes. I've seen it crash at 18 so 60 could be an issue at some future time.