creating sphere with temporary BRep manager

creating sphere with temporary BRep manager

Anonymous
Not applicable
934 Views
4 Replies
Message 1 of 5

creating sphere with temporary BRep manager

Anonymous
Not applicable

Hello,

 

I am migrating some of my design to use of temporary BRep manager in baseFeature.

At createSphere() api, I noticed that sphere created at non-origin point jumps to origin right after finishEdit() is called.

 

Is there anyone who experienced the same issue ? I would appreciate if someone could help me out.

An example script is attached. In this example sphere at (5,0,0) jumps to (0,0,0)

Accepted solutions (1)
935 Views
4 Replies
Replies (4)
Message 2 of 5

kandennti
Mentor
Mentor
Accepted solution

@Anonymous さん こんにちは

 

I was able to reproduce it as well.

After running the script, the body position in question and the "Canter of Mass" value are clearly different.

1.png

 

Once saved and then reopened the document, the body appears to be in the correct position.

2.png

This is probably a display bug.

 

If you're in a hurry, since "temporaryBRepManager.transform" seems to be working, you'll have no choice but to create such a function to deal with it.

def initTmpBrepSphere(
    center :adsk.core.Point3D,
    radius :float) -> adsk.fusion.BRepBody:

    tmpMgr = adsk.fusion.TemporaryBRepManager.get()
    pntZero = adsk.core.Point3D.create(0, 0, 0)
    sphere = tmpMgr.createSphere(pntZero, radius)

    if pntZero.isEqualTo(center):
        return sphere

    vec = pntZero.vectorTo(center)
    mat = adsk.core.Matrix3D.create()
    mat.translation = vec

    tmpMgr.transform(sphere, mat)

    return sphere
Message 3 of 5

kandennti
Mentor
Mentor
0 Likes
Message 4 of 5

Anonymous
Not applicable
 Hi @kandennti 
 

 

Your workaround solution works, thank you very much for solving the problem so quickly!

0 Likes
Message 5 of 5

BrianEkins
Mentor
Mentor

I also recently ran into this problem and have been told it's been fixed and we should see it in the next big update.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com