R
rdanielwells
Whenever a new shape is dropped onto the page, the id is added t
ShapeIDs (a sorted list) with EquipmentID as the key:
Code
-------------------
ShapeIDs.Add(oEquipment(x).EquipmentID, currentShape.ID)
DebugWrite("Added EquipmentID=" & oEquipment(x).EquipmentID & " shapeid=" & currentShape.ID
-------------------
After all equipment shapes have been added to the document, th
equipment is to be connected together. To get the ToShape an
FromShape, the following code is used:
Code
-------------------
currentShape = GetShapeItem(currentPage.Shapes, _
CInt(ShapeIDs.Item(Pigtails(X).End1ConnectedToPort.EquipmentID))
-------------------
Code
-------------------
Public Function GetShapeItem(ByVal theShapes As Shapes, _
ByVal ID As Object) As Shape
DebugWrite("GetShapeItem: ID.Type = " & ID.GetType.ToString)
DebugWrite("GetShapeItem theShapes.Count = " & theShapes.Count)
Dim returnValue As Shape
Try
returnValue = theShapes.Item(ID)
If returnValue Is Nothing Then
DebugWrite("GetShapeItem: returnValue is Nothing")
Else
DebugWrite("GetShapeItem: returnValue.id=" & _
returnValue.ID)
End If
Catch err As COMException
' Shape was not found. Ignore the error.
DebugWrite("GetShapeItem: " & err.Message)
End Try
Return returnValue
End Functio
-------------------
For simplicity's sake, in this case a pigtail is a set of tw
equipmentID's which are to be connected together. All pigtails onl
reference pieces of equipment that have already been dropped on th
page, however only two of the pieces of equipment (one pigtail) ar
found by the GetShapeItem function above.
Below is the sample debug output:
12/8/2005 4:04:00 PM :: Added EquipmentID=3209 shapeid=1
12/8/2005 4:04:00 PM :: Added EquipmentID=3210 shapeid=3
12/8/2005 4:04:00 PM :: Added EquipmentID=3211 shapeid=5
12/8/2005 4:04:00 PM :: Added EquipmentID=3516 shapeid=7
12/8/2005 4:04:00 PM :: Added EquipmentID=3517 shapeid=9
12/8/2005 4:04:00 PM :: Added EquipmentID=3684 shapeid=11
12/8/2005 4:04:00 PM :: Added EquipmentID=3689 shapeid=13
12/8/2005 4:04:00 PM :: Added EquipmentID=3691 shapeid=15
12/8/2005 4:04:00 PM :: Added EquipmentID=3694 shapeid=17
12/8/2005 4:04:01 PM :: Added EquipmentID=3695 shapeid=19
12/8/2005 4:04:01 PM :: Added EquipmentID=3703 shapeid=21
12/8/2005 4:04:01 PM :: Added EquipmentID=3709 shapeid=23
12/8/2005 4:04:01 PM :: Added EquipmentID=3712 shapeid=25
12/8/2005 4:04:01 PM :: Added EquipmentID=3713 shapeid=27
12/8/2005 4:04:01 PM :: Added EquipmentID=3714 shapeid=29
12/8/2005 4:04:01 PM :: Added EquipmentID=3724 shapeid=31
12/8/2005 4:04:01 PM :: Added EquipmentID=3728 shapeid=33
12/8/2005 4:04:01 PM :: Added EquipmentID=3732 shapeid=35
12/8/2005 4:04:01 PM :: Added EquipmentID=3734 shapeid=37
12/8/2005 4:04:01 PM :: Added EquipmentID=3737 shapeid=39
12/8/2005 4:04:01 PM :: Added EquipmentID=3738 shapeid=41
12/8/2005 4:04:01 PM :: Added EquipmentID=3739 shapeid=43
12/8/2005 4:04:01 PM :: Added EquipmentID=3741 shapeid=45
12/8/2005 4:04:01 PM :: Added EquipmentID=3747 shapeid=47
12/8/2005 4:04:01 PM :: Added EquipmentID=3753 shapeid=49
12/8/2005 4:04:01 PM :: shapeids.count=25
12/8/2005 4:04:01 PM :: pigtails.length = 9
12/8/2005 4:04:01 PM :: currentpage.shapes.count = 25
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3714, Got 29
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3734, Got 37
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3728, Got 33
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=5
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3210, Got 3
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end2 EquipmentID=3747, Got 47
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: To Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=5
_12/8/2005_4:04:01_PM_::_Looking_For_end1_EquipmentID=3210,__Got_3
12/8/2005_4:04:01_PM_::_GetShapeItem_theShapes.Count_=_25
12/8/2005_4:04:01_PM_::_GetShapeItem:_returnValue.id=49
12/8/2005_4:04:01_PM_::_Looking_For_end2_EquipmentID=3712,__Got_25
12/8/2005_4:04:01_PM_::_connectWithDynamicGlueAndConnector_Called_
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 26
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=9
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3211, Got 5
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 26
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end2 EquipmentID=3728, Got 33
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: To Shape is Nothing
I'm most interested in the "Invalid Sheet Identifier" error. I've
underlined the section that *kind of* works
Any help is greatly appreciated!
Dan
ShapeIDs (a sorted list) with EquipmentID as the key:
Code
-------------------
ShapeIDs.Add(oEquipment(x).EquipmentID, currentShape.ID)
DebugWrite("Added EquipmentID=" & oEquipment(x).EquipmentID & " shapeid=" & currentShape.ID
-------------------
After all equipment shapes have been added to the document, th
equipment is to be connected together. To get the ToShape an
FromShape, the following code is used:
Code
-------------------
currentShape = GetShapeItem(currentPage.Shapes, _
CInt(ShapeIDs.Item(Pigtails(X).End1ConnectedToPort.EquipmentID))
-------------------
Code
-------------------
Public Function GetShapeItem(ByVal theShapes As Shapes, _
ByVal ID As Object) As Shape
DebugWrite("GetShapeItem: ID.Type = " & ID.GetType.ToString)
DebugWrite("GetShapeItem theShapes.Count = " & theShapes.Count)
Dim returnValue As Shape
Try
returnValue = theShapes.Item(ID)
If returnValue Is Nothing Then
DebugWrite("GetShapeItem: returnValue is Nothing")
Else
DebugWrite("GetShapeItem: returnValue.id=" & _
returnValue.ID)
End If
Catch err As COMException
' Shape was not found. Ignore the error.
DebugWrite("GetShapeItem: " & err.Message)
End Try
Return returnValue
End Functio
-------------------
For simplicity's sake, in this case a pigtail is a set of tw
equipmentID's which are to be connected together. All pigtails onl
reference pieces of equipment that have already been dropped on th
page, however only two of the pieces of equipment (one pigtail) ar
found by the GetShapeItem function above.
Below is the sample debug output:
12/8/2005 4:04:00 PM :: Added EquipmentID=3209 shapeid=1
12/8/2005 4:04:00 PM :: Added EquipmentID=3210 shapeid=3
12/8/2005 4:04:00 PM :: Added EquipmentID=3211 shapeid=5
12/8/2005 4:04:00 PM :: Added EquipmentID=3516 shapeid=7
12/8/2005 4:04:00 PM :: Added EquipmentID=3517 shapeid=9
12/8/2005 4:04:00 PM :: Added EquipmentID=3684 shapeid=11
12/8/2005 4:04:00 PM :: Added EquipmentID=3689 shapeid=13
12/8/2005 4:04:00 PM :: Added EquipmentID=3691 shapeid=15
12/8/2005 4:04:00 PM :: Added EquipmentID=3694 shapeid=17
12/8/2005 4:04:01 PM :: Added EquipmentID=3695 shapeid=19
12/8/2005 4:04:01 PM :: Added EquipmentID=3703 shapeid=21
12/8/2005 4:04:01 PM :: Added EquipmentID=3709 shapeid=23
12/8/2005 4:04:01 PM :: Added EquipmentID=3712 shapeid=25
12/8/2005 4:04:01 PM :: Added EquipmentID=3713 shapeid=27
12/8/2005 4:04:01 PM :: Added EquipmentID=3714 shapeid=29
12/8/2005 4:04:01 PM :: Added EquipmentID=3724 shapeid=31
12/8/2005 4:04:01 PM :: Added EquipmentID=3728 shapeid=33
12/8/2005 4:04:01 PM :: Added EquipmentID=3732 shapeid=35
12/8/2005 4:04:01 PM :: Added EquipmentID=3734 shapeid=37
12/8/2005 4:04:01 PM :: Added EquipmentID=3737 shapeid=39
12/8/2005 4:04:01 PM :: Added EquipmentID=3738 shapeid=41
12/8/2005 4:04:01 PM :: Added EquipmentID=3739 shapeid=43
12/8/2005 4:04:01 PM :: Added EquipmentID=3741 shapeid=45
12/8/2005 4:04:01 PM :: Added EquipmentID=3747 shapeid=47
12/8/2005 4:04:01 PM :: Added EquipmentID=3753 shapeid=49
12/8/2005 4:04:01 PM :: shapeids.count=25
12/8/2005 4:04:01 PM :: pigtails.length = 9
12/8/2005 4:04:01 PM :: currentpage.shapes.count = 25
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3714, Got 29
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3734, Got 37
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3732, Got 35
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3728, Got 33
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: From Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=5
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3210, Got 3
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end2 EquipmentID=3747, Got 47
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: To Shape is Nothing
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 25
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=5
_12/8/2005_4:04:01_PM_::_Looking_For_end1_EquipmentID=3210,__Got_3
12/8/2005_4:04:01_PM_::_GetShapeItem_theShapes.Count_=_25
12/8/2005_4:04:01_PM_::_GetShapeItem:_returnValue.id=49
12/8/2005_4:04:01_PM_::_Looking_For_end2_EquipmentID=3712,__Got_25
12/8/2005_4:04:01_PM_::_connectWithDynamicGlueAndConnector_Called_
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 26
12/8/2005 4:04:01 PM :: GetShapeItem: returnValue.id=9
12/8/2005 4:04:01 PM :: Looking For end1 EquipmentID=3211, Got 5
12/8/2005 4:04:01 PM :: GetShapeItem theShapes.Count = 26
12/8/2005 4:04:01 PM :: GetShapeItem:
Invalid sheet identifier.
12/8/2005 4:04:01 PM :: Looking For end2 EquipmentID=3728, Got 33
12/8/2005 4:04:01 PM :: ConnectEquipmentPorts: To Shape is Nothing
I'm most interested in the "Invalid Sheet Identifier" error. I've
underlined the section that *kind of* works
Any help is greatly appreciated!
Dan