Free Support Forum - aspose.com

Diagram Undestanding

Hi,

I’m in the process of testing the Aspose Diagram for my work and I’m fighting with some concepts; When I defined shape to add to my page, I have 2 parameters pinX and pinY, this values (system.double) what unit are??
Regarding the text of the shape, I’m using the same code as the demo but I got a result different:

ShapeWithText.JPG (9.4 KB)

This is my code to create the shape:
ShapeCreation.JPG (28.5 KB)

I’m using Aspose Diagram 20.7.0.0.

Appreciated all help and directions.

@mmato

Would you kindly share your sample stencil and diagram file with us. We will test the scenario in our environment and address it accordingly.

The unit is inch,1 inch equals 72 points, and 96px at 96dpi.

Thanks for your replay;

My Stencil:
NetworkPeripherals.zip (156.6 KB)

MyFile:
Drawing1.zip (24.3 KB)

@mmato

We tested the scenario using following code snippet and were able to notice that text was not rendered correctly.

Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram();
Aspose.Diagram.Page page = diagram.Pages[0];

string masterName = "Bridge";
diagram.AddMaster(dataDir + "NetworkPeripherals.vssx", masterName);

int PageIndex = 0;
double width = 2, height = 2, pinX = 4.25, pinY = 4.5;
// Add a new rectangle shape
long rectangleId = diagram.AddShape(pinX, pinY, width, height, masterName, PageIndex);

// Set shape properties 
Aspose.Diagram.Shape rectangle = page.Shapes.GetShape(rectangleId);
rectangle.XForm.PinX.Value = 5;
rectangle.XForm.PinY.Value = 5;
rectangle.Type = Aspose.Diagram.TypeValue.Shape;
rectangle.Text.Value.Add(new Aspose.Diagram.Txt("Aspose Diagram"));
rectangle.TextStyle = diagram.StyleSheets[0];
rectangle.Line.LineColor.Value = "#ff0000";
rectangle.Line.LineWeight.Value = 0.03;
rectangle.Line.Rounding.Value = 0.1;
rectangle.Fill.FillBkgnd.Value = "#ff00ff";
rectangle.Fill.FillForegnd.Value = "#ebf8df";

diagram.Save(dataDir + "AddShapeText_out.vsdx", Aspose.Diagram.SaveFileFormat.VSDX);

It seems like the text is being added as per the Style Sheets in the Diagram. However, we need to investigate this scenario in details and for the purpose, we have logged an issue as DIAGRAMNET-51896 in our issue tracking system. We will investigate this scenario in details and keep you posted with the status of its resolution. Please spare us some time.

We are sorry for the inconvenience.

Thanks so much for the time invest in my case, appreciated.

@mmato

We have investigated the ticket and found that you should add following code snippet to display the text correctly:

rectangle.TextXForm.TxtWidth.Value = 1.2;
rectangle.TextXForm.TxtHeight.Value = 0.5;
rectangle.TextXForm.TxtLocPinX.Value = 0.6;
rectangle.TextXForm.TxtLocPinY.Value = 0.25;

Thanks, I’ll test that.