question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cqparts parameter access

See original GitHub issue

I’d like to use a class parameter as the template param of the render_props function and defined it as following:

class Case(cqparts.Part):
    # Parameters
    color = String("green", doc="color-coded position")
    print(color)
    _render = render_props(template=color)

Unfortunately, it is not accessed like a str as it is expected by the template param and can be seen with the print statement (it prints: <cqparts.params.types.String object at 0x000002602F2ACBE0>). If I call render_props(template=color.default) it works but uses the default value and not the passed value. How to access the value passed as the class parameter?

In cqparts/tests/t_cqparts/test_params.py only default and casts are tested.

BTW: Using native types like str do not work as parameters.

CadQuery 1.2.0 cqparts 0.2.2.dev1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tolot27commented, Dec 30, 2018

It works now as expected. Many thanks!

0reactions
fragmuffincommented, Dec 30, 2018

OK @tolot27 , your 2nd code example should work after fix #140. Thank you for letting me know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cqparts package — cqparts 0.2.1 documentation
Parameters : recursive ( bool ) – if set, iterates through child components and builds those ... The outcome of this function should...
Read more >
Use parameters in queries, forms, and reports
This article explains how to use forms in Access to enhance your use of parameters in queries, forms, and reports.
Read more >
Part placement · Issue #26 · cqparts/cqparts - GitHub
Place parts with translation : vector (easy) rotation quaternion angles need to look at how this is done conventionally.
Read more >
CadQuery – a parametric CAD script framework - Hacker News
Also check out cqparts which builds on cadquery and add the concept of parts, assemblies and mates to cadquery.
Read more >
Source code for cadquery.occ_impl.geom
[docs] def __getitem__(self, rc: Tuple[int, int]) -> float: """Provide Matrix[r, c] syntax for accessing individual values. The row and column parameters ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found