PartDesign Hole feature

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Post Reply
eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

PartDesign Hole feature

Post by eivindkvedalen » Mon Jan 16, 2017 6:44 pm

Rebased to current master at https://github.com/eivindkv/FreeCAD/tree/FeatureHole

Holes are defined by one or more circle in a sketch. The sizes of the circles are ignored, and hole parameters are completely controlled by properties; the circles are only used for positioning.

Most likely not complete, and feedback is always appreciated.

Eivind

User avatar
sgrogan
Posts: 5421
Joined: Wed Oct 22, 2014 5:02 pm

Re: PartDesign Hole feature

Post by sgrogan » Wed Jan 18, 2017 1:51 am

First Impression...WOW :shock:
There is a lot here. Is the thread information somehow passed to TechDraw for example? Haven't tested this yet. too many properties to explore.
This is going to be extremely useful!
hole.png
hole.png (147.01 KiB) Viewed 3604 times
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9663 (Git)
Build type: Unknown
Branch: FeatureHole
Hash: f4fab7c79b002aa96e97c27c2dd0b9f19b6af3dc
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.9.1.oce-0.18-dev

chrisb
Posts: 18911
Joined: Tue Mar 17, 2015 9:14 am

Re: PartDesign Hole feature

Post by chrisb » Wed Jan 18, 2017 4:07 pm

At first glance I thought who the hell needs this, a circle defines a hole and that's enough. But with all these additional "features" it rather seems to be the other way round: Who needs circles any longer? Thanks!

ickby
Posts: 2922
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Hole feature

Post by ickby » Wed Jan 18, 2017 4:18 pm

Nic work Eivind!

a few things about usability, feel free to ignore at will.

1. Could this be made to also work with points in sketches? As the circle radius is ignored anyway, it is easier to get a fully constraint sketch with single points.
2. While playing I intuitively thougth the holes are placed like the primitives, with the attachment code. One at a time. I personally would find that a usefull method to have next to sketches (which are obvisoly better for multiple holes). Would it be possible to either support both methods or have a second hole feature which is placed with attachments?

eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: PartDesign Hole feature

Post by eivindkvedalen » Thu Jan 19, 2017 12:14 am

ickby wrote:Nic work Eivind!
Thanks!

ickby wrote:1. Could this be made to also work with points in sketches? As the circle radius is ignored anyway, it is easier to get a fully constraint sketch with single points.
Sketcher points don't create any vertices do they? Currently I iterate through the actual shape to get the circles. My initial implementation required an actual sketch, so to be able to use points (which I tend to agree is better), I would need to required a sketch again, and then look for point objects in the sketch.
ickby wrote: 2. While playing I intuitively thougth the holes are placed like the primitives, with the attachment code. One at a time. I personally would find that a usefull method to have next to sketches (which are obvisoly better for multiple holes). Would it be possible to either support both methods or have a second hole feature which is placed with attachments?
I've just implemented the missing bits in the already existing FeatureHole class in PartDesign. I can see that this is a bit limiting, as it forces you to use PartDesign for the part. I'll see if I can come up with a refactoring of the code that can place much of the geomtry in the Part module. Another thing; wouldn't this be the first then of "negative" objects. These also need to cut into objects they attach to. Do we have support for that? A manual cut after the attachment isn't very elegant...

Eivind

eivindkvedalen
Posts: 598
Joined: Tue Jan 29, 2013 10:35 pm

Re: PartDesign Hole feature

Post by eivindkvedalen » Thu Jan 19, 2017 12:16 am

sgrogan wrote:First Impression...WOW :shock:
Thanks!
sgrogan wrote: There is a lot here. Is the thread information somehow passed to TechDraw for example? Haven't tested this yet. too many properties to explore.
This is going to be extremely useful!
It's not passed to TechDraw as of now, but I think this should be fairly easy to implement (without having looked at the code), as all the hole data are available as properties.

Eivind

User avatar
sgrogan
Posts: 5421
Joined: Wed Oct 22, 2014 5:02 pm

Re: PartDesign Hole feature

Post by sgrogan » Thu Jan 19, 2017 12:26 am

eivindkvedalen wrote:Thanks!

sgrogan wrote:
There is a lot here. Is the thread information somehow passed to TechDraw for example? Haven't tested this yet. too many properties to explore.
This is going to be extremely useful!



It's not passed to TechDraw as of now, but I think this should be fairly easy to implement (without having looked at the code), as all the hole data are available as properties.
Thank You!, threads handled by meta-data or properties will be great. Accurate 3d threads are unnecessary for me, I usually just model the tap drill. I do like @ickby's idea about using points. I've just been making all circle radii equal and constraining one to a small random value. I'm still experimenting, but this is very good.
I'll try to post some win builds for more testing but on Ubuntu it works very well.

ickby
Posts: 2922
Joined: Wed Oct 05, 2011 7:36 am

Re: PartDesign Hole feature

Post by ickby » Thu Jan 19, 2017 4:20 am

eivindkvedalen wrote:
I've just implemented the missing bits in the already existing FeatureHole class in PartDesign. I can see that this is a bit limiting, as it forces you to use PartDesign for the part. I'll see if I can come up with a refactoring of the code that can place much of the geomtry in the Part module. Another thing; wouldn't this be the first then of "negative" objects. These also need to cut into objects they attach to. Do we have support for that? A manual cut after the attachment isn't very elegant...
Eivind
In Part Design there is a AddSub object from which also the subtracrive primitives derived that handle the Cut.

Imho such a high level feature should not be in Part workbench. Part ist for basic, lowlevel Operations. Geometry creation and booleans etc. A hole Feature ist more high level, it always needs a Solid, it automatically needs to subtract, it needs attached Sketch and than changes the Sketch Base... It does not fit at all in the Part Workflow, but very well in Part Design. Also it is not pimiting having it in PD only, you can usw every Part Solid as Base feature for a Body.

akredd
Posts: 22
Joined: Wed Mar 19, 2014 8:31 pm
Location: D-02733 Cunewalde

Re: PartDesign Hole feature

Post by akredd » Thu Jan 19, 2017 6:55 pm

Hallo all,
that is well done work!! :)
To explain my annotations, at first some words about me. I stopped coding (Pascal) in 1995 (my fault :( ). All the time since 1982 I worked as a designer for tool machines. Freecad I joined 2014 for testing, Now I attend to use it for a small private project. Now my questions:
Is it possible to have an axis (datum) in that features that could be shown in TechDraw later and that could be used as reference for positioning screws in a future assembly? I don't see any... (may be I have to change some properties)

I think that it should be better to collect the standard informations (as in Standard.py) in a file like a LibreOfficeCalc-document or anything similar. When changing the standard it could be easier tu update such a file than code-lines. Otherwise than it could be possible (with some rules for naming that files) to implement "user-specific" files for non-standard holes or even factory-specific holes. What do you think about that.
At least a small hint: Row3 as in DIN 974-1:1991-05 is deleted in DIN 974-1:2008-02, because DIN 7980 "Federringe für Zylinderschrauben" is not valid any more. How should we handle this?

Andreas

OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9663 (Git)
Build type: Unknown
Branch: FeatureHole
Hash: f4fab7c79b002aa96e97c27c2dd0b9f19b6af3dc
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

akredd
Posts: 22
Joined: Wed Mar 19, 2014 8:31 pm
Location: D-02733 Cunewalde

Re: PartDesign Hole feature

Post by akredd » Thu Jan 19, 2017 7:02 pm

sorry...
Just now I see, that you recognized the absence of DIN 7980. One should read the code until the end ...

Post Reply