Jump to content

LinkedText


Recommended Posts

I have the following code that does everything, except link the text to the record. It works if I do it manually, but not in code.

 

Any thoughts?

 

 

        vs.BeginSym(panelName)
        TopX = (width_mm / 2)  * -1
        TopY = (height_mm / 2) 
        BotX = (width_mm / 2) 
        BotY = (height_mm / 2) * -1        
        vs.Rect(TopX, TopY, BotX, BotY)

 

        #Create the ID Text

        vs.TextFont(vs.GetFontID('ClanPro-Medium'))
        vs.MoveTo(0,0)
        vs.TextOrigin(0,0)
        if height_mm > 1000:
            vs.TextSize(22)
        elif height_mm > 700:
            vs.TextSize(18)
        elif height_mm > 500:
            vs.TextSize(14)
        else:
            vs.TextSize(12)
        vs.CreateText('ID')
        tObj = vs.LNewObj()
        vs.SetTextJust(tObj, 2)
        vs.SetTextVerticalAlign(tObj, 3)
        vs.SetTextWidth(tObj, width_mm)
        vs.SetOpacity(tObj, 30)

 

        #Link ID Number to ID
        vs.LinkText(tObj, 'LED Install - Panel', 'ID')

        vs.EndSym()

Link to comment

You may need to attach the record before linking the text.

I would suggest doing a manual link in an otherwise blank file, then exporting to script. Examine the script to check order of operations. That may also reveal something silly, like a spelling error. 

 

I do have to ask, if you’re coding this, why not just create a plug-in object? That would save you from having to figure out link text to record.

  • Like 1
Link to comment

The script creates around 100 symbols for the different LED panels we use. I'm then have several scripts that create plugins for a full screen. I use the symbols as I'm not sure how I would create a plugin using a plugin and if it would speed up the process. Another reason I use the symbol is I attach the size, weight, resolution, power and other specification data into the symbol that I use in a set of worksheets.

 

How would I go about creating them as plugins instead of symbols?

 

I forgot you could export a something as a script, I need to remember that as it would make things easer. I will try the script and see how it works.

 

Thanks 

 

 

Link to comment

Plug-ins essentially store parameters identically to record data, so a plug-in script can use Set/GetRField to access the data, for example to create text from that data. You can also run reports on plug-in parameters. If you're going the plug-in route, you would have parameters for all the elements you would need for the plug-in to draw the panel. You could save the plug-in as a "Red" symbol (if you're unfamiliar with the term, that's what to search for in the help) for different models.

 

You can indeed have plug-ins inside other plug-ins, calling CreateCustomObject() from in the PIO code. 

 

Another way to think about the problem is to still base the PIO on symbols, but have a PIO that uses the symbol for geometry and handles the labels and data management. If your combined screen also needs to have the labels, it could actually also do the work of placing a label for each panel.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...