Error report when using select command to get coordinates

XinXin Member Posts: 3

Hello there,

In script files, I tried to select a structure inside a structure group to get coordinate data for further setup.

This structure group is first created by using script.

When I try to use select command to select one structure inside this structure group, an error always shows:

" no objects matching that name were found."

However, all things are correctly named or typed. I don't know if it is a bug, or I didsomething wrong?


Thanks in advance and look forward to hearing from you!

Xin

Best Answer

Answers

  • XinXin Posts: 11Member

    If I run this select command separately in new lsf files or directly inside script prompt after previous script, this works again and structure can be selected.

    But I can do this script in this way, but it is annoying.

    I don't know if there is some commands to break the structure group? Then structure can be selected directly。


    Thanks!

  • gsungsun Posts: 1,376Ansys Employee

    From your description it is difficult to guess the cause without all the sub-structure. Usually, as long as you can write the name of the object with group name, it should work.

    Please check the sub-group name, its object name. Below is the structure group under another structure group, I can get the "rect" x position without any issue.



  • XinXin Posts: 11Member

    Hello, thank you so much for your help.

    In my model, there is only one structure group and there is no sub-structure. Others can be selected directly in" ::model::XXXXXX".

    And same as you described, direct run command in script prompt, nothing happen. However, if I click run button on top menu of script editor, everytime it will be stopped at same line, which is using select to get coordinates. If I select and run left script in editor, it works again.

    Xin

  • gsungsun Posts: 1,376Ansys Employee

    "everytime it will be stopped at same line, which is using select to get coordinates" from this description, it seems there is error inside the script file of the structure group. Please open it ,run "test".

    I broke the previous group and had only one structure group, run the script in "script editor" and it works well:

    Again, from your limited information provided, I can only give you suggestion above. Please check.

  • XinXin Posts: 11Member
    edited November 23

    Hi, thanks a lot. I attached my code below, if I use this code, it shows error. If I run like you, first build structure, then use select, everything is fine.

    switchtolayout;
    clc;
    
    deleteall;
    save("test");
    
    addstructuregroup;
    set("use relative coordinates",0);
    set("name","group");
    set("x",0);
    set("y",0);
    set("z",0);
    
    set('script','
    addrect;
    set("use relative coordinates",0);
    set("name","waveguide");
    set("x min",2e-6);
    set("x max",4e-6);
    set("y",0);
    set("y span",2e-6);
    set("z",0);
    set("z span",2e-6);
    ');
    
    ?getnamed("group::waveguide","x max");
    
  • XinXin Posts: 11Member
    edited November 23

    After error reports, then I tried to use this command inside script prompt,

    ?getnamed("group::waveguide","x max");
    

    It can read everything perfectly. Error only happens when I tried to get it in the same script.


Sign In or Register to comment.