[Resolved] Python Script for Pipeline generation

Tagged: ,

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

  • Author
    Posts
  • #2282235


    enrico
    Participant

    Hi!
    I would like to build an in-house tool for automatic pipeline generation using guidelines created by the user. Idea is to number a given set of guidelines say 01 to 10. The script should then perform the following steps:
    (1) Start the ‘Create Pipeline’ Command
    (2) Use the mid-points of the lines 01 to 10 in sequence in order to create a pipeline
    (3) Size of the pipe must be specified by user

    Is it generally possible to do the above using a Python script?
    The problem i’m currently facing is the following:
    Once I start the ‘Create Pipeline’ command by means of the Python script, the user is prompted to pick the points for creation of the pipeline. I would like to replace this step of picking of the points by automatically specifying the mid-points of lines 01 to 10.

    Any help would be highly appreciated!

    Thanks!

  • #2282236


    SupportTeam
    Keymaster

    Hi,
    Here is an example of RhinoPiping scripting with Rhinoscript:
    -RP_CreatePipeline _NominalDiameter DN100 _Elbows TabulatedCurvature:VALLOUREC:3D 0,0,0 1500,0,0 1500,0,-800 3000,0,-800 3000,0,-1600 3000,2000,-1600 _Enter

    I don’t know about Python script but it should be nearly the same, I assume you woul’d have to call rhinoscriptsyntax.
    import rhinoscriptsyntax as rs

  • #2282237


    enrico
    Participant

    Thanks a lot for the tip! This is very helpful!
    One last question… The co-ordinates for the points of the pipeline.
    Do they need to be entered as values or can they also be entered as variables.
    I tried entering them as variables but they aren’t recognized.
    Is there something i’m missing?

    • #2282239


      SupportTeam
      Keymaster

      Hi, basically a rhinoscript is a string (a text) that will be sent in Rhino command line.
      If you want the values to be variables, you should buid the appropriate string beforehand.
      For exemple (in vbscript):

      dim x1,y1,z1, x2, y2, z2 'Variables for location
      dim MyScript 'Temporary variable where you'll store the script
      x1=0
      y1=20
      z1=30
      x2=1000
      y2=20
      z2=20
      MyScript = "-RP_CreatePipeline _NominalDiameter DN100 _Elbows TabulatedCurvature:VALLOUREC:3D " & x1 & "," & y1 & "," & z1 & " " & x2 & "," & y2 & "," & z2 & " _Enter"
      runscript MyScript
  • #2282240


    enrico
    Participant

    Got it! I will try and modify my Python Script to do something similar.
    Thanks so much!

You must be logged in to reply to this topic.