[Resolved] Performing Pipes length analysis using Python Script

This topic contains 6 replies, has 2 voices, and was last updated by  enrico 1 year ago.

  • Author
    Posts
  • #2282274


    enrico
    Participant

    Hi!
    i’ve got a pipeline for which i would like to find the total pipe length using the AA_Analysis command through a python script. I’m having a problem passing the argument “Pipes length analysis” in the script.
    This is how i’m trying to do it currently:
    arg1 = “Pipes length analysis”
    rs.Command(‘_SelAll _-AA_Analysis {}’.format(arg1))

    The AA_Analysis command is executed and a window pops up prompting me to pick the attribute that i would like to evaluate. But i would like the script to select the attribute and deliver the output. Could you please help me with this?

    Thanks & regards,
    Reuben

  • #2282275


    SupportTeam
    Keymaster

    Hi,
    Right now the AA_Analysis does not have a full scripted mode, so doing it this ways might not be possible.

    Have you considered using AA_Report instead and read the lengths from the resulting csv?

    Best regards

    Matthieu Arnold

    • #2282276


      enrico
      Participant

      Hi Matthieu,

      thanks for the prompt reply!
      I’m currently using the AA_Report command along with custom attributes to obtain individual lengths for pipes,elbows & other components. I was just wondering if it was possible to directly obtain the pipe length totals using the script. If not, user intervention would be required to pick the attribute, which is also ok.

      Best Regards,
      Reuben

  • #2282277


    SupportTeam
    Keymaster

    Hi,
    Actually I forgot that one but there could be an even better solution, the command AA_GetValue is scriptable (-AA_GetValue)
    It should let you directly read the attribute.
    Best regards
    Matthieu Arnold

  • #2282278


    enrico
    Participant

    Hi Matthieu,

    thanks for the tip but unfortunately i wasn’t able to get it to work.
    arg1 = “Pipes length analysis”
    rs.Command(‘_SelAll _-AA_GetValue {}’.format(arg1))
    In this case, the space in the attribute name causes the problem.

    I also tried the following:
    rs.Command(‘_SelAll _-AA_GetValue rhinopiping:length)
    This only works when one selects 1 entity at a time.

    Was worth a try though! 🙂
    Do let me know if you have any other ideas.

    Thanks & regards,
    Reuben

    • #2282279


      SupportTeam
      Keymaster

      AA_GetValue won’t understand “Pipes length analysis“, it only read the attributes (Sort of the same thing as rhino’s GetUserText but compatible with rhinopiping custom attributes)

      Instead of using the command on every item with _SelAll, you should use a loop on every doc objects, where you select every item one at a time, use AA_GetValue on the item and store the result.

      Another thing, when you have parameters with spaces in rhino you need to add double-quotes at the start and end of string before calling the script runner. (Actually even as a rhino user, it’s the same if you want to set a user text with spaces from rhino command line)

      I hope this will help, I’ll be out of office until next week.

      Regards

      Matthieu

      • #2282281


        enrico
        Participant

        Hi Matthieu,

        thanks for the useful tips!I’ll try them out.
        Appreciate your support!

        Best Regards,
        Reuben

You must be logged in to reply to this topic.