Part Chamfer: Difference between revisions

From FreeCAD Documentation
(Added "Properties" section and "Scripting" section. Shrunk size of Part_Chamfer-Dialog.jpg a bit so it looks better.)
mNo edit summary
(25 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:18-->
{{Docnav
|[[Part_SectionCross|Cross sections]]
|[[Part_Mirror|Mirror]]
|[[Part_Module|Part]]
|IconL=Part_CrossSections.svg
|IconC=Workbench_Part.svg
|IconR=Part_Mirror.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand|Name=Part Chamfer|MenuLocation=Part → Chamfer|Workbenches=[[Part Module|Part]], Complete|SeeAlso=}}
|Name=Part Chamfer
|MenuLocation=Part → Chamfer
|Workbenches=[[Part Module|Part]]
|SeeAlso=[[Part Fillet|Part Fillet]]
}}


==Description== <!--T:2-->
==Description== <!--T:2-->
Line 7: Line 23:


<!--T:5-->
<!--T:5-->
[[Image:Dialog-chamfer.jpg|500px|Dialog-chamfer]]
[[Image:Chamfer-example.png|Chamfer example]]

==Usage== <!--T:24-->


==How to Use== <!--T:3-->
<!--T:3-->
# Press the {{KEY|[[Image:Part_Chamfer.svg|30px]]}} button from the [[Part_Workbench|Part Workbench]]. Alternatively, you can select {{MenuCommand|Part → Chamfer}}.
# Invoke the Chamfer command several ways in the [[Image:Workbench_Part.svg|24px]] [[Part_Workbench|Part Workbench]]
#* Press the {{KEY|[[Image:Part_Chamfer.svg|30px]]}} button in the Part toolbar
#* Use the {{MenuCommand|Part → Chamfer}} entry in the Part menu
# Select the shape to chamfer from the dialog.
# Select the shape to chamfer from the dialog.
# Select edges to chamfer by checking the corresponding box in the chamfer dialog or by selecting them on the model directly.
# Select edges to chamfer by checking the corresponding box in the chamfer dialog or by selecting them on the model directly.
# Edit chamfer parameters.
# Edit chamfer parameters.
# Press OK to close the chamfer dialog and apply the chamfer.
# Press {{Button|OK}} to close the chamfer dialog and apply the chamfer.


==Options== <!--T:4-->
==Options== <!--T:4-->
[[Image:Dialog-chamfer.png|Dialog-chamfer]]
* When selecting edges on the model, you have the option to select by edge or by face. Selecting by face can be more efficient in many situations.
* When selecting edges on the model, you have the option to select by edge or by face. Selecting by face will select all bordering edges of that face.
* Constant length chamfer or variable length chamfer.
* Constant length chamfer or variable length chamfer.
** A constant length chamfer will create a chamfer with edges equidistant to the original edge at the distance specified.
** A constant length chamfer will create a chamfer with edges equidistant to the original edge at the distance specified.
** A variable length chamfer will have edges that may be set to different distances from the original edge, allowing you to create a chamfer at a variable angle.
** A variable length chamfer will have edges that may be set to different distances from the original edge, allowing you to create a chamfer at a variable angle.


==Properties==
==Properties== <!--T:6-->
[[Image:Part_Chamfer-Properties.jpg|left|Part_Chamfer Properties]]
[[Image:Part_Chamfer-Properties.png|left|Part_Chamfer Properties]]


<!--T:7-->
{{Properties_Title|Base}}
{{Properties_Title|Base}}
*{{PropertyData|Base}}: The shape onto which the chamfer is to be applied.
*{{PropertyData|Base}}: The shape onto which the chamfer is to be applied.
*{{PropertyData|Placement}}: Specifies the orientation and position of the shape in the 3D space.
*{{PropertyData|Placement}}: Specifies the orientation and position of the shape in the 3D space.
*{{PropertyData|Label}}: Label given to the object. Change to suit your needs.
*{{PropertyData|Label}}: Label given to the object. Change to suit your needs.
{{clear}}


==Limitations== <!--T:22-->
<br clear=all>
Chamfer might do nothing if the result would touch or cross the next adjacent edge. So if you do not get the expected result, try with a smaller value. This is the same for [[Image:Part_Fillet.svg|24px]] [[Part Fillet|Part Fillet]].
==Scripting==
The Chamfer tool can by used in [[macros]] and from the python console by adding a Chamfer object to the document.


<!--T:23-->
<b>Example Script:</b>
Also note that the Chamfer feature is affected by the [[Topological_naming_problem|Topological naming problem]] when the any change is done to a modeling step earlier in the chain that affects the number of facets or vertices. This could cause unpredictable result. Until that is resolved (possibly with V0.19) it is advised to apply Chamfer and [[Image:Part_Fillet.svg|24px]] [[Part Fillet|Part Fillet]] operations at the last steps in the chain.
<syntaxhighlight>



==Scripting== <!--T:8-->
The Chamfer tool can by used in [[macros|macros]] and from the python console by adding a Chamfer object to the document.

<!--T:9-->
'''Example Script:'''

</translate>
{{Code|code=
import Part
import Part
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
Line 55: Line 90:
chmfr.Edges = myEdges
chmfr.Edges = myEdges
FreeCADGui.ActiveDocument.myCube.Visibility = False
FreeCADGui.ActiveDocument.myCube.Visibility = False
FreeCAD.ActiveDocument.recompute()
</syntaxhighlight>
}}
<translate>


<!--T:10-->
'''Example Script Explanation:'''


</translate>
<b>Example Script Explanation:</b>
{{Code|code=

<syntaxhighlight>
import Part
import Part
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
cube.Shape = Part.makeBox(5, 5, 5)
cube.Shape = Part.makeBox(5, 5, 5)
}}
</syntaxhighlight>
<translate>
*Creates a 5 mm cube. See [[Part_API]] for an explanation of the makeBox method.


<!--T:11-->
*Creates a 5 mm cube for us to apply chamfered edges to. See [[Part_API|Part_API]] for an explanation of the makeBox method.
</translate>


{{Code|code=
<syntaxhighlight>
chmfr = FreeCAD.ActiveDocument.addObject("Part::Chamfer", "myChamfer")
chmfr = FreeCAD.ActiveDocument.addObject("Part::Chamfer", "myChamfer")
}}
</syntaxhighlight>
<translate>
*Adds a new object to the document of type Chamfer (from the Part module) with label "myChamfer".


<!--T:12-->
*Adds a new object to the document of type Chamfer (from the Part module) with label "myChamfer".
</translate>


{{Code|code=
<syntaxhighlight>
chmfr.Base = FreeCAD.ActiveDocument.myCube
chmfr.Base = FreeCAD.ActiveDocument.myCube
}}
</syntaxhighlight>
<translate>

<!--T:13-->
*Specifies that the base shape of the chamfer object should be "myCube".
*Specifies that the base shape of the chamfer object should be "myCube".


</translate>

{{Code|code=
<syntaxhighlight>
myEdges = []
myEdges = []
myEdges.append((1, 1.5, 1.25)) # (edge number, chamfer start length, chamfer end length)
myEdges.append((1, 1.5, 1.25)) # (edge number, chamfer start length, chamfer end length)
Line 94: Line 141:
myEdges.append((11, 1.5, 1.25))
myEdges.append((11, 1.5, 1.25))
myEdges.append((12, 1.5, 1.25))
myEdges.append((12, 1.5, 1.25))
}}
</syntaxhighlight>
<translate>

<!--T:14-->
*Creates an empty array "myEdges" and then appends the array with each edge's chamfer parameters.
*Creates an empty array "myEdges" and then appends the array with each edge's chamfer parameters.
*Syntax for each item should be (edge#, chamfer start length, chamfer end length)
*Syntax for each item should be (edge#, chamfer start length, chamfer end length)


</translate>

{{Code|code=
<syntaxhighlight>
chmfr.Edges = myEdges
chmfr.Edges = myEdges
}}
</syntaxhighlight>
<translate>
<!--T:15-->
*Sets the Edges attribute of our Chamfer object equal to the array we just created.
*Sets the Edges attribute of our Chamfer object equal to the array we just created.
</translate>


{{Code|code=

<syntaxhighlight>
FreeCADGui.ActiveDocument.myCube.Visibility = False
FreeCADGui.ActiveDocument.myCube.Visibility = False
}}
</syntaxhighlight>
<translate>

<!--T:16-->
*This line simply hides "myCube" so that our newly created "myChamfer" object is the only one visible.
*This line simply hides "myCube" so that our newly created "myChamfer" object is the only one visible.


</translate>
{{Code|code=
FreeCAD.ActiveDocument.recompute()
}}
<translate>

<!--T:17-->
*Recomputes all altered components on the screen and refreshes the display.

<!--T:19-->
{{Docnav
|[[Part_SectionCross|Cross sections]]
|[[Part_Mirror|Mirror]]
|[[Part_Module|Part]]
|IconL=Part_CrossSections.svg
|IconC=Workbench_Part.svg
|IconR=Part_Mirror.svg
}}


</translate>
</translate>
{{Part Tools navi{{#translation:}}}}
{{clear}}
{{Userdocnavi{{#translation:}}}}
<languages/>

Revision as of 23:29, 25 February 2020

Part Chamfer

Menu location
Part → Chamfer
Workbenches
Part
Default shortcut
None
Introduced in version
-
See also
Part Fillet

Description

Chamfers the selected edge(s) of an object. A dialog allows you to choose which edge(s) to work on as well as modify various chamfer parameters.

Chamfer example

Usage

  1. Invoke the Chamfer command several ways in the Part Workbench
    • Press the button in the Part toolbar
    • Use the Part → Chamfer entry in the Part menu
  2. Select the shape to chamfer from the dialog.
  3. Select edges to chamfer by checking the corresponding box in the chamfer dialog or by selecting them on the model directly.
  4. Edit chamfer parameters.
  5. Press OK to close the chamfer dialog and apply the chamfer.

Options

Dialog-chamfer

  • When selecting edges on the model, you have the option to select by edge or by face. Selecting by face will select all bordering edges of that face.
  • Constant length chamfer or variable length chamfer.
    • A constant length chamfer will create a chamfer with edges equidistant to the original edge at the distance specified.
    • A variable length chamfer will have edges that may be set to different distances from the original edge, allowing you to create a chamfer at a variable angle.

Properties

Part_Chamfer Properties
Part_Chamfer Properties


Base

  • DataBase: The shape onto which the chamfer is to be applied.
  • DataPlacement: Specifies the orientation and position of the shape in the 3D space.
  • DataLabel: Label given to the object. Change to suit your needs.

Limitations

Chamfer might do nothing if the result would touch or cross the next adjacent edge. So if you do not get the expected result, try with a smaller value. This is the same for Part Fillet.

Also note that the Chamfer feature is affected by the Topological naming problem when the any change is done to a modeling step earlier in the chain that affects the number of facets or vertices. This could cause unpredictable result. Until that is resolved (possibly with V0.19) it is advised to apply Chamfer and Part Fillet operations at the last steps in the chain.


Scripting

The Chamfer tool can by used in macros and from the python console by adding a Chamfer object to the document.

Example Script:

import Part
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
cube.Shape = Part.makeBox(5, 5, 5)
chmfr = FreeCAD.ActiveDocument.addObject("Part::Chamfer", "myChamfer")
chmfr.Base = FreeCAD.ActiveDocument.myCube
myEdges = []
myEdges.append((1, 1.5, 1.25)) # (edge number, chamfer start length, chamfer end length)
myEdges.append((2, 1.5, 1.25))
myEdges.append((3, 1.5, 1.25))
myEdges.append((4, 1.5, 1.25))
myEdges.append((5, 1.5, 1.25))
myEdges.append((6, 1.5, 1.25))
myEdges.append((7, 1.5, 1.25))
myEdges.append((8, 1.5, 1.25))
myEdges.append((9, 1.5, 1.25))
myEdges.append((10, 1.5, 1.25))
myEdges.append((11, 1.5, 1.25))
myEdges.append((12, 1.5, 1.25))
chmfr.Edges = myEdges
FreeCADGui.ActiveDocument.myCube.Visibility = False
FreeCAD.ActiveDocument.recompute()

Example Script Explanation:

import Part
cube = FreeCAD.ActiveDocument.addObject("Part::Feature", "myCube")
cube.Shape = Part.makeBox(5, 5, 5)
  • Creates a 5 mm cube for us to apply chamfered edges to. See Part_API for an explanation of the makeBox method.
chmfr = FreeCAD.ActiveDocument.addObject("Part::Chamfer", "myChamfer")
  • Adds a new object to the document of type Chamfer (from the Part module) with label "myChamfer".
chmfr.Base = FreeCAD.ActiveDocument.myCube
  • Specifies that the base shape of the chamfer object should be "myCube".
myEdges = []
myEdges.append((1, 1.5, 1.25)) # (edge number, chamfer start length, chamfer end length)
myEdges.append((2, 1.5, 1.25))
myEdges.append((3, 1.5, 1.25))
myEdges.append((4, 1.5, 1.25))
myEdges.append((5, 1.5, 1.25))
myEdges.append((6, 1.5, 1.25))
myEdges.append((7, 1.5, 1.25))
myEdges.append((8, 1.5, 1.25))
myEdges.append((9, 1.5, 1.25))
myEdges.append((10, 1.5, 1.25))
myEdges.append((11, 1.5, 1.25))
myEdges.append((12, 1.5, 1.25))
  • Creates an empty array "myEdges" and then appends the array with each edge's chamfer parameters.
  • Syntax for each item should be (edge#, chamfer start length, chamfer end length)
chmfr.Edges = myEdges
  • Sets the Edges attribute of our Chamfer object equal to the array we just created.
FreeCADGui.ActiveDocument.myCube.Visibility = False
  • This line simply hides "myCube" so that our newly created "myChamfer" object is the only one visible.
FreeCAD.ActiveDocument.recompute()
  • Recomputes all altered components on the screen and refreshes the display.