Showing results 1 to 5 of 5

Thread: insert symbols from project library with hierarchical names

  1. #1

    Default insert symbols from project library with hierarchical names

    How to insert instances of linked symbols from the library into a new screen, using hierarchical naming:

    Notice the ".Pump" for the symbol in the project library called "Pump"
    Take care, each symbol receives a unique symbol number!

    Sub insertLinkedSymbols()
    Dim myScr As DynPicture
    Dim myElem As Element
    Dim i
    
    Set myScr = MyWorkspace.ActiveDocument.DynPictures.Item("a")
    
    If Not myScr Is Nothing Then
    For i = 0 To 10
        Set myElem = myScr.Elements.Item("Pump" & i)
        If myElem Is Nothing Then
            Set myElem = myScr.Elements.Create("Pump" & i, tpSymbolLnk)
            myElem.DynProperties("SubstituteCombinedName") = True
            myElem.DynProperties("LinkName") = ".Pump"
            myElem.DynProperties("PropSymbolNumber") = i
            myElem.Name = "Pump" & i
            myElem.Top = 100 + (50 * i)
            myElem.Height = 50
        End If
        Next i
    End If
    End Sub

  2. #2
    Join Date
    24.04.2012
    Posts
    17

    Default Re: insert symbols from project library with hierarchical names

    hi..
    i have checked the code in ver6.51.
    code is getting executed but, the object is not getting visual in Editor.

    what to do for that?

    thanks,
    Paruvathakumar
    Thanks&Rgds,
    Paruvathakumar

  3. #3

    Default Re: insert symbols from project library with hierarchical names

    Hi Paruvathakumar,

    This example assumes several things:

    - a screen exists in the active project called "a"
    - a structure datatype exists, called "Pump"
    - structure variables exist, based on the structure datatype "Pump", called Pump0, Pump1 .. Pump10
    - a symbol exists in the project library for the active project called "Pump"
    - the symbol "Pump" in the library uses elements that reference structure elements of the Pump structure datatype (e.g. "flow", "status", "temperature")

    By using hierachical names at the linked symbol, the name of the symbol instance in the screen defines which structure variable is used. In the symbol in the library, no existing variable is used, but only a placeholder. There could for example be a numerical value linked with the placeholder "flow"

    So with hierarchical linking and the instance name "Pump1", the numerical value in the instance links to the structure variable "Pump1.flow".

    Have a look how this works in the user interface to get a better understanding, and then give the VBA example a try again

    Best regards,
    Mark

  4. #4
    Join Date
    24.04.2012
    Posts
    17

    Ausrufezeichen Re: insert symbols from project library with hierarchical names

    Dear Mr.Markclemens,
    thanks for the Reply. i found the problem and now it is working for fine.
    Now i having a symbol in library and i have exported some property like object visibility, ID numbers(Static Text) etc. How do i can access it in the VBA in editor.

    basically i;m trying to create a wizard to create a page with required elements in Editor.
    kindly help me to overcome the above problem.

    thanks & rgds,
    Paruvathakumar P
    Thanks&Rgds,
    Paruvathakumar

  5. #5

    Default Re: insert symbols from project library with hierarchical names

    Hi Paruvathakumar P,

    Please have a look at the symbol wizard (frmSymbol) which gives you an example of exactly how this can be done.

    Normally this wizard is already installed, and is launched when you double click a linked symbol in your screen that has exported properties.

    In the wizard you can choose one of the exported properties and change the value.

    The wizard is available to you in source code and can be copied / reused / adapted to your needs.

    If the wizard is not available, you can import the wizard via the VBA editor (import file) from %CD_PROGRAMDATA6510%\Wizards\SymbolWizard

    Best regards,
    Mark

Similar Threads

  1. Microsoft Visual C++ Runtime Library Error
    By douglasm in forum VSTA
    Replies: 5
    Last Post: 5th April 2019, 06:54
  2. Combined element and symbol library problem...
    By marduv in forum zenon Supervisor
    Replies: 1
    Last Post: 28th July 2010, 23:41
  3. Replies: 0
    Last Post: 4th March 2009, 09:50
  4. CLX Variable Names
    By lunzer in forum zenon Supervisor
    Replies: 2
    Last Post: 9th December 2008, 16:29

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •