Creating Multiple Ports Evenly Spacing


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

The NRotatedBoundsPort is always anchored to a location, that is relative to the actual shape bounds. This location is specified with X and Y factors of the actual shape bounds. So if you have N ports to place on a shape side, you need to create the ports with step 100 / N+1. (50, 50) is the center of the shape, so the formula for the left side ports is: X=-50, Y=-50 + (I * (100 / N+1)), where N is the number of ports to evenly space on the side and I is the 1 based index of the port to place. If you have two ports their Y percent factors become:

1. -50 + (1 * (100 / (2+1)) = -50 + 33;
1. -50 + (2 * (100 / (2+1)) = -50 + 66;



Best Regards,
Nevron Support Team


Volvick Derose
Volvick Derose
Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)
Group: Forum Members
Posts: 71, Visits: 1
If you have some sample code that can help me with this process, can you please post it. I try to create a shape with multiple ports to the left and multiple ports to the right. I don't have any problem doing that as you can see. The problem I have if if the number of ports to the left and right are not equal. Users will need to specify the number of port to the right or left.

for instance if right = 4 and left = 4, no problem, but if right is 4 and left is 2, the 2 ports to the left are not spacing center (or even space) to the shape

see the picture for instance one of them is good, but in the next 2, the ports are not centered or align properly.

You may have already done something like that, so provide a sample code will be nice
Attachments
nevshape.png (143 views, 18.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search