EBDN - Community - Question & Answers

  Wednesday, 23 January 2019
  2 Replies
  1.4K Visits
0
Votes
Undo
I'm trying to create a drawing from stencils I have stored in a stencil under the Graphics Toolbox folder in EBase. The issue I am having is that the master shape is not being placed in the visio document if it is a grouped collection. I am not receiving any error and when I search for a tag I placed in the master, it is not being found. I am using a subroutine and function to perform this step and it works for any regular non-grouped shapes but not a master shape that uses a group.


Private Sub PlaceMaster(oStencil As ObjectItem, ShapeMaster As String, XPOS As Double, YPOS As Double, actSHT As Sheet)

Dim params() As AucExecuteSheetOperationRecord
Dim ErrBox


ReDim params(1 To 4)

params(1).qual = aucOpExecSheetDropSymbol 'Function Name
params(2).qual = aucArgExecSheetRef2Master 'Parameter for the shape to be dropped
params(2).Val = msGetSymbolFromName(oStencil, ShapeMaster) 'Define shape to drop

params(3).qual = aucArgExecSheetPosX 'position on X
params(3).Val = XPOS ' in mm

params(4).qual = aucArgExecSheetPosY 'position on Y
params(4).Val = YPOS ' in mm

If params(2).Val = "" Then
ErrBox = MsgBox(ShapeMaster & " stencil was not found. Routine to end", vbCritical + vbOKOnly)
End
End If

Call actSHT.ExecuteSheetOperation(params)

End Sub




Private Function msGetSymbolFromName(oStencil As ObjectItem, sSymbolName As String) As String

Dim oSymbol As ObjectItem

For Each oSymbol In oStencil.Children
If oSymbol.Name = sSymbolName Then
msGetSymbolFromName = oStencil.ID & "#" & oSymbol.Attributes.ItemByID(aucAttrSymbolSyncDesignation).Value
Exit Function
End If
Next oSymbol

msGetSymbolFromName = ""

End Function