Cast Element to Tag

Can anyone help in how to change the output of my python node so that Tags are recognized in Dynamo. Currently i am only outputting Elements.

Actually the node works with Elements, if you select a tag in the model and connect it to the node, it works.

It’s hard to say what is the problem if we don’t see the inputs, can you maybe post a full screenshots, with all previews visible, of a very simplified case?

Also it’s better to post the python code with copy/paste, select it and click on Preformatted Text button :wink:

Hi Lucam, I tried a test on a clean project just now. The node does not seem to work for Room Tags. My question is how to set a spatial tag (room tag) elbow etc using Python. Is there a “Set” method for, say, the elbow of a leader (see attached from API)? How would the syntax look in Python?
Kind Regards,
Paul

Yes you are right, I did a test on a wall tag and it was working.

If you want to get the location of the room tag, in Python it should be like this:

tag = UnwrapElement(IN[0])
loc = tag.Location.Point.ToPoint()

About setting a spatial tag elbow, at the moment I have no idea. May I ask why would you need to do it for a room tag? Maybe there is a workaround

Hi Luca,
Thanks for yout time and help. I am also able to “get” the location, but it is the “set” location that is defeating me. It should operate as
Location.Move
It is purely a matter of switching out types of tags based on information within the space, and then the leader is no longer horizontal, and I would like to adjust this. It is in response to existing views that must conform to a company standard. I am thinking that the workaround would be to delete the tag and place it again? One does seem to have some control of the elements on creation.
Kind Regards,
Paul Storm4

Ok, I see. I showed the way to get the location because in your topic you had problem with the node to get the tag postion.
To move the tag you need a XYZ that is representing the translation vector.
This is an example how to move the tag with a vector (1,1,0).

tag = UnwrapElement(IN[0])
vector = XYZ(1,1,0)

TransactionManager.Instance.EnsureInTransaction(doc)

loc = tag.Location.Move(vector)

TransactionManager.Instance.TransactionTaskDone()

Instead of (1,1,0) you need to find the vector between your current point and the final point

1 Like

Hi Luca,
Perfect. I discovered the Tag.LeaderEnd also works. I will look at controlling the tag further tomorrow, and thank you very much for all your input (it is very much appreciated). :grinning:
Kind Regards,
Paul Storm
6

1 Like