Features for money?

Post here if you have a FreeCAD-related job to offer to the FreeCAD community. This can include programming or modeling.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
keithsloan52
Veteran
Posts: 2753
Joined: Mon Feb 27, 2012 5:31 pm

Re: Features for money?

Post by keithsloan52 »

Slight mode to Macro.

Now hides the original objects so you see the result, they are still there for further operations.
CutwithLinks.FCMacro
(1.11 KiB) Downloaded 49 times
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Features for money?

Post by dprojects »

ISwearImCool wrote: Thu Aug 11, 2022 4:05 pm That is very slick looking. I wonder if there would be a way to automatically generate clones to do the cutting while preserving the panels as top level items, just so as to make the tree more manageable.
It is total prototype, just to show if this can be improved. Clone objects are not good, because they not keep colors I guess. Maybe it has been fixed at FreeCAD I don't know, But it's depend what type of object will be used. If you use only Cubes you can just create new Cube object, or like keithsloan52 show you the Links. It is dependent how you want to use it.

However, I will add such feature to the workbench and not charge anyone for that. I think it will be good added value for the woodworking tasks. I will also add possibility to make joints with this way. If you make joints you don't need copy of the object, right? only if you want to remove the common part of elements. So maybe I will make some kind of Drill Bit - joint and this will be simple box that will be able to cut pockets in the selected part. I was thinking to just make Cube copy but if you want Clone, maybe this would be better.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
keithsloan52
Veteran
Posts: 2753
Joined: Mon Feb 27, 2012 5:31 pm

Re: Features for money?

Post by keithsloan52 »

dprojects wrote: Thu Aug 11, 2022 5:45 pm Clone objects are not good, because they not keep colors I guess. Maybe it has been fixed at FreeCAD I don't know, But it's depend what type of object will be used.
Clone's create new objects, depending on FreeCAD options they will therefore be allocated a new colour, it is NOT a bug !!! that is why in this scenario one should use links rather than clones.
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Features for money?

Post by dprojects »

keithsloan52 wrote: Thu Aug 11, 2022 5:57 pm Clone's create new objects, depending on FreeCAD options they will therefore be allocated a new colour, it is NOT a bug !!! that is why in this scenario one should use links rather than clones.
OK, so it is up to you guys, I can even add two icons, one will be with Clone and one will be with Links. But any idea for naming schema? The final cut should have the Base first selected object Label? any additional info at label?

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
ISwearImCool
Posts: 8
Joined: Tue Feb 01, 2022 2:23 am

Re: Features for money?

Post by ISwearImCool »

@dprojects I would call it "joint cutter" with the alt text being "select a base object then cmd/cntrl click the objects you want to cut into it."

@keithsloan52 that's pretty cool. That's basically half way to what I was wanting initially before I went down this cut hierarchy rabbit hole. I have very little idea about coding unfortunately lol. I did make one modification attached below based on what I could easily understand. One thing I don't understand is say in parts if I make a sphere and then cut into a square it works fine, but if I've moved the sphere over, it cuts at the origin still, whereas booleans don't.

phpBB [video]


Here's a test file:

https://www.dropbox.com/s/rifum3ua0b2xd ... FCStd?dl=0

Also, do you know how to turn macros into buttons?

My one change:

Code: Select all

import FreeCAD


def addObject(parent, obj):
    #print(f'Parent {parent}')
    if parent is None:
         return doc.copyObject(obj)
    else:
         #print(f'Add object to {parent.Name}')
         return parent.addObject(doc.copyObject(obj))[0]


def getParent(obj):
       if hasattr(obj, 'InList'):
           for i, o in enumerate(obj.InList):
               if o.TypeId == 'App::Part':
                   return obj.InList[i]
       return App.ActiveDocument
               

def createLink(obj):
       parent = getParent(obj)
       lnkObj = parent.addObject("App::Link", "Link_"+obj.Label)
       lnkObj.LinkedObject = obj
       return lnkObj


def booleanCut(obj0, obj1):
      parent = getParent(obj0)
      newCut = parent.addObject("Part::Cut","Cut-"+obj0.Label+'-'+obj1.Label)
      newCut.Base = obj0
      newCut.Tool = obj1
      
     

doc = App.ActiveDocument
sel = Gui.Selection.getSelection()
if len(sel) ==  2:
    obj0 = sel[0]
    obj1  = sel[1]
    lnk0 = createLink(obj0)
    lnk1 = createLink(obj1)
    booleanCut(lnk0, lnk1)
    obj0.Visibility = False
obj1.Visibility = True

Code: Select all

doc.recompute()
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Features for money?

Post by dprojects »

ISwearImCool wrote: Thu Aug 11, 2022 7:55 pm @dprojects I would call it "joint cutter" with the alt text being "select a base object then cmd/cntrl click the objects you want to cut into it."
I already added this to the workbench. The joints are simple boxes and they was added with magicFixture. The magicFixture create Link so this is why the joints has Link at label.

I plan to add also some kind of "drill bit - joint" to have predefined joint, but what kind of joint you use? what sizes? this should calculate the wood thickness and make offset? for example if the wood is 20 mm thickness the joint should be 10 mm ?

Let me know if you want to add something more or change. The descriptions, info screens can be changed. If you click the icon there will be some kind of tutorial info how to use it.

EDIT:

I use to cut copies of the objects, so the original object not change place. the final Cut is named "Cut, base object label". All other cuts have numbers. Also the objects copies has prefix "copy, ". The tool is named magicCut

To copy objects I use .copyObject I am not sure if this is good idea or not.

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
keithsloan52
Veteran
Posts: 2753
Joined: Mon Feb 27, 2012 5:31 pm

Re: Features for money?

Post by keithsloan52 »

ISwearImCool wrote: Thu Aug 11, 2022 7:55 pm Also, do you know how to turn macros into buttons?
See https://wiki.freecadweb.org/Customize_Toolbars
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Features for money?

Post by dprojects »

keithsloan52 wrote: Fri Aug 12, 2022 7:50 am
ISwearImCool wrote: Thu Aug 11, 2022 7:55 pm Also, do you know how to turn macros into buttons?
See https://wiki.freecadweb.org/Customize_Toolbars
The code for the tool is here: magicCut() but the main part of the code which do all the job is here: makeCuts(iObjects) it not uses the library and it could be standalone macro but I plan to use it in tools.

However, if anybody want to use it as macro, it is no problem with it, you can copy this, MIT license allow for that. It is worth to add it as standalone macro to https://wiki.freecadweb.org/Macros_recipes ?

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
ISwearImCool
Posts: 8
Joined: Tue Feb 01, 2022 2:23 am

Re: Features for money?

Post by ISwearImCool »

However, if anybody want to use it as macro, it is no problem with it, you can copy this, MIT license allow for that. It is worth to add it as standalone macro to https://wiki.freecadweb.org/Macros_recipes ?
I think so. It's a really nice feature that could be used by more than just woodworkers.

Thank you for making it!
User avatar
dprojects
Posts: 720
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Features for money?

Post by dprojects »

ISwearImCool wrote: Sat Aug 13, 2022 2:08 pm I think so. It's a really nice feature that could be used by more than just woodworkers.
Thank you for making it!
OK. I will see. I already making some improvements to support better "cut" elements. Also I plan to add joinery section to the toolbar to make some more tools for the real woodworkers, carpentry. It would be nice to have a chisel, but it might be a problem to be able to shape the element ;-)

I know that the raw wood woodworkers usually not use screws and chipboards and they use joints. Screws and chipboards are usually cheap industrial style. My neighbor from the garage once boasted to my father that he had made a house on a plot of wood without the use of a nail. I see you probably are the type of woodworker so you are familiar with this type of woodwork, so you can always write down what types of problems you encounter at FreeCAD. So maybe it is worth to improve this part of woodworking, too.

We can continue discussion about most used joints types by you at your first post: Struggling with Assembling My Parts or Cabinet furniture design tools workbench or maybe at any other specially dedicated topic for raw wood woodworkers and joinery.

EDIT:

The macro is here: https://wiki.freecadweb.org/Macro_multiCuts

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply