marcus7070 / spindle-assy-example

Assembly example for CadQuery
MIT License
25 stars 1 forks source link

Questions about Example #3

Closed noce2 closed 3 years ago

noce2 commented 3 years ago

Hi @marcus7070

Thank you for putting this example out there, it's really helpful. I am trying it myself to get a handle on cadquery and how to use it for more complex models.

I've noticed that you hard reload imported modules often. Why is this necessary?

https://github.com/marcus7070/spindle-assy-example/blob/0be10a302792a37c9648c7bf81f1da9c0bd3af0e/bracket.py#L4

Also, I noticed you used a SimpleNamespace for storing variables across the parts. Why this option? As opposed to say a plain dictionary?

marcus7070 commented 3 years ago

Hi @noce2, glad to hear it's helping!

I've noticed that you hard reload imported modules often. Why is this necessary?

CQ-editor runs and reruns your scripts in a single python instance. If you make a change to dims.py, on the next run import dims will get the cached module and not your modified one. Explicitly reloading modules you are changing gets around this.

Also, I noticed you used a SimpleNamespace for storing variables across the parts. Why this option? As opposed to say a plain dictionary?

That's just because I prefer the dot notation to ["name"], just a style thing. Dicts are completely equivalent.