MACRO:Work Feature 2014_12

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
ThierryM
Posts: 25
Joined: Tue Mar 04, 2014 2:51 am
Location: Les Corbières, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by ThierryM »

Hi Rentlau_64,
Thanks for your work.
I've installed the last version and tried the new cutting tool but I 've an error... but I don't know why :D
Sélection_105.png
Sélection_105.png (102.41 KiB) Viewed 3037 times
I join the file for curious people ;) .
OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4587 (Git)
Branch: master
Hash: aeabffeed8f26402e278662310deac5c7cbed05e
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
Regards,
Thierry
Attachments
Ventilo_Hotend.fcstd
File
(26.61 KiB) Downloaded 78 times
Linux Mint 21.2, 64 bits, Freecad 0.21
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

ThierryM,

Yes I got the same error message...
You need to define a plane extending outside object limit (ie one of the Planes of the object's bounding box) and a line also extending across the object to cut the object in two parts.

See Your file updated:
Ventilo_Hotend.fcstd
(35.84 KiB) Downloaded 78 times

Regards

Rentlau_64
User avatar
ThierryM
Posts: 25
Joined: Tue Mar 04, 2014 2:51 am
Location: Les Corbières, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by ThierryM »

Thanks Rentlau_64 for your explanations and the corrections on my file.
Regards,
Thierry
Linux Mint 21.2, 64 bits, Freecad 0.21
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

Thierry,

In fact you pointed a lack in my cutting tool...now I corrected and even with your first file we are now able to cut the Cone.

I will put the fix on Github soon.

Rentlau_64
User avatar
ThierryM
Posts: 25
Joined: Tue Mar 04, 2014 2:51 am
Location: Les Corbières, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by ThierryM »

Rentlau_64,
Happy to have pointed a lack... involuntarily :lol:
Regards,
Thierry
Linux Mint 21.2, 64 bits, Freecad 0.21
JoseAntonioGutierrez
Posts: 4
Joined: Tue Feb 17, 2015 12:35 pm

Re: MACRO:Work Feature 2014_12

Post by JoseAntonioGutierrez »

Hello everyone and thanks for your excelent work improving FreeCAD. This WorkFeature is excelent and very productive. ;)
I have some questions:
- I can´t find the cut tool when I install this Macro.
- How can I proyected (or an intersection) a point created in 3D view in a Sketch for work in it? I can proyect it in a plane but when I do a sketch in this plane I can't access to this point for work with it .

Thanks again!!
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

JoseAntonioGutierrez,

If you get the MACRO from https://github.com/Rentlau/WorkFeature.git

You migth find the Cutting tool in the Modif. left tab (last one on the left)
CuttingTool.png
CuttingTool.png (45.06 KiB) Viewed 2948 times
- How can I proyected (or an intersection) a point created in 3D view in a Sketch for work in it? I can proyect it in a plane but when I do a sketch in this plane I can't access to this point for work with it .
Yes I know and I do not have any turn around right now to transform a Point into a Sketch point???

If someone know how to do it I can inroduce this useful function into th WF MACRO

Regards

Rentlau_64
JMG
Posts: 287
Joined: Wed Dec 25, 2013 9:32 am
Location: Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by JMG »

Hello.
Yes I know and I do not have any turn around right now to transform a Point into a Sketch point???

If someone know how to do it I can inroduce this useful function into th WF MACRO
I worked at this some time ago, this is what I have:

Code: Select all

Sk = Gui.Selection.getSelection()[0]
Point = Gui.Selection.getSelectionEx()[1].SubObjects[0]

rec = Part.makePlane(1,1)
rec.Placement = Sk.Placement
recN = rec.normalAt(0,0)

VpP = Point.Point

Projection = VpP.projectToPlane(Sk.Placement.Base, recN)
Select a sketch, one point of an object and copy-paste at command line.

Variable "Projection" contains the coordinates of the projected point over the sketch plane.
If someone knows how to convert this to local sketch coordiantes( X,Y,0), you have the tool.


Javier.
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

JoseAntonioGutierrez, Javier,

Thank you Javier for your answer, I guess I found to complete your piece of code;
So JoseAntonioGutierrez, when you want to transform a Point created by the WF MACRO into a Sketch Point you need the following command:

Code: Select all

# Select a Skecth first and a Point on the view

# Get the Sketch from the selection
Sk = Gui.Selection.getSelection()[0]
# Get the Point from the selection
Point = Gui.Selection.getSelectionEx()[1].SubObjects[0]
# Get the Sketch Plane info
rec = Part.makePlane(1,1)
rec.Placement = Sk.Placement
recN = rec.normalAt(0,0)
# Get the Point
VpP = Point.Point
# Projection of the Point selected onto the Sketch Plane
Projection = VpP.projectToPlane(Sk.Placement.Base, recN)
# Build a geometry list
geoList = []
# Append the Projection
geoList.append(Part.Point(Projection))
# Add the geometry list to the Sketch
Sk.addGeometry(geoList)
I will add buttons into the WF MACRO for all piece of geometry created in order you can transfert them into the Sketch selected.

Rentlau_64
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: MACRO:Work Feature 2014_12

Post by bill »

Bonjour Rentlau_64,

Great Effort!

This MACRO:WorkFeature is "da bomb". If you dont know this expression, it is slang for, how you say (please excuse my French) La Meilleure Macro, No?

Not only is it nicely designed, functional, and productive, it provides a great tool for doing ad-hoc measurements and alignment checks at your finger tips without digging through multiple buttons and screens. It is a great tool for those people (including architects and engineers) not versed in FreeCAD.

It works well; check following.
WFeat_2.jpg
WFeat_2.jpg (57.41 KiB) Viewed 2884 times

User:rockn is right on track concerning the organization/management of MACROs; there needs to be some kind of Macro Installation "Convention" or "Best Practices" to manage files/folders to mitigate the duplication of similarly names.

If not too difficult, is it possible you might consider including; IsParallel, IsPerpendicular, and IsSamePlane, to quickly check object alignments during model analysis and assembly/placement.

For button labels, I would suggest relying on the "hover description", unless required, as is done in the rest of FreeCAD; small and concise.

Did I mention Great Effort! Cant say it enough!


Regards, bill
Post Reply