A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
Select a Tag using Python
Posted: 02 April 2016 06:56 PM   [ Ignore ]  
Total Posts:  3
Joined  2014-01-03

There is any simple Python script to select and delete a specific tag?

I’m architect and we import geometry directly from Vectoworks.
Some objects came with the TAG Compositing. We need to search and delete that TAG every time we do a new import (and we do a lot).

If we could find some simple Python Script to do this automatic, it will help a lot.

Thank you in advance for your feedback.

Best regards.

Profile
 
 
Posted: 02 April 2016 07:08 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Gonçalo Silva Arquitectos,

Have you tried to filter it and select from there?

Have a look at that little icon (eye), it allows you to select all tags of the same kind.

Just double click on it and the Object Manger shows the selection, press the delete button and they are gone.

Of course I have tested it right now, to know if that is working in the current version. I found that sometimes the delete option is not given. If that is the case, intro duce a Null object and drag all the selected tags (just pull one) on the Null, then delete.

I have a little clip that shows how to do it, even the delete option is not a given for that moment:
https://www.amazon.com/clouddrive/share/Yl8ScI3Lax7SgTcf6w1tJzncb769W9bUDQAoj2tCU5z?ref_=cd_ph_share_link_copy
You can download the clip.

Let me know if it is working for you. If not, do you have a small file with the “problem”, I can set up an upload link, so it is kept privately.

All the best

Sassi

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 03 April 2016 10:46 AM   [ Ignore ]   [ # 2 ]  
Total Posts:  3
Joined  2014-01-03

Hi Dr. Sassi,

Thank you for your very very fast reply. We already know that method using the Object Manger filter, and it works.
The point is this is an operation that we do hundred of times, it is a repetitive task, and we are trying to create a BUTTON with python that do this and other routines.
We already have this script below in Python, but is missing the SEARCH command for a key word “Compositing” - This command should be afield before the # Select Visible command

Python Script:


import c4d
from c4d import documents, plugins
#Welcome to the world of Python

def main():
  c4d.CallCommand(100004745) # Flat Tree
  c4d.CallCommand(100004810) # Vertical Tags
  c4d.CallCommand(100004786) # Select Visible
  c4d.CallCommand(100004787) # Delete
  c4d.CallCommand(100004810) # Vertical Tags
  c4d.CallCommand(100004745) # Flat Tree


if __name__==‘__main__’:
  main()
  c4d.EventAdd()


A Search command will also help us a lot in other routines that we want to create

We appreciate very much if you could help us on this

Best regards,

Profile
 
 
Posted: 03 April 2016 10:50 AM   [ Ignore ]   [ # 3 ]  
Total Posts:  3
Joined  2014-01-03

This is a print screen

Profile
 
 
Posted: 03 April 2016 03:25 PM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Thanks for letting me know what you have tried already, Gonçalo Silva Arquitectos.

I installed VW and tried different ways to “Export” as obj or dae, or I have used the “Send a file to CINEMA 4D (3D only)” directly. In the File>Export>Collada file I couldn’t find any Compositing Tag in the scene file.
None of these gave me a Compositing Tag on the Objects. I found only one that was on the Sky object. But set neutral, with no effect on the scene/objects.

Which triggers the question, why is it important for your workflow to have the Compositing Tag gone?
There is certainly a reason, but I’m not aware of it.
There are two places to go to change that once and forever, to ask the VW support to haven option to exclude these (Preferences or any optional Dialog), or to have MAXON doing it in their Dialog (see image) as default option. I guess you have a solid reason that might benefit others as well,so:
http://www.maxon.net/support/suggestions.html

My experience in Python in limited, so I feel not comfortable to share those. Rick, Donavan, Bret or Patrick have more routine in doing so. Perhaps they like to create this for CV-Tools.

My idea would be to go through the parts of the scene/ tag wise in a loop and then have an “If routine” asking for the name
https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.documents/BaseDocument/index.html?highlight=getactivetags#BaseDocument.GetActiveTags
https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/index.html?highlight=tag#c4d.GetTagName
and if the name equals “Compositing”, then it should be deleted. “.Remove()”
OR, a loop that ask for the ID, and deletes those: (100004788, 50021) the ID of that Tag if I’m not mistaken.
https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/C4DAtom/GeListNode/BaseList2D/index.html?highlight=killtag#BaseList2D.KillTag

I’m not aware of an option to have the “Search Result” of this method in your example deleted, I might be wrong. Given that there is no Script log entry while doing so leads me to that impression. Again, Python is not my domain.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
   
 
 
‹‹ Q&A_miscellaneous      Bodypaint Aliasing ››