Profile Picture

Creating Multiple Ports Evenly Spacing

Posted By Volvick Derose 12 Years Ago
Author
Message
Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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
Posted 12 Years Ago
View Quick Profile
Forum Guru

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
Last Active: 12 Years Ago
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 (131 views, 18.00 KB)


Similar Topics


Reading This Topic