Open dcowden opened 5 years ago
Comment by dcowden Monday May 21, 2018 at 21:18 GMT
created based on conversation in #281 and also in https://github.com/jmwright/cadquery-freecad-module/issues/112, and
Comment by dcowden Monday May 21, 2018 at 21:30 GMT
and also mentinoed in https://github.com/fragmuffin/cqparts/issues/66#issuecomment-390788722
Comment by jmwright Tuesday May 22, 2018 at 00:14 GMT
@jmwright before i start these changes, do you agree? What is the impact on cqfm?
There will be some changes. CQFM assumes that show_object magically shows up.
Probably the biggest challenge is that this change will break existing scripts. When people upgrade CQ their scripts are going to break and they won't understand why.
Comment by dcowden Tuesday May 22, 2018 at 01:07 GMT
@jmwright hmm that's a good point. I need to figure out a way to make the changes reverse compatible.
Comment by zwn Tuesday May 22, 2018 at 07:56 GMT
Having the possibility to import cadquery
and show_object
would open the possibility to execute the script as is. Eventually, show_object
can be implemented using pythonOCC SimpleDisplay. That would allow (I think) easy onboarding with no magic involved. I think that only cq developers should have the need to know about cqgi. Users of cq could stay oblivious and I think that is a good thing. Tutorial on "getting started with cq" would involve conda install plus running the examples as regular scripts.
Comment by rowanG077 Tuesday May 22, 2018 at 08:20 GMT
What is the timetable for 2.0? Maybe include this change in the 2.0 version and break backwards compat. I rather have a clean interface and change a couple of scripts then have a murky interface that is confusing to newcomers.
Comment by dcowden Tuesday May 22, 2018 at 11:41 GMT
The timetable for cq 2.0 indeterminate at this point. I think we are all in agreement that 2.0 is where we introduce breaking changes.
Comment by rowanG077 Tuesday May 22, 2018 at 12:14 GMT
Yeah so it would make more sense to make this a 2.0 feature.
Comment by fragmuffin Friday May 25, 2018 at 13:17 GMT
I need to figure out a way to make the changes reverse compatible.
I don't think that's possible, if the target is to "remove magic" (which I totally agree with 👍 ), then old scripts will error with: NameError: name 'show_object' is not defined
To ease the transition, it may be worth catching that exception at a higher level, and print a message...
try:
run_script() #?
except NameError as e:
if e.message == "name 'show_object' is not defined":
print("show_object method not supported by cadquery v2.0, see https://goo.gl/JsWyUP")
raise
Although, again, this is python running from python... so I'm not sure where the magic ends.
Issue by dcowden Monday May 21, 2018 at 21:09 GMT Originally opened as https://github.com/dcowden/cadquery/issues/270
after discussions with @fragmuffin and others, we'd like to change cqgi to require scripts to import show_object, debug, and cadquery itself.
The consensus was that there is just too much magic in scripts that use show_object when it appears out of nowhere.
This will require changing cqgi itself, as well as changing all of the examples to do this import. It probably also means that cqgi.show_object should be promoted to a real function, not injected during the ast phase.
@jmwright before i start these changes, do you agree? What is the impact on cqfm?