Discussion:
Shapesheet Geometry Section: Getting Number of the current Section
Udo Weik
2006-07-07 17:04:18 UTC
Hello,

is it possible to determine the number of a Geometry Section
in that Geometry Section itself, e. g. Geometry 1 should result
in 1, Geometry 2 in 2 and so on. I must calculate offsets which
are just depending from the number of the Geometry Section.

Udo
JuneTheSecond
2006-07-09 21:50:01 UTC
You might get the numger of geometry sections by counting the Cells of NoFill.
Sub test()
Dim shp As Visio.Shape
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String

Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
strFormulaNoFill = shp.CellsSRC(visSectionFirstComponent + I, 0,
0).Formula
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
JuneTheSecond
2006-07-09 21:57:01 UTC
Or more completely,
Sub test()
Dim shp As Visio.Shape
Dim myCell As Visio.Cell
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String

Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
Set myCell = shp.CellsSRC(visSectionFirstComponent + I, 0, 0)
strFormulaNoFill = myCell.Formula
If myCell.Name Like "*NoFill" Then
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Post by JuneTheSecond
You might get the numger of geometry sections by counting the Cells of NoFill.
Sub test()
Dim shp As Visio.Shape
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
strFormulaNoFill = shp.CellsSRC(visSectionFirstComponent + I, 0,
0).Formula
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
JuneTheSecond
2006-07-10 00:01:01 UTC
Or,
If myCell.Name Like "*NoFill" Then
should be replaced by
If myCell.Name Like "Geometry*" Then
--
JuneTheSecond
Post by JuneTheSecond
Or more completely,
Sub test()
Dim shp As Visio.Shape
Dim myCell As Visio.Cell
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
Set myCell = shp.CellsSRC(visSectionFirstComponent + I, 0, 0)
strFormulaNoFill = myCell.Formula
If myCell.Name Like "*NoFill" Then
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Post by JuneTheSecond
You might get the numger of geometry sections by counting the Cells of NoFill.
Sub test()
Dim shp As Visio.Shape
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
strFormulaNoFill = shp.CellsSRC(visSectionFirstComponent + I, 0,
0).Formula
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Mark Nelson [MS]
2006-07-10 03:43:39 UTC
Assuming you want to do this programmatically, you can get the number of the
geometry section just by doing Section.Index - visSectionFirstComponent + 1.

If you want to do this from the Shapesheet directly, I don't know of a
solution.
--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by JuneTheSecond
Or,
If myCell.Name Like "*NoFill" Then
should be replaced by
If myCell.Name Like "Geometry*" Then
--
JuneTheSecond
Post by JuneTheSecond
Or more completely,
Sub test()
Dim shp As Visio.Shape
Dim myCell As Visio.Cell
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
Set myCell = shp.CellsSRC(visSectionFirstComponent + I, 0, 0)
strFormulaNoFill = myCell.Formula
If myCell.Name Like "*NoFill" Then
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Post by JuneTheSecond
You might get the numger of geometry sections by counting the Cells of NoFill.
Sub test()
Dim shp As Visio.Shape
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
strFormulaNoFill = shp.CellsSRC(visSectionFirstComponent + I, 0,
0).Formula
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
David Parker
2006-10-03 13:14:43 UTC
Actually you can:

Create a User-defined cell, say GeometryCount, and enter the following
formula:
=ABS(NOT(ISERR(INT(INDEX(0,"Geometry1.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry2.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry3.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry4.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry5.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry6.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry7.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry8.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry9.NoFill")))))+ABS(NOT(ISERR(INT(INDEX(0,"Geometry10.NoFill")))))

Since there can be 255(?) Geometry Sections, you an extend the above
formula, if you need to check for more than 10 sections.

Also, if you need it to evaluate periodically the add DEPENDSON(NOW())+
after the = sign.
Post by Mark Nelson [MS]
Assuming you want to do this programmatically, you can get the number of
the geometry section just by doing Section.Index -
visSectionFirstComponent + 1.
If you want to do this from the Shapesheet directly, I don't know of a
solution.
--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by JuneTheSecond
Or,
If myCell.Name Like "*NoFill" Then
should be replaced by
If myCell.Name Like "Geometry*" Then
--
JuneTheSecond
Post by JuneTheSecond
Or more completely,
Sub test()
Dim shp As Visio.Shape
Dim myCell As Visio.Cell
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
Set myCell = shp.CellsSRC(visSectionFirstComponent + I, 0, 0)
strFormulaNoFill = myCell.Formula
If myCell.Name Like "*NoFill" Then
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Post by JuneTheSecond
You might get the numger of geometry sections by counting the Cells of NoFill.
Sub test()
Dim shp As Visio.Shape
Dim I As Long, NumExistingGeoSec As Long
Dim strFormulaNoFill As String
Set shp = ActivePage.Shapes(1)
For I = 0 To visSectionLastComponent
strFormulaNoFill = shp.CellsSRC(visSectionFirstComponent + I, 0,
0).Formula
If strFormulaNoFill = "FALSE" Or strFormulaNoFill = "TRUE" Then
NumExistingGeoSec = I + 1
Else
Exit For
End If
Next
Debug.Print "Number of Geometry Section is " & NumExistingGeoSec
End Sub
--
JuneTheSecond
Udo Weik
2006-07-10 10:10:11 UTC
Hello JuneTheSecond and Mark,

my aim is to determine the number in the Shapesheet directly,
but I can use your hints using automation for another purpose,
too.

Udo
wr
2006-07-13 14:15:10 UTC
Hi Udo,

It depends what you want to do with your geometry cells.
I can imagine that you for instance increase the width in geometry1 and then
simultaneously want to increase the width in geometry2 but how to tell the
shape?

In the following scenario I change the width of the Geometry1.X1 cell and
then activate a Custom Property cell with the value.
And vice versa if you have a change in Geometry2.X1 you can set a value in
another Custom Property cell.

1. add two custom property cells one called Prop.Geo1 and one called
Prop.Geo2
2. create a User Defined cell and place the following formula in the Value
cell
=IF(Geometry2.X1=Width*0.2727,SETF(GetRef(Prop.Geo1),2),SETF(GetRef(Prop.Geo1),0))

So based on the width value (here 0.2727) you set the value of Geo2 to '2'
but when this value changes the custom property goes to '0'

If it is really handy? Don't know.
But you have a way to capture the geometry row number in the shapesheet

René
Post by Udo Weik
Hello,
is it possible to determine the number of a Geometry Section
in that Geometry Section itself, e. g. Geometry 1 should result
in 1, Geometry 2 in 2 and so on. I must calculate offsets which
are just depending from the number of the Geometry Section.