你好, 看起来你在 Visual Components 中使用 General Robot 编程时遇到了一个非常棘手的问题。 根据你的描述,这似乎是软件的一个已知行为:**Visual Components 会在你编辑程序时(即使仿真已停止)自动对代码进行某种预验证或语法检查**。当它遇到一个条件恒为 `True` 的 `WHILE` 循环(例如 `WHILE TRUE` 或 `WHILE 1`)时,它会尝试“模拟”执行循环,并在循环次数超过 1000 次时抛出错误,甚至导致软件崩溃。 --- ### **可能的原因** 1. **自动语法/逻辑检查**:VC 可能在后台尝试解析和验证机器人程序,以确保没有无限循环等逻辑错误。 2. **未完成的循环条件**:如果你在编辑时只写了 `WHILE` 但还没写完条件(例如 `WHILE` 后面直接跟了换行或空格),解析器可能会将其视为“恒真条件”。 3. **编辑器即时反馈**:某些 IDE 或编辑器会在输入时实时检查代码,VC 可能也采用了类似机制。 --- ### **临时解决方案** 1. **在外部编辑器中编写循环**: - 先在文本编辑器(如 Notepad++、VS Code)中写好完整的 `WHILE` 循环,确保条件正确且包含退出逻辑。 - 例如: ```plaintext WHILE counter < 10 counter = counter + 1 ENDWHILE ``` - 再将整段代码粘贴到 VC 的机器人程序中,避免在 VC 中直接编辑未完成的循环。 2. **使用条件变量**: - 在循环开始前,确保条件变量已初始化且为“假值”。例如: ```plaintext flag = 0 WHILE flag == 0 // 循环内容 ENDWHILE ``` 3. **禁用自动检查(如果可能)**: - 检查 VC 的设置中是否有“实时验证”或“自动语法检查”选项,尝试暂时关闭它。 4. **恢复程序访问权限**: - 如果程序已无法打开,可以尝试在 VC 中通过“文件”>“打开”从备份文件恢复,或手动编辑项目文件(`.xml` 或 `.vcpp`)删除有问题的循环代码。 --- ### **长期建议** - **向官方反馈**:将此问题报告给 Visual Components 技术支持,说明在**编辑模式**下触发循环错误的不合理性,建议他们区分“编辑时检查”和“运行时检查”。 - **使用版本控制**:频繁保存程序副本,避免因崩溃导致工作丢失。 希望这些方法能帮你解决问题!如果还有其他细节(例如循环的具体写法或 VC 版本),可以提供更多信息以便进一步分析。

Hi,

I’ve run into a really annoying problem with the General Robot programming language.

If I addeven a simple WHILE loopto a robot program —while the simulation is STOPPED— Visual Components immediately throws:

Error: While loop goes through over 1000 times

And in some cases itcrashes the entire software.
After this happens, I can’t even open or edit the robot program anymore because the same error pops up every time I click the program. The layout basically becomes unusable.

This happens even if:

  • The simulation is not running

  • The program is not started

  • The WHILE loop is empty or unfinished

It looks like VC starts executing/validating the robot program automatically the moment I add the WHILE loop, and if the condition is true, it instantly loops 1000+ times and kills itself.

My question:
有谁知道这个问题是否有修复方法或临时解决方案?或者有没有办法在编辑机器人程序时禁用自动执行/验证?目前我甚至无法完成编写一个正确的传感器循环,因为程序在完成之前就崩溃了。如果有什么技巧或我漏掉的设置,我将非常感激。谢谢。 **BAD** 2025年11月21日,凌晨1:21 **2** 嗨, 这听起来很奇怪,我无法重现这个问题(在VC 4.10 OLP中)。如果可以的话,你能提供你的模拟环境吗? **PyhiS** 2026年1月9日,下午12:13 **3** 你好, 你解决这个问题了吗?我使用的是OLP 4.9版本,与学院视频中使用的版本相同。我遇到了类似的情况。每当我尝试放置超过一个while循环时,就会出现错误: While循环超过1000次。 我尝试用变量限制循环,但每次在程序中添加第二个循环时,错误就会出现。 有什么建议吗?? **PyhiS** 2026年1月9日,下午12:13 **4**
Or is there a way todisable automatic execution / validationwhile editing a robot program?

Right now it’s impossible to build a proper sensor loop because the program crashes before I can even finish writing it.

Any tips or settings I’ve missed would be greatly appreciated.

Thanks.

Hy,
This sounds weird, I didn’t succeed in reproducing the problem (in VC 4.10 OLP), if so, can you provide your simulation environment?

Hello,

did you solve this? I´ve got OLP 4.9 version which is the same as is used in Academy videos. I´ve got similar kind of situation. When ever I try to put more than one while loops the error appears:While loop goes over 1000 times.I have tried to restrict the loops with variables but always when I put the second loop to the program, the error appears.

Any advices??

再提供一点信息。当我将第二个 while 循环放在第一个循环内部时,就会出现这个错误。我还尝试在第二个循环内部再放第三个循环,结果导致 VC 软件直接崩溃了。

Just gave up and coded the movements with python API:sweat_smile:

Could you provide an example simulation file where this happens?

I run this error when I was doing the Palletizing robot programming in Academy videos. Time in video is 12:50 when he creates three while loops. And also one is made before and the hole main program is inside this. In this attached file I made the second while loop and instantly the error appears. And if I now make one more and move it inside the previous one, the program crashes.

This also appears if I just add Generic Articulated Robot in blank project and then add three While-loops to its program

Palletizing robot programming.vcmx(400.5 KB)

.

感谢提供更多细节。这似乎是OLP产品的问题,因为非OLP版本并未出现此情况。

我会将此问题反馈给开发团队,希望能在未来版本中修复。