Closed ozserhatt closed 5 months ago
I've edited your post to format your code again. Please, edit your reply to see how I did that.
The Parameters object has a method called remove. You should be able to pass it the parameter name or index to remove it.
I can remove parameters but I can not remove a parameterset. So I will try again for you..
My apologies for that. I misread the question, totally my fault. I'll take a look at this again.
This deletes the ParameterSet
called delete_me
.
I worked this out by recording a macro and reading the generated code to give me clues. I can't stress enough how valuable a tool this is.
Couldn't see any other way to do it as the ParameterSets
collection object has no method for deleting.
from pycatia import catia
from pycatia.mec_mod_interfaces.part import Part
from pycatia.mec_mod_interfaces.part_document import PartDocument
from pycatia.knowledge_interfaces.parameters import Parameters
caa = catia()
application = caa.application
part_document = PartDocument(caa.active_document.com_object)
selection = part_document.selection
part = part_document.part
bodies = part.bodies
part_parameters = part.parameters
root_parameter_set = part_parameters.root_parameter_set
parameter_sets = root_parameter_set.parameter_sets
delete_me = parameter_sets.item("delete_me")
selection.clear()
selection.add(delete_me)
selection.delete()
Good stuff. That is a cleverly. :) Well done!
HOW CAN I REMOVE THE PARAMETERSET ???