Delete faces of imported step geometry

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!
cad_man

Delete faces of imported step geometry

Postby cad_man » Tue Jul 12, 2011 9:50 am

Hi all,

I'm just beginning to use FreeCAD and I have a relatively simple question:

Is it possible to delete faces from an imported step file?
There is just one block in the file from which I need to delete certain faces. I can select them, but when I hit delete, the whole object is gone :-(

Thank you very much in advance for your help!
wmayer
Site Admin
Posts: 14774
Joined: Thu Feb 19, 2009 10:32 am

Re: Delete faces of imported step geometry

Postby wmayer » Tue Jul 12, 2011 2:25 pm

There is currently no function inside FreeCAD to achieve this. But you can try the little Python script below which filters out the selected faces and creates a new object.

Code: Select all

# Get object with selected elements
s=Gui.Selection.getSelectionEx()
s=s[0]

# Check for faces and store the their id's
numbers=[]
for i in s.SubElementNames:
    numbers.append(int(i.replace("Face","")))

# revert sorted list to remove the elements from list
numbers.sort()
numbers.reverse()
faces=s.Object.Shape.Faces

# remove the elements 
for i in numbers:
    faces.remove(faces[i-1])

# create a new object
shell=Part.Shell(faces)
Part.show(shell)
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Delete faces of imported step geometry

Postby pperisin » Tue Jul 12, 2011 2:35 pm

You can also use draft down arrow to explode solid to faces. after that faces can be deleted.

Regards
Petar
cad_man

Re: Delete faces of imported step geometry

Postby cad_man » Wed Jul 13, 2011 8:39 am

Hello,

thank you very much for your swift replies!
In the meantime I've found out that the following also works (it creates a new object out of the selected items, just as wmayer suggested):

Code: Select all

import Part
for o in Gui.Selection.getSelectionEx():
	Part.show(Part.Compound(o.SubObjects))
# Flächen, die man braucht, muss man vorher auswählen. (Strg gedrückt halten und anklicken)
cad_man

Re: Delete faces of imported step geometry

Postby cad_man » Wed Jul 13, 2011 8:55 am

Just an addition to Petar's suggestion: that also works fine, the downside of this method is that I have to create a mesh afterwards and for exporting that to stl I need a single object. That can be done with the "arrow up", but with my rather slow pc the process is running since ten minutes and no end in sight ;)
User avatar
yorik
Site Admin
Posts: 11496
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Delete faces of imported step geometry

Postby yorik » Wed Jul 13, 2011 1:30 pm

The thing is, with your method above, you create a compound which is just a list of non-related shape elements. For example, in a compound, two faces that have one edge exactly at the same place won't share that edge (they will be two separate edge elements). What the up arrow command tries to do, however, is to fuse the components together, so that edge becomes one edge, shared by 2 faces. That's obviously why it takes much longer, there is much more calculation.

But that command is not too optimized for large face sets, it fuses faces one by one, which probably can take an eternity (it was made primarily for simple 2D wires). Werner's method above (use makeShell() method on a faces list) is probably the best solution: there will be only one operation, and you'll get a better model than a compound. You can maybe try simply changing your

Code: Select all

Part.show(Part.Compound(o.SubObjects))
with:

Code: Select all

Part.show(Part.makeShell(o.SubObjects))
In the meanwhile I'll change the up arrow command so it uses another method when there are a lot of faces...
simplemind
Posts: 8
Joined: Fri May 10, 2019 1:43 pm

Re: Delete faces of imported step geometry

Postby simplemind » Fri May 10, 2019 2:10 pm

This may be an old thread, but it's the exact topic I have a need for.

Running with:
FreeCAD V0.17
Ver 13541 GIT
Win64-7

OK, I have a STEP file of a solid model that represents the internal air volume of a plastic duct of 2-meters long. The model needs to be simplified by removing the tiny blends and other irregular solid faces. In most CAD systems, this is a simple 'delete face' on those blend faces per each blend path. The result is the model looking as if the blend was not ever added.

Why is this important? It greatly helps preparing a CAD model for CFD. It will remove the tiny blends under 5mm in radius and allows the model better meshing and faster computing runs. This would really help the cfdOF module too.

In the past, I had used NX with it's synchronous ability to edit these out in lightening speed. Then SolidWorks 2008 with the same kernel added this functionality. Creo is very lame at this and buggy, but it'a all I have right now and I'm now frustrated beyond all mental ability with it. LOL ANSYS has a tool called SpaceClaim that so far is the ultimate best, but it's very expensive for my once every 2 years need.

With all that said, has FreeCAD a module now with direct 3D solid editing functionality??? I didn't see anything in the OpenSCAD or may had missed something in that module. I tried the downgrade mentioned in this thread, but when editing out the blend faces, it made the 3D model with holes! OUCH.

Spaceclaim has a FREE version called DesignSpark. The downside is, it's a major watered down version of functionality and reads in STEP files, but the data is then read-only with all of the editing functions turned off.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Delete faces of imported step geometry

Postby jmaustpc » Fri May 10, 2019 4:46 pm

Your first post, welcome. :)
simplemind wrote:
Fri May 10, 2019 2:10 pm
Running with:
FreeCAD V0.17

your FreeCAD version is now obsolete. My version below is the daily dev snapshot version, but 0.18.1 is the current release version and 0.18.1 has a new feature to do what you want, it works in simple case but sometimes may struggle on complex cases. It for example removes a fillet from a solid. See Part WB ...Part menu ....Defeaturing.


let us know how you go. If you get stuck and can share the file, attach it here and some of the regulars will have a look and see if we can help.


Jim



OS: Kubuntu 18.04.2 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Delete faces of imported step geometry

Postby jmaustpc » Fri May 10, 2019 4:48 pm

here is a link to the wiki page for more details. Part_Defeaturing
simplemind
Posts: 8
Joined: Fri May 10, 2019 1:43 pm

Re: Delete faces of imported step geometry

Postby simplemind » Fri May 10, 2019 7:58 pm

Jim,

Thank you so much for a very quick response!

I had spent a few years on release 0.16 and at the start of the year jumped to 0.17. Very glad to hear about the new capability. Looking forward to giving it a try.