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.

Thread solids invalid

See original GitHub issue

Thread solids are not valid, and consequently fail boolean operations.

>>> import cqparts
>>> thread = cqparts.types.threads.iso_262.ISO262Thread().make(5)
>>> thread.val().wrapped.isValid()
False

solids can be cleaned up using the method(s) described here, but they’re not always successful.

slight variations initially yield an unclosed solid, but are fixed with sewShape(), for example

>>> import cqparts
>>> thread = cqparts.types.threads.iso_262.ISO262Thread(pitch=0.7).make(3)
>>> thread.val().wrapped.isValid()
True

Exception

code modified to crash more gracefully by raising:

SolidValidityError: created thread solid cannot be made watertight

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
fragmuffincommented, Dec 22, 2017

This bug is making thread-building completely unmanageable. It’s making building a very painful and error-prone experience… the presence of thread faces makes cqparts very unstable.

Mitigated by Simplifying to Cylinder

For the time being, I’ve converted the base Thread type to a Part so I can exploit the _simple=True flag, which causes the make_simple() method to build the part’s .local_obj as opposed to .make(). (see f1e98fe)

In other words, by default, threads are not generated. Instead they are replaced with a cylinder with the thread’s average radius (outer + inner) / 2.

Workaround

If you’d like to play with real threads, you can turn off default simplification with any of…

import cqparts
from cqparts.display import display
from cqparts.params import Boolean
from cqparts.fasteners.base import FastenerMalePart
from cqparts.solidtypes.threads import base

# --- an individual part
screw = FastenerMalePart()
screw.thread._simple = False
display(screw)

# --- all threads by default
base.Thread._simple.default = False
# you'll have to re-define the thread type, because the default thread
# was instantiated before the above change was made
screw = FastenerMalePart(
    thread=('iso262', {
        'diameter': 3.0,
        'pitch': 0.7,
    }),
)
display(screw)

# --- all threads by default (by environment variable)
# because the above way is messy... you can set an environment variable:
#       CQPARTS_COMPLEX_THREADS=yes
display(FastenerMalePart())  # default of _simple is False at import time

none of the above methods are permanent, please keep this in mind if you’re planning a future-proofed script.

Fix Delay

I also won’t have time to fix this for the initial release… but it’s very high on the priorities list after v0.2

0reactions
fragmuffincommented, Mar 19, 2018

Task

  • remove warning about this fault from cqparts_fasteners README.rst
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: volume-integrals: invalid thread - Forums - CFD Online
Simulating a solid heat sink which contains phase change material and air. volume fraction of pcm is 0.3. Employed VOF model.
Read more >
SOLIDWORKS Tutorial - How to Fix Missing Cosmetic Threads
For parts and assemblies, the main things to check are the Detailing settings in the Document Properties, as well as the View -...
Read more >
Cross-thread operation not valid [duplicate] - Stack Overflow
Okay, I know why this is giving me this error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the...
Read more >
Draw symmetries invalid thread - Ansys Learning Forum
Hello everyone ! I'm writing this topic because I'm using ANSYS Fluent for a project and when I changed the name of my...
Read more >
Invalid memory ordering in thread park / unpark #53366 - GitHub
I'm pretty sure that the memory orderings uses in the thread park / unpark are incorrect. They happen to work on x86 due...
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