DCarpenter Posted February 27, 2020 Share Posted February 27, 2020 Writing a simple script to add a prefix to all the symbol names in the drawing but can't seem to find the command to replace the current name with a new name. I can get a handle to each symbol in the drawing and its name, but can't figure out the command to write a new name for the symbol? thoughts? H1:=FInSymDef(H1); {will get me the handle to the first symbol in the drawing} SymName:=GetSDName(H1); {will get me the current name of the symbol} current symbol name: "Toilet" symbol name after the script is run: "Toilet-1" Quote Link to comment
Julian Carr Posted February 28, 2020 Share Posted February 28, 2020 I think you would need to use GetSymbolOptionsN() then SetSymbolOptionsN(), loading the latter with the values from the former, except for the symbol name. Quote Link to comment
DCarpenter Posted February 28, 2020 Author Share Posted February 28, 2020 Julian, According to the description of the SetSymbolOptionsN(), it only sets the insertion options and class of the symbol. Dave Quote Link to comment
MullinRJ Posted February 28, 2020 Share Posted February 28, 2020 Hi Dave, Use SetName(). If you have a symbol named 'Bob', the following will change the symbol's name to 'Larry', where 'H' is a variable of type HANDLE; H := GetObject('Bob'); SetName(H, 'Larry'); HTH, Raymond 1 Quote Link to comment
JBenghiat Posted February 28, 2020 Share Posted February 28, 2020 If you're using 2020, take a look at Batch Rename in the Tools menu. Quote Link to comment
DCarpenter Posted February 28, 2020 Author Share Posted February 28, 2020 SetName() and the Batch Rename tool are exactly what i needed. I remembered seeing that batch rename tool in the highlight reel for 2020 but could never figure out where it was. I kept on looking for it in the Organization window for layers and classes, but now that i know where it is, it's like a whole new day! Thank you for your help, Dave Quote Link to comment
Recommended Posts
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.