Jump to content
3DCoat Forums

[Solved] Bug??? ... Frustrated with extrusions .... I get inconsistent results sometimes...


celer
 Share

Go to solution Solved by Andrew Shpagin,

Recommended Posts

  • Member

So I'm expecting to generate a mold for casting, I'm getting closer to getting what I want which should look like this:

image.thumb.png.3e603631c92c43b8fe0c654ada9a212c.png

But I'm having some challenges, when try to do an extrusion for the seam:

def extrude(target=coat.SceneElement,amount=int):
    coat.Scene.sculptRoot().unselectAll()
    target.select()
    print("Extruding "+target.name()+" by "+str(amount))
    def setExtrusion():
        coat.ui.setSliderValue("$ExtrudeParams::Extrusion",amount)
        coat.ui.cmd("$DialogButton#1")
    coat.ui.cmd("$ExtrudeVO",setExtrusion)
    coat.ui.wait("$ExtrudeVO",30)

And then do an intersection (is the coat.ui.wait(...) even needed, I have no idea.

def intSeam(target=coat.SceneElement,width=int):
    bbox=target.Volume().calcWorldSpaceAABB()
    center=bbox.GetCenter()
 
    size=bbox.GetSize()
    size.x=width
 
    # Shift this up by the seam size amount
    center.z=center.z-15
 
    print("Intersecting seam "+target.name()+" "+str(width))
    sbox=coat.box(center,size)
    sbox.intersect(target.Volume())

like so:

    mold_seam=pmold.duplicate()
    mold_seam.rename("mold_seam")
    extrude(mold_seam,15)
 
    # This fails sometimes :(
    intSeam(mold_seam,10)

 

It just doesn't do the intersection sometimes, sometimes running the script 10 times, 9/10 times it will fail, and won't perform the intersection, sometimes restarting 3D Coat will cause it to work :( Sometimes it works and I can't get it to fail, it's very inconsistent. I either don't understand something, or there is a bug. I'm so excited about python scripting 3D Coat but it's a bit buggy. Previously I was getting very weird results with extrusions, which I posted about in another forum thread, but a restart seems to have fixed that. 

I either think there is a race condition or a cache invalidation problem - it feels like a bit of both, restarting it fixes is, so seems like a cache validation problem, but then also it feels like a bit of a race condition - is the extrusion finishing before the intersection is complete?

 

negative_mold_test.3b head_mold.py

Edited by celer
to clarify how it fails
Link to comment
Share on other sites

  • Member
17 hours ago, Oleg_Shapo said:

Did you submit a crash report via the feedback form?

I can, it doesn't crash it just fails to perform the intersection. 

Link to comment
Share on other sites

  • Member
15 hours ago, Elemeno said:

cant you just use a split command??

not for the operation I'm trying to do, I will eventually end up using split or subtract to split the mold in two

Link to comment
Share on other sites

On my side script runs correctly. But try adding coat.io.step(2) after intersection to ensure that mesh operation finished:
 

sbox=coat.box(center,size)
sbox.intersect(target.Volume())
coat.io.step(2)

 

Link to comment
Share on other sites

  • Solution

Other workaround is to use mesh instead of primitive:

sbox = coat.Mesh.box(center,size)
sbox.toVolume(target.Volume(), op=coat.BoolOpType.BOOL_INTERSECT)
Link to comment
Share on other sites

If I will loose this thread please remind me at andrewshpagin@gmail.com, I want to make python scripting to be really solid.

  • Like 1
  • Thanks 1
  • Haha 1
Link to comment
Share on other sites

  • 3 months later...
  • Member

Thanks for your response, I'm back at this now, I took two months off a computer to see if helped me recover my hands after an RSI from software dev.

I will send you an email as I'm still having issues.  

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...