Jump to content
Developer Wiki and Function Reference Links ×

How to get the (data) tagged object?


Recommended Posts

When tagging an object using a data tag, a connection between the two is established.

I'd like to find a way to get the handle of the objects that was tagged by a certain data tag.

In my mind a command could look like this

hTaggedObj = vs.DT_GetAssociatedObj( hDT )

The only commands about data tags I could find in the developer wiki are these two:

https://developer.vectorworks.net/index.php/VS:DT_AssociateWithObj

https://developer.vectorworks.net/index.php/VS:DT_UpdateTagsOfTagged

 

The List View Ex dialog of the debug mode wasn't much help either.

Link to comment
  • 1 month later...

What about this:
 

def IsTagged(h):
    result = False;
    num = vs.GetNumAssociations(h)
    assH = None
    assKind = None
    value = None
    i = 0;
    while(i < num and result == False):
      assH, assKind, value = vs.GetAssociation(h, i);
      if (assKind == 37):
        result = True;
        i = i + 1;
        return result, assH;


This would help finding Tagged Object. This was some I found in the Forum here. It works in a Marionette Object, which is inside a DataTag to find the tagged Object. So I think you could loop all Objects and check with vs.GetAssociation() type 37. Then you have the Tag and could check the Kind of Tag.
 

  • Like 1
Link to comment
  • 5 months later...

This one, used while in Annotations, uses the selexted Datatag and jumps to the tagged Object in yours Model and select it.

import vs;
objs = []
def Name(h):
	hLayerObj = vs.GetLayer(h)
	hLayerAct = vs.ActLayer()
	vs.AlrtDialog(vs.GetName(h))
	hAss, iAssKind, iAssVal = vs.GetAssociation(h, 0)
	if hAss != 0:
		objs.append(hAss)


vs.ForEachObject(Name, "((INSYMBOL & INOBJECT & INVIEWPORT & (VSEL=TRUE)))")


if len(objs) == 1:
	hLayObjs1 = vs.GetLayer(objs[0])
	vs.DoMenuTextByName('Group Navigation Chunk', 2)	#Verlasse Ergänzungen
	vs.Layer(vs.GetLName(hLayObjs1))					#Wechsel Ebene
	vs.SetPref(94, True)								#Aktuivere Modellansicht
	vs.SetPref(14, True)								#Zeige Objekte auerhalb Gruppe
	vs.DSelectAll()

	for x in objs:
		hParObj = vs.GetParent(x)
		iTypParObj = vs.GetTypeN(hParObj)
	
		if iTypParObj == 11:
			vs.SetSelect(hParObj)
			vs.DoMenuTextByName('Group Navigation Chunk', 1)
		if iTypParObj == 15:
			vs.SetSelect(hParObj)
			vs.DoMenuTextByName('Group Navigation Chunk', 1)
		
		vs.SetSelect(x)
		vs.DoMenuTextByName ('Fit To Objects', 0)

 

Hope this one is helpful. Have fun,

Heiko Jakob

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...