Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-gists/484de25d9c3ca0be0292bd556de9c22b to your computer and use it in GitHub Desktop.
Save aspose-com-gists/484de25d9c3ca0be0292bd556de9c22b to your computer and use it in GitHub Desktop.
Draw Triangle Diagram in Visio using Python
import aspose.diagram as visio
from aspose.pydrawing import PointF
# Create a new diagram
diagram = visio.Diagram()
# Define points using aspose.pydrawing.PointF
points = [
PointF(1.0, 1.0),
PointF(5.0, 1.0),
PointF(3.0, 4.464),
PointF(1.0, 1.0) # Close the triangle
]
# Draw the triangle as a polyline on the first page
diagram.pages[0].draw_polyline(
pin_x=1.0, # Center X
pin_y=1.0, # Center Y
width=2.0, # Width of the shape
height=2.0, # Height of the shape
points=points # List of [x, y] coordinates
)
# Save diagram
diagram.save("DrawTriangleInPage_out.vsdx", visio.SaveFileFormat.VSDX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment