ConnectionPointPlace not defined

A very basic question. But didn’t find the solution so far.

I am trying to connect in python two Rectangle shapes (to be generated in visio format).
I am using ConnectionPointPlace method but get the error - “name ‘ConnectionPointPlace’ is not defined”. What am I missing? (I imported all relevant stuff - from aspose.diagram import *)
Thanks!

@idole

It seems that you are encountering an issue with the ConnectionPointPlace not being recognized in your Python code. This is likely because ConnectionPointPlace is not directly defined in the aspose.diagram module for Python.

Instead, you should use the connect_shapes_via_connector method to connect two shapes. Here’s an example of how to do this:

from aspose.diagram import *

# Load your diagram
diagram = Diagram("path_to_your_diagram.vsdx")

# Define shape IDs for the rectangles and the connector
shapeIdRec = diagram.pages[0].shapes[0].id  # Replace with your actual shape ID
shapeIdStar = diagram.pages[0].shapes[1].id  # Replace with your actual shape ID
shapeIdConnector = diagram.pages[0].shapes[2].id  # Replace with your actual connector ID

# Connect the shapes using the CENTER connection point
diagram.pages[0].connect_shapes_via_connector(shapeIdRec, ConnectionPointPlace.CENTER, shapeIdStar, ConnectionPointPlace.CENTER, shapeIdConnector)

# Save the diagram
diagram.save("path_to_save_diagram.vsdx", SaveFileFormat.VSDX)

Make sure to replace the shape IDs with the actual IDs of the shapes you are working with. If you are using the Aspose.Diagram library for Python via .NET, the above method should work correctly. If you are using a different version, please refer to the official documentation for more details [1].

If you continue to face issues, please check the documentation or consider posting your question with more details about your setup.

Sources:
[1]: Aspose.Diagram for Python via .NET Documentation

I am using Aspose.Diagram library for Python via .NET.
I tried the code above, but got the same message (NameError: name ‘ConnectionPointPlace’ is not defined), so I guess I am still missing something…

@idole
Thanks for your inquiry.
Please add this sample code and check once again on your side:

from aspose.diagram import *
from aspose.diagram.manipulation import * //add this code

Thanks.

[quote=“philip.zhou, post:4, topic:294120”]
from aspose.diagram.manipulation import *
[/quote] That works. Thanks!!

@idole
Thanks for following the suggested workaround and good know that your issue is sorted out now.
Please feel free to contact us in case you have further comments or questions.