Learn how to Draw Triangle Diagram in Visio using Python
Created
May 2, 2025 09:27
-
-
Save aspose-com-gists/484de25d9c3ca0be0292bd556de9c22b to your computer and use it in GitHub Desktop.
Draw Triangle Diagram in Visio using Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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