Skip to content

Commit

Permalink
Added support for array parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
openvmp committed Oct 11, 2024
1 parent 6b8cc11 commit 2912eaf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions partcad/src/partcad/part_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def normalize(name, config):
"type": "bool",
"default": param_value,
}
elif isinstance(param_value, list):
config["parameters"][param_name] = {
"type": "array",
"default": param_value,
}
# All params are float unless another type is explicitly speciifed
elif (
isinstance(param_value, dict) and not "type" in param_value
Expand Down
8 changes: 8 additions & 0 deletions partcad/src/partcad/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ def get_sketch(self, sketch_name, func_params=None) -> sketch.Sketch:
config["parameters"][param_name]["default"] = bool(
param_value
)
elif config["parameters"][param_name]["type"] == "array":
config["parameters"][param_name]["default"] = param_value
else:
# Filling "with"
if not "with" in config:
Expand Down Expand Up @@ -796,6 +798,8 @@ def get_part(self, part_name, func_params=None, quiet=False) -> part.Part:
config["parameters"][param_name]["default"] = bool(
param_value
)
elif config["parameters"][param_name]["type"] == "array":
config["parameters"][param_name]["default"] = param_value
else:
# Filling "with"
if not "with" in config:
Expand Down Expand Up @@ -989,6 +993,8 @@ def get_assembly(
config["parameters"][param_name]["default"] = bool(
param_value
)
elif config["parameters"][param_name]["type"] == "array":
config["parameters"][param_name]["default"] = param_value
else:
# Filling "with"
if not "with" in config:
Expand Down Expand Up @@ -1196,6 +1202,8 @@ def get_provider(
config["parameters"][param_name]["default"] = bool(
param_value
)
elif config["parameters"][param_name]["type"] == "array":
config["parameters"][param_name]["default"] = param_value
else:
# Filling "with"
if not "with" in config:
Expand Down
5 changes: 5 additions & 0 deletions partcad/src/partcad/provider_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def normalize(name, config):
"type": "bool",
"default": param_value,
}
elif isinstance(param_value, list):
config["parameters"][param_name] = {
"type": "array",
"default": param_value,
}
# All params are float unless another type is explicitly speciifed
elif (
isinstance(param_value, dict) and not "type" in param_value
Expand Down
5 changes: 5 additions & 0 deletions partcad/src/partcad/sketch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def normalize(name, config):
"type": "bool",
"default": param_value,
}
elif isinstance(param_value, list):
config["parameters"][param_name] = {
"type": "array",
"default": param_value,
}
# All params are float unless another type is explicitly speciifed
elif (
isinstance(param_value, dict) and not "type" in param_value
Expand Down

0 comments on commit 2912eaf

Please sign in to comment.