Jump to content

Data tag class assignment based on connected object


Ivers

Recommended Posts

Hi there, 

 

I am using data tags to make lighting labels  in spotlight. I have created a small script that assigns all lighting instruments to a class with the same name as the lighting instrument (with a prefix). The result is something like this: Lighting Fixtures-Mac Aura XB. Since I am using data tags to display instrument data like adresses, circuits and so on, I want to automate the process of assigning the data tags to the correct class. E.g. Lighting Labels-Mac Aura XB.  To do this, I need to iterate through all data tags and and assign them to a class dependent of the name of the connected lighting instrument. Is this possible to do in a script? The data tag part of the vectorscript documentation is quite limited. 

Link to comment

Hi Ivers,

here is a little example that gives you the count off the dataTag objects. What you need to do is simply replace the counting by the set class function:

crit = "((R IN ['Data Tag']))"

count = 0

def callback(h):
	global count
	count += 1	

vs.ForEachObject(callback, crit)

vs.AlrtDialog("Counted ", count, " DataTags")

 

Link to comment

Hi Pat,

 

Thank you very much for your answer. 

 

This solves one out of two problems. Now I can set the class for a data tag. What I am trying to do is: 

 

I have a symbol with a record format attached to it. One of the fields in the record is "Name".  I have made a script that assigns the given symbol to a class named after the "Name" field in my record format. Then I add some data tags to show data about this symbol. Next, I want to assign the data tag to a class based on the "Name" field in the record format of the associated symbol. (Puh, long sentence). 

 

A small example. 

 

SymbolA with a record format with a field "Name"="Paul"

My current script will assign this symbol to a class named "Symbolprefix-Paul"

 

The problem: 

SymbolA has a data tag associatedwith it. When I run the script, the data tag should end up in a class called:

"Datatagprefix-Paul"

 

So I need a way to get a handle to the associated object when I loop through the data tags.

 

Sorry about the confusing explaination. 

Edited by Ivers
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...