Feature: offset tool in sketcher

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
bleber
Posts: 31
Joined: Thu Jun 30, 2016 5:12 pm

Re: Feature: offset tool in sketcher

Postby bleber » Thu Sep 24, 2020 10:07 pm

I test the scipt and works fine, good work!
Some easi feature: Mantain offset mode with ruberband to make multiple offsets until clik right mouse key to leave offset mode.
RandomUser
Posts: 6
Joined: Tue Aug 11, 2020 5:34 am

Re: Feature: offset tool in sketcher

Postby RandomUser » Sun Oct 11, 2020 3:53 am

I'm running into a few issues while trying to use the 3.0 version of the macro.

Code: Select all

Traceback (most recent call last):
  File "/home/test/Downloads/OffsetInSketcher03.FCMacro", line 418, in <module>
    ex = OffsetDialog() 
  File "/home/test/Downloads/OffsetInSketcher03.FCMacro", line 19, in __init__
    self.SelGeoId = self.getElements() # init the command
  File "/home/test/Downloads/OffsetInSketcher03.FCMacro", line 66, in getElements
    point = Sketch.getSketchPoint(SelGeoId[0]) # start of rubber band
<type 'exceptions.TypeError'>: unbound method getSketchPoint() must be called with Sketch instance as first argument (got int instance instead)
and

Code: Select all

Traceback (most recent call last):
  File "/home/test/Downloads/OffsetInSketcher03.FCMacro", line 45, in getPoint
    OffsetInSketcher.addOffset(self.SelGeoId,self.OffsetLine) # call the command
AttributeError: OffsetDialog instance has no attribute 'SelGeoId'

OS: Debian GNU/Linux 10 (buster)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.
Build type: Release
Python version: 2.7.16rc1
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
edi
Posts: 86
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature: offset tool in sketcher

Postby edi » Tue Oct 13, 2020 3:22 pm

@RandomUser:
Use the workflow:
- open a sketch
- draw some lines and/or arcs (like in the examples above)
- select at least one element
- start the script
paullee
Posts: 2661
Joined: Wed May 04, 2016 3:58 pm

Re: Feature: offset tool in sketcher

Postby paullee » Sun Oct 18, 2020 12:30 am

Not reading every line in the whole thread but sounds useful :D

FWIW -
  1. For reference Draft Gui has a tool for Offset, which internally use a few Draft functions by memory offset() offsetWire()
  2. Arch Wall also use offsetWire(), to 'thicken' a wire on 2d plane and extrude 'upward' to build a 3d wall.
See the effect of both tool in screencaptures and files below.

p.s.
It seems there is some bugs in Draft Offset ? - The distance between the 2 offsetted (blue) arcs to the original (white) arc seems different :?:
Anywall, it doesn't affect ArchWall.

OffsetTest_ r.FCStd
(25.09 KiB) Downloaded 4 times
Screenshot from 2020-10-18 08-22-18.png
Screenshot from 2020-10-18 08-22-18.png (208.34 KiB) Viewed 182 times
Screenshot from 2020-10-18 08-25-15.png
Screenshot from 2020-10-18 08-25-15.png (219.6 KiB) Viewed 182 times
Screenshot from 2020-10-18 08-25-57.png
Screenshot from 2020-10-18 08-25-57.png (326.71 KiB) Viewed 182 times
User avatar
Kunda1
Posts: 8405
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature: offset tool in sketcher

Postby Kunda1 » Sun Oct 18, 2020 11:49 am

paullee wrote:
Sun Oct 18, 2020 12:30 am
p.s.
It seems there is some bugs in Draft Offset ? - The distance between the 2 offsetted (blue) arcs to the original (white) arc seems different
Is this related to issue #3859?
If not please open a ticket, thanks!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
paullee
Posts: 2661
Joined: Wed May 04, 2016 3:58 pm

Re: Feature: offset tool in sketcher

Postby paullee » Sun Oct 18, 2020 5:20 pm

Kunda1 wrote:
Sun Oct 18, 2020 11:49 am

Is this related to issue #3859?
If not please open a ticket, thanks!
Not the same issue, at least not directly related (maybe the underlying Draft / OffsetWire() / Offfset() problems)

But it seems the behaviour is not consistent ... can someone confirm... maybe to discuss in separate thread.

p.s.
The purpose of bringing up Draft Offset is just want to highlight this tool has not problem with 2 arc not tangentially connected, just if they are still connected after offsetting.
OffsetTest_ r2.FCStd
(27.05 KiB) Downloaded 3 times
Screenshot from 2020-10-19 01-16-15.png
Screenshot from 2020-10-19 01-16-15.png (259.36 KiB) Viewed 113 times
Screenshot from 2020-10-19 01-16-17.png
Screenshot from 2020-10-19 01-16-17.png (273.31 KiB) Viewed 113 times
edi
Posts: 86
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature: offset tool in sketcher

Postby edi » Mon Oct 19, 2020 12:25 pm

The purpose of bringing up Draft Offset is just want to highlight this tool has not problem with 2 arc not tangentially connected, just if they are still connected after offsetting.
I know, the tread has become long, but I want to note the following:
If arcs are not tangentially connected to their neighbours, its's easy to find indefinable situations, see screenshot:
OffsetSituations.png
OffsetSituations.png (14.57 KiB) Viewed 63 times
In the two pictures, the left lines are the original: Two lines and an arc with radius 5.
- The left figure using offset value 2 is easy to calculate. Two lines and an arc lead to two lines and an arc.
- The right figure having offset value 4 will lead to only one single line. (or two lines which are in line)
You will find situations, where no reasonable solution is available.