Draft 2d offset
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Draft 2d offset
OS: Debian GNU/Linux 11 (bullseye) (LXDE/LXDE)
Word size of FreeCAD: 64-bit
Version: 0.20.26720 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 7bca26e)
Hash: 7bca26e7c14d4d43374ff7e0c8582735b249cbfd
Python version: 3.9.9
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: Russian/Russia (ru_RU)
Sorry, im not speak english.
Word size of FreeCAD: 64-bit
Version: 0.20.26720 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 7bca26e)
Hash: 7bca26e7c14d4d43374ff7e0c8582735b249cbfd
Python version: 3.9.9
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: Russian/Russia (ru_RU)
Sorry, im not speak english.
Re: Draft 2d offset
File?
Both solutions seem valid to me, although I know that other CAD programs (DwgCAD) will do this differently.
Both solutions seem valid to me, although I know that other CAD programs (DwgCAD) will do this differently.
Re: Draft 2d offset
There is also a Форум на русском языке.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Draft 2d offset
Wondering if the wire is not really closed, so it offset like the way it shows?
Need the model file for avoidance of doubt
Need the model file for avoidance of doubt
Re: Draft 2d offset
File:
Re: Draft 2d offset
There is a bug in the isReallyClosed() code used by the Draft_Offset command. It only checks if the first vertex of the first edge and the last vertex of the last edge coincide. But since the direction of the edges can vary, there are in fact 4 possibilities.
https://github.com/FreeCAD/FreeCAD/blob ... #L272-L276
https://github.com/FreeCAD/FreeCAD/blob ... #L272-L276
Re: Draft 2d offset
https://github.com/FreeCAD/FreeCAD/pull/5496
Edit:
Oops, it's not that simple. Will have to do some more checks.
Edit:
Oops, it's not that simple. Will have to do some more checks.
Re: Draft 2d offset
InterestingRoy_043 wrote: ↑Fri Feb 04, 2022 10:14 am There is a bug in the isReallyClosed() code used by the Draft_Offset command. It only checks if the first vertex of the first edge and the last vertex of the last edge coincide. But since the direction of the edges can vary, there are in fact 4 possibilities.
https://github.com/FreeCAD/FreeCAD/blob ... #L272-L276
Should need to test Orientation then, would elaborate. In the meantime, this is history of revision for reference
https://github.com/FreeCAD/FreeCAD/comm ... c32b9856ce
https://github.com/FreeCAD/FreeCAD/comm ... 21581570b0#
Re: Draft 2d offset
The arc edge orientation is found 'Reversed' - a situation I remember usually happen 'within edit mode' (EDIT: of a Sketch) for an arc. The arc (EDIT: geometry 'within a Sketch in edit mode') is always counter-clockwire in edit mode to my memory.
So it seems needs to verify the Vertex for testing should be 'Forward', otherwise switch to another Vertex.
So it seems needs to verify the Vertex for testing should be 'Forward', otherwise switch to another Vertex.
Code: Select all
s=Gui.Selection.getSelection()[0]
ss=s.Shape
ssw=ss.Wires[0]
import draftgeoutils.wires as wires
wires.isReallyClosed(ssw)
False
# wire.Vertexes[0] is not wire.Vertexes[-1] as previously noted
ssw.Vertexes[0].Point
Vector (22.016533000365484, -22.04014152497416, 0.0)
ssw.Vertexes[-1].Point
Vector (-22.203595540784868, -21.85167977200638, 0.0)
ss.Edges
[<Edge object at 0x7f8d1400bbf0>, <Edge object at 0x55572c84ba60>, <Edge object at 0x55572c5d3ed0>, <Edge object at 0x55572c1a2760>, <Edge object at 0x55572c1a27e0>, <Edge object at 0x55572c1a2860>, <Edge object at 0x55572c1a28e0>, <Edge object at 0x55572c807610>]
sse1=ss.Edges[0]
sse1.Vertexes[0].Point
Vector (22.016533000365484, -22.04014152497416, 0.0)
len(ss.Edges)
8
# last edge Vertexes[1] is not 1st edge Vertexes[0]
sse2=ss.Edges[7]
sse2.Vertexes[1].Point
Vector (-22.203595540784868, -21.85167977200638, 0.0)
# found it is last edge Vertexes[0] == 1st edge Vertexes[0]
sse2.Vertexes[0].Point
Vector (22.016533000365484, -22.04014152497416, 0.0)
sse2v0=sse2.Vertexes[0]
sse2v1=sse2.Vertexes[1]
# found the vertex orientation is 'Reversed' for the arc
sse2v0.Orientation
'Reversed'
sse2v1.Orientation
'Forward'
sse1v0=sse1.Vertexes[0]
sse1v1=sse1.Vertexes[1]
sse1v0.Orientation
'Forward'
sse1v1.Orientation
'Reversed'
Re: Draft 2d offset
I was unaware of the Orientation property of vertices. It is indeed interesting. But why do we have the Draft isReallyClosed() function? what is wrong with isClosed()?
Last edited by Roy_043 on Fri Feb 04, 2022 5:26 pm, edited 1 time in total.