Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Below is a demonstration of a To create a simple API request in Python using the PyPCAD API, do the following:

  1. Begin by importing Import the Python API and assigning it assign an alias 'api' for future reference.

    Code Block
    languagepy
    import PyPCAD.api as api 
  2. NextFor further use, create an Application Object for further utilization.

    Code Block
    languagepy
    app = api.PyPCAD()
  3. Utilize Use AddText() to include text on the ModelSpace. Use Apoint() to pinpoint the location on the ModelSpace where the text will be inserted, specifying the desired height (e. g.For example, 50).

    Code Block
    languagepy
    app.AddText("HELLO", api.Apoint(0, 0, 0), 50)
  4. Use ZoomExtents() to adjust the view to focus on the text within the ModelSpace.

    Code Block
    languagepy
    app.ZoomExtents()
  5. Save the Python file and execute .

  6. Run the program to observe view the outcome within the ModelSpace.

...