Author Topic: How I get the Max value of X and Y with a variable Geometry vertices?  (Read 5782 times)

0 Members and 1 Guest are viewing this topic.

Gustavo

  • Jr. Member
  • **
  • Posts: 60
  • The ultimate inspiration is the deadline.
Hi all.

I have a master shape with a main shape with 2 sub-shapes. Sub-shapes have a geometry section, and the main shape has not.
Sub-shape 2 has a fixed width & height and position relative to subshape 1, and subshape 1 has a geometry which will be editable by the user in width&height and in number and position of geometry's vertex.
I want to obtain the max value of a subshape1 geometry.X and geometry.Y vertex, in order to have the main shape width and height value updated when the user change subshape 1 geometry in vertices number and values. I know it can be done by function

Code
Width = MAX(Subshape1!Geometry1.X1,Subshape1!Geometry1.X2,Subshape1!Geometry1.X..n)

But I don't know how to get the vertice's number, if it will be variable. Id like to do it with shapesheet only, if possible. Any help would be appreciated.

Best regards.

Surrogate

  • Hero Member
  • *****
  • Posts: 1630
    • ShapeSheet™ Knowledge Base
But I don't know how to get the vertice's number, if it will be variable.
You can use SEGMENTCOUNT function and get how many segments contain your shape.
Code
Quanity of vertex = Quanity of segments + 1

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4449
  • Ideas Visio-lized into solutions
After you have max values, then do catenated if statements to find the matching x- & y- values.  For example, if(geo1.x1=maxX, geo1.x1,if(geo1.x2=maxX, geo1.x2, if(........))))....))))

The problem is how many variables to put into both the Max() and if() statements.

Note, instead of long if statement, you could add a bunch of rows in, e.g., User section.  To wit,
User.r1:  if(geo1.x1=maxX, geo1.x1, User.r2
User.r2:  if(geo1.x2=maxX, geo1.x2, User.r3
Etc

Or something like that.  The idea is that a successful evaluation gives the identity of the point, and unsuccessful evaluation keeps going until a match is found.
Visio 2019 Pro