VBA Code:
'œbergabeparameter: Breite und Höhe des Rechtecks
Private Function createBeltConvoyer(ByVal WIDTH_X As Integer, ByVal HEIGHT_Y As Integer)
Dim zPIC As DynPicture
Dim eleRec As Element
Dim eleCir1 As Element
Dim eleCir2 As Element
Dim zSymbol As Element
Const strPicture As String = "picStandardMixer1"
Const strElement As String = "Rectangle1"
Const STRCIR1 As String = "Circle1"
Const STRCIR2 As String = "Circle2"
'get Screen object
Set zPIC = MyWorkspace.ActiveDocument.DynPictures.Item(strPicture)
'if Screen object is nothing, the Screen doesn't exist...
If zPIC Is Nothing Then Exit Function
'get Element object
Set eleRec = zPIC.Elements.Item(strElement)
Set eleCir1 = zPIC.Elements.Item(STRCIR1)
Set eleCir2 = zPIC.Elements.Item(STRCIR1)
Set zSymbol = zPIC.Elements.Item("Belt_conveyor")
'if element object is nothing, a new one can be created...
If eleRec Is Nothing Then
'create a new element (Text-Button)
Set eleRec = zPIC.Elements.Create(strElement, tpRectangle)
'set properties of the new element
With eleRec
'set size and position
.Width = WIDTH_X
.Height = HEIGHT_Y
.Left = -200 + (HEIGHT_Y / 2)
.Top = -200
'set graphic representation
.BackColor = vbBlue
.ForeColor = vbBlack
End With
End If
If eleCir1 Is Nothing Then
'create a new element (Text-Button)
Set eleCir1 = zPIC.Elements.Create(STRCIR1, tpCircle)
'set properties of the new element
With eleCir1
'set size and position
.Height = HEIGHT_Y
.Width = HEIGHT_Y
.Left = -100
.Top = -100
'set graphic representation
.BackColor = vbBlue
.ForeColor = vbBlack
End With
End If
If eleCir2 Is Nothing Then
'create a new element (Text-Button)
Set eleCir2 = zPIC.Elements.Create(STRCIR2, tpCircle)
'set properties of the new element
With eleCir2
'set size and position
.Height = HEIGHT_Y
.Width = HEIGHT_Y
.Left = WIDTH_X
.Top = 0
'set graphic representation
.BackColor = vbBlue
.ForeColor = vbBlack
End With
End If
If zSymbol Is Nothing Then
'create symbol
Set zSymbol = zPIC.Elements.Create("Belt_conveyor", tpSymbol)
'set properties of the new symbol
With zSymbol
.Width = WIDTH_X + HEIGHT_Y
.Height = HEIGHT_Y
.Left = 100
.Top = 100
.Elements.Add eleRec
.Elements.Add eleCir1
.Elements.Add eleCir2
End With
End If
'save picture
zPIC.Save
End Function
This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.
The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.
Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.
Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.
COPA-DATA reserves the right to change this document from time to time at own discretion.
Ing. Punzenberger COPA-DATA GmbH
Karolingerstraße 7b · 5020 Salzburg · Austria
www.copadata.com