Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
PLAXIS | SOILVISION
  • Product Communities
  • More
PLAXIS | SOILVISION
PLAXIS | SOILVISION Wiki Polycurves to Polygons in PLAXIS 2D using Python
    • Sign in
    • -Geotechnical Analysis Wiki
      • +Geotechnical SELECT Entitlements [GSE]
      • -PLAXIS
        • +Software and License - PLAXIS
        • +Documentation - PLAXIS
        • -API / Python scripting - PLAXIS
          • Access to Staged Construction settings using Python
          • Adding functionality to PLAXIS Calculation Manager: pre- and post-processing
          • Automatic line cross-section chart generation using Python
          • Automatically generated cross-sections of embankments
          • Changing the material colour using Python scripting
          • Combined plate results in one chart using Python
          • Create custom connection with selection API
          • Export and format plots from PLAXIS Output using Python
          • How to create a tunnel using Python
          • How to get a load - displacement curve using Scripting interface
          • How to install additional Python modules in PLAXIS
          • How to open and close a PLAXIS project with Python
          • How to retrieve results from PLAXIS Output by the node number
          • Identify Python commands from Plaxis command line
          • Material lists in PLAXIS – Python
          • Material Property changes for Python scripting
          • Output scripting example: create curve data
          • Output scripting example: get anchor force
          • Output scripting example: get heave of excavation bottom
          • Output scripting example: get maximum bending moment
          • Polycurves to Polygons in PLAXIS 2D using Python
          • Receive instant notifications for finished calculations on your phone
          • Remove invalid custom connections for PLAXIS 3D
          • Retrieve coordinates of a Polygon in PLAXIS 2D using Python
          • Retrieving soil layer info from boreholes using Python
          • Scripting reference and how to use it
          • Selection API for PLAXIS Input
          • Soil layer material assignment using Python
          • Tunnel advancement script for PLAXIS 3D
          • User defined Python script (3D): Extract displacements by coordinates
        • +Known issues - PLAXIS
        • +Models - PLAXIS
        • +Tips and Tricks
        • +Publications
        • +Videos - PLAXIS
      • +PLAXIS LE
      • +PLAXIS Monopile Designer
      • +SOILVISION
      • +Subscription Entitlement Service
    • +Working from home with PLAXIS
    • +Working from home with PLAXIS LE

     
     Questions about this article, topic, or product? Click here. 

    Polycurves to Polygons in PLAXIS 2D using Python

    Application PLAXIS 2D
    Version PLAXIS 2D 2018
    Date created 13 March 2019
    Date modified 25 May 2022

    With improvements made in PLAXIS 2D CONNECT Edition Version 22.01 [release notes], it is now possible to directly import closed polycurves as polygons, as demonstrated here: Import your Leapfrog Geological Model into PLAXIS 2D.
    The example demonstrated here is still useful to understand the data storage for Polycurves and Polygons.

    Sometimes you have polycurves in a PLAXIS 2D model (e.g. after importing a DXF file) that are just the outlines of the desired shape. But typically, the intention is to have polygons instead of these polycurves, so you can assign soil materials to these areas.

    Conditions

    This provided script will check for polycurves that can be made into polygons based on the following:

    • The polycurve consists of only lines, not arcs or other types
    • The polycurve is closed (i.e. same start and end coordinate)
    • The to-be-made-polygon does not yet exist

    The script offers the user the possibility to generate these polygons and optionally delete the original polycurves.

    Usage instructions for Python script

    To use this Python script:

    • Download the file (use Save As...);
    • copy the polycurve_to_polygon_2D.py file to this folder:
      <PLAXIS 2D installation folder>\pytools\input
      By default the installation folder for PLAXIS 2D is:
      C:\Program Files\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\
      For older versions, this is:
      C:\Program Files\Plaxis\Plaxis 2D\
    • Open a Plaxis file with some polycurves or import a .dxf file with polycurves
    • Make sure you are in Structures mode
    • In the Expert menu, go to Python > Run Python tool. Here you should see the name of Python file.
    • When selecting it, it will execute the script to change all qualifying polycurves into polygons.

    When you do not have access rights to add the script in this folder, alternatively, you can choose to use Expert menu > Run Python script > Open... to manually open and run the file.

    Version

    The script is tested with PLAXIS 2D 2018.00 and PLAXIS 2D 2019.00 with Python 3.4 using a simple DXF geometry file.


    Click here to play this video

    Downloads

    • PLAXIS 2D 2019: polycurve to polygon script [.py]

    See also

    Can I import a geometry in PLAXIS 2D?    [Tips and Tricks]


    2D Import tool for soil polygons and structural geometry    [Videos]


    Import your Leapfrog Geological Model into PLAXIS 2D    [Videos]

    • polycurve
    • python
    • import
    • DXF
    • py cookbook
    • polygon
    • Scripting
    • PLAXIS
    • Remote scripting
    • cookbook
    • python cookbook
    • PLAXIS 2D
    • pyapp
    • script
    • Share
    • History
    • More
    • Cancel
    • Micha van der Sloot Created by Bentley Colleague Micha van der Sloot
    • When: Wed, Dec 18 2019 9:33 AM
    • Micha van der Sloot Last revision by Bentley Colleague Micha van der Sloot
    • When: Wed, May 25 2022 7:43 AM
    • Revisions: 7
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies