Resolve "Create Component Class"
Closes #20 (closed)
This class allows to perform operations on the components list of the project.
Methods
new(self, name: str)
Creates a component called name.
vba = 'Component.New "{}"'.format(name)
# Send the VBA code to CST
self.__MWS._FlagAsMethod("AddToHistory")
result = self.__MWS.AddToHistory("new component: " + name, vba)
delete(self, name: str)
Checks if a component called name exists. If affirmative, deletes it.
vba = 'Component.Delete "{}"'.format(name)
# Send the VBA code to CST
self.__MWS._FlagAsMethod("AddToHistory")
result = self.__MWS.AddToHistory("delete component: " + name, vba)
rename(self, name: str, newName: str)
Checks if a component called name exists. If affirmative, renames it to newName.
vba = 'Component.Rename "{}", "{}"'.format(name, newName)
# Send the VBA code to CST
command = "rename component: {} to: {}".format(name, newName)
self.__MWS._FlagAsMethod("AddToHistory")
result = self.__MWS.AddToHistory(command, vba)
exist(self, name: str)
Checks if a component called name exists.
No VBA string.
ensureExistance(self, name: str)
Checks if a component called name exists. If negative, creates it.
No VBA string.
Edited by Lucas POLO-LOPEZ