Hi , i want to add a script to see the names of deleted ( view templates )
Can someone help me out please
Thx
Hi , i want to add a script to see the names of deleted ( view templates )
Can someone help me out please
Thx
Because you’re dealing with Ids, if you try to return the Id of the deleted template it won’t exist anymore. It’s best to get the template name before deleting, so inside your for e in toDelete:
loop just add a line getting the element from the Id and the name from the element. Append that to a new list and return it at your output.
Thx Nick… but im still new in Dynamo, can u just show it in dynamo , write the steps for that … ( if it possible )
This forum is not for asking others to do your work for you. You need to show some effort and make an attempt yourself. Did you not write the code you’ve shown us? Using pieces and parts of other people’s code is a great way to get a jumpstart on your own development but you still need to at least understand what any code you use is doing because you’ll be the one supporting it. Take a look at the Revit API, specifically the Element Class, to see what methods you need. Take the time to understand the API and try to learn python. It’s incredibly powerful as soon as you get even a little bit proficient with it.
You could also do all of this with nodes if that’s easier for you. It’s the same general workflow of checking applied templates against all loaded templates and returning their names and Id’s for deletion.
Thats what im doing now ( try and error ) , i been trying since 2 days to get the ID , but the code doesnt work at all , i need this thing urgent … thanks anyway
That’s good to know. Do you get any errors? What is the current output you get? We need more information if we’re going to be able to provide you any suggestions.
I dont have errors , but im trying to add a line after ( for e in toDelete: ) as u told me
to ge tthe elemnts name before deleting … but i dont find in the script ( element.name ) ??
So does the code work up until this point or not at all? There’s no point in trying to get the name if the rest of the code leading up to this point hasn’t worked.
Look at these two methods to get the element from the Id and to get the name from the element.
Thx Nick…
Nothing works
Just put all your code in a python none rather than try to use the script from string. You’ll find it much simpler to debug as the python nore will point out your error.
Hi aaronrumple ,
I dont get your point ?
You can do the code as you have done.
Or you can use the python script node to write your code.
The python script node gives you a nice (well decent) code editor that helps with syntax. Pretty colors and all. The error reporting is more robust in this node. Note, each code has an error. The script from string reports the first error it finds. The python script reports two errors. Better feedback.
I appreciate ur help , but im a bit confused , do i creat another Python script ?? ( see photo below please
Yes.
These are two identical scripts. Just different tools to do the same things.
I suggest you start with the basics.
https://primer.dynamobim.org/10_Custom-Nodes/10-4_Python.html
Is there a better way for this , all i need when i run the script to show the deleted view templates only
Im just a beginner ( a week ago )
Thx
You still haven’t really shown us anything. We can’t suggest your next steps if we haven’t seen the previous steps you’ve taken to get where you are now. Did you try the API methods I shared? Where did they get you? What issues did you run into?