Need to draw a straight connector in between the shapes

Hi Team ,

I need to draw the straight connectors in between the shapes. Currently I am not able to draw the straight connectors rather than bending connectors.
Can you please suggest the solution ?

image.png (5.3 KB)

What I need is the straight connectors as shown below.

image.png (6.0 KB)

Thanks,
Kishan

@kishannavale

We have logged an investigation ticket as DIAGRAMJAVA-50818 in our issue tracking system for the sake of your requirements. We will look into its details and keep you posted with the status of its correction. Please spare us some time.

@kishannavale

Please try to use following in order to draw a straight connector:

shape.SetConnectorsType(ConnectorsTypeValue.StraightLines);

Hi @asad.ali

Thanks for sharing the solution . I am getting the below exception after adding the property.

Shape connector = new Shape();
connector.getLine().getLineWeight().setValue(0.01588);
connector.getLine().getLineColor().setValue(edge.getConnectorColour());
connector.getLine().getLinePattern().setValue(edge.getConnectorPattern());
connector.getLine().getLineCap().setValue(BOOL.TRUE);
//connector.setName(edge.getConnectorInfo());
connector.getLine().getEndArrow().setValue(edge.getArrowSize());
connector.getText().getValue().setWholeText(edge.getConnectorInfo());
// connector.getText().getValue().setWholeText(edge.getConnectorInfo());
connector.getXForm().getLocPinX().getUfe().setF("Width*1.5");
connector.getXForm().getLocPinY().getUfe().setF("Height*1.5");
**connector.setConnectorsType(ConnectorsTypeValue.STRAIGHT_LINES);**
connecter = pagetemplate.addShape(connector, connectorMaster);
Exception :
java.lang.NullPointerException: null
	at com.aspose.diagram.dv.c(Unknown Source)
	at com.aspose.diagram.Shape.setConnectorsType(Unknown Source)

Can you please assist more ?

Thanks,
Kishan

@kishannavale

Can you please share the complete sample code snippet that we can run and reproduce the issue in our environment? We will further proceed to assist you accordingly.

Greetings,
This is my first attempt at helping in the community but here goes. I AM using the “ConnectorsTypeValue.STRAIGHT_LINES” property successfully. Your syntax appears correct. In your import statement(s), use:

import com.aspose.diagram.*;

I am using aspose version 21.9.

One other thing. This may not be related to the problem you are experiencing, but In order for it to work, I had to add the connector to the page first (the line you have just below your bold line --not sure why that would be the case) but if I did not, I got the error:
Cannot invoke “com.aspose.diagram.Shape.getGeoms()” because the return value of “com.aspose.diagram.Shape.getMasterShape()” is null

@richardcromer

Thanks for sharing the information. It would definitely help the users who have similar requirements and facing similar issue.

@richardcromer Thanks for sharing the solution. I tried changing the aspose version , but still the issue remains same.

Krishan,
Make sure you have debug flag turned on in whatever ide or build system you are using. Unknown source may be replace with actual error.

@kishannavale

We have logged an investigation ticket as DIAGRAMJAVA-50839 in our issue tracking system to investigate the reasons behind above exception and will inform you as soon as we have some definite updates regarding ticket resolution. Please spare us some time.

We are sorry for the inconvenience.

@kishannavale
Please try the latest fix 21.11.1 We have fixed this issue in the fix.
aspose-diagram-21.11.1-java.zip (4.0 MB)

Thanks.

The issues you have found earlier (filed as DIAGRAMJAVA-50839) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou