Question About LocPinX, LocPinY

Started by david, October 07, 2008, 09:11:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

david

I wrote a code using LocPinX, LocPinY assuming that LocPinX="Width*something" and LocPinY="Height*something".

But unfortunatelly it's not always like that and therefore my code doesn't always work...
in some cases LocPinX and LocPinY get an actual number (in the ShapeSheet).  i don't want the actual numbers.  i don't even understand what the actual numbers mean.  i don't understand from the actual numbers where the anchor point is located inside (or outside) the shape.

Any way i can make them get "Width*something" or "Height*something" at any time? (and never to get actual numbers)

And if not, can you explain to me what the actual numbers mean?

thanks in advance
David


Paul Herber

#1
PinX and PinY are the coordinates on the shape on the page.

LocPinX and Y are where on the shape PinX and PinY refer, usually the middle or the lower left corner of the shape.
So, if the shape is located at (2,2) on the page and the shape's LocPinX and Y are set to Width/2 and Height/2 then it's the middle of the shape that will be located at (2.2).

However, the LocPinX/Y can be a value (each in one of many units) or a formula, not always based on width or height. So, as far as this is concerned you cannot guarantee what you get.

Except, you can guarantee to get numbers. I'll guess that you are using the Get_formula method or similar at the moment, if instead you use the .Result[] method with whatever units you are using then you will always get a numeric result (call this A). If you do similar for the Width (call this B) then you can build your own formula in a string as "Width * A/B" inserting values as required.


Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Visio Guy

Hi David,

What are you trying to do--from a higher level?
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

i have a polygon shape and i need to calculate its vertexes coordinates.  if i find the polygon's center then it's easy to find all its coordinates.  but in order to find its center i need to know where exactly pinX and pinY are located in the polygon.
in my code i really found the center, but i assumed that locPinX="Width*something" and locPinY="Height*something".  i didn't know that these variables can get actual values sometimes.  anyway i fixed my code and now it's relating to the locPinX, locPinY VALUES so these variables can have either a formula or value, the code will work in both cases.

but just for general knowledge, why in some cases they get formulas and in other they get actual values?  it's really strange. sometimes they get actual values and when i move the shape they suddenly get formulas.  shouldn't they get homogeneus values?

novski

#4
Stumbled over this topic and wold want to know the same... Can somebody explain that further?

Visio Guy

Hmm, I wonder if he was missing the fact that you can display values or formulas in the ShapeSheet? At any rate, there are various ways to set cells in Visio,

Formulas:

shp.Cells("LocPinY").Formula = "Width*0.5"
shp.Cells("LocPinY").Formula = "3mm"

Values

shp.Cells("LocPinY").ResultIU = 3 /25.4
shp.Cells("LocPinY").Result(mm) = 3


There is also FormulaU, FormulaForce, FormulaForceU, ResultForceIU, ResultForce, and probably a few more.

By the way, "IU" means "Internal Units", which means inches in Visio.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

novski

Didn't miss that Values can be displayed... think i get it now. I already stumdled over the poor choice of "IU" but didn't known for shure that it was inches until now... Thank you.