Sheetmetal gives "Part Face" object has no attribute "CenterOfGravity"

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: Sheetmetal gives "Part Face" object has no attribute "CenterOfGravity"

Post by Roy_043 »

PAS_Drafter
Posts: 339
Joined: Mon Aug 02, 2021 6:29 am
Location: California, USA

Re: Sheetmetal gives "Part Face" object has no attribute "CenterOfGravity"

Post by PAS_Drafter »

Syres wrote: Tue Aug 02, 2022 6:41 pm It's not a difficult fix (as long as it doesn't cause other regressions).
Hey, I just wanted to say, the problem came back. I went back and doublechecked the SheetMetalCmd.py file to make sure the changes you recommended were still there.

It seems to happen on files that I open that already were "bent" with the previous version of sheetmetal.

I went back and looked at Roy's fix and noticed a few more lines than what you provided. I modified my file with the same changes and reopened the file that gave me the error and it went away. Maybe it is fixed now. I'll keep playing with it. If I keep having problems I'll just go to v.20.

Code: Select all

    if hasattr(selFace, "CenterOfGravity") and hasattr(lenEdge.Curve, "projectPoint"):
      pThkDir1 = selFace.CenterOfGravity
      pThkDir2 = lenEdge.Curve.projectPoint(pThkDir1, "NearestPoint")
      thkDir = pThkDir1.sub(pThkDir2).normalize()
    elif hasattr(selFace, "CenterOfGravity") and not hasattr(lenEdge.Curve, "projectPoint"):
       pThkDir1 = selFace.CenterOfGravity
       pThkDir2 = lenEdge.Curve.value(lenEdge.Curve.parameter(pThkDir1))
       thkDir = pThkDir1.sub(pThkDir2).normalize()
    else:
      thkDir = Cface.normalAt(0,0) * -1
Thanks for your help!
PAS_Drafter
Posts: 339
Joined: Mon Aug 02, 2021 6:29 am
Location: California, USA

Re: Sheetmetal gives "Part Face" object has no attribute "CenterOfGravity"

Post by PAS_Drafter »

Well, that didn't last long. I did a recompute and the error returned.
Syres
Veteran
Posts: 2900
Joined: Thu Aug 09, 2018 11:14 am

Re: Sheetmetal gives "Part Face" object has no attribute "CenterOfGravity"

Post by Syres »

PAS_Drafter wrote: Wed Aug 03, 2022 9:06 pm Well, that didn't last long. I did a recompute and the error returned.
Completely deinstall Sheet metal Wb (because you've made manual changes) and reinstall from scratch so you'll get the correct update applied today.
Post Reply