i'm a newbie of freeCAD, and CAD...
i have a STL file, i need to know some normal vector of surfaces,
after lots of Google, here is my answer:
Gui.Selection.getSelectionEx()[0].SubObjects[0].Faces[0].normalAt(0,0).
But when i open my STL file, i cannot choose a surface by mouse?
what should i do?
Thank you very much!
how to get the normal vector of a suface from a STL file
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 2
- Joined: Tue May 14, 2019 7:17 am
how to get the normal vector of a suface from a STL file
- Attachments
-
- ufo.zip
- (139.91 KiB) Downloaded 18 times
Re: how to get the normal vector of a suface from a STL file
Try this:
If you are done then run:
Code: Select all
def getNormal(cb):
if cb.getEvent().getState() == coin.SoButtonEvent.UP:
pp = cb.getPickedPoint()
if pp:
vec = pp.getNormal().getValue()
index = coin.cast(pp.getDetail(), "SoFaceDetail").getFaceIndex()
print ("Normal: {}, Face index: {}".format(str(vec), index))
from pivy import coin
meth=Gui.ActiveDocument.ActiveView.addEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), getNormal)
If you are done then run:
Code: Select all
Gui.ActiveDocument.ActiveView.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), meth)
Re: how to get the normal vector of a suface from a STL file
#documentation
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Posts: 2
- Joined: Tue May 14, 2019 7:17 am
Re: how to get the normal vector of a suface from a STL file
got it, need use part
Re: how to get the normal vector of a suface from a STL file
I'm pretty sure this post will be highly useless if one has the same problem and land here...
Re: how to get the normal vector of a suface from a STL file
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.