Skip to content

Instantly share code, notes, and snippets.

@hwei
hwei / main.py
Created March 29, 2023 09:26
Generate all possible curve sequences for all possible road length.
def road_length_to_all_possible_curve_sequences(curve_length_by_type: list[int], max_road_length):
'''对每种道路长度,生成可能的曲线组合序列。
Args:
curve_length_by_type (list[int], optional): 每种类型曲线的长度。
max_road_length (int): 最大道路长度。
Returns:
road_length_to_last_possible_curve_type_list (dict[int, list[int]]):每种长度的道路最后一段曲线的类型。
'''
# curve_length_by_type[curve_type_index] = curve_length
@hwei
hwei / houdini_cook_top_network.py
Created December 16, 2024 02:19
Cook Houdini TOP network from python or command line with progress output
def cook_top_network(hip_filepath: str, top_node_path: str, parm_dict: Dict[str, Any]):
print(f'Process ID: {os.getpid()}')
import hou
print(f'Loading hip file: {hip_filepath}')
hou.hipFile.load(hip_filepath)
top_node: hou.TopNode = hou.node(top_node_path)
assert isinstance(top_node, hou.TopNode)
for parm_name, value in parm_dict.items():
print(f'setting {parm_name} to {value}')