Feature: offset tool in sketcher

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
bleber
Posts: 258
Joined: Thu Jun 30, 2016 5:12 pm

Re: Feature: offset tool in sketcher

Post by bleber »

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

Post by RandomUser »

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: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature: offset tool in sketcher

Post by edi »

@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
Veteran
Posts: 5092
Joined: Wed May 04, 2016 3:58 pm

Re: Feature: offset tool in sketcher

Post by paullee »

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 64 times
Screenshot from 2020-10-18 08-22-18.png
Screenshot from 2020-10-18 08-22-18.png (208.34 KiB) Viewed 3121 times
Screenshot from 2020-10-18 08-25-15.png
Screenshot from 2020-10-18 08-25-15.png (219.6 KiB) Viewed 3121 times
Screenshot from 2020-10-18 08-25-57.png
Screenshot from 2020-10-18 08-25-57.png (326.71 KiB) Viewed 3121 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature: offset tool in sketcher

Post by Kunda1 »

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!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
paullee
Veteran
Posts: 5092
Joined: Wed May 04, 2016 3:58 pm

Re: Feature: offset tool in sketcher

Post by paullee »

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 79 times
Screenshot from 2020-10-19 01-16-15.png
Screenshot from 2020-10-19 01-16-15.png (259.36 KiB) Viewed 3052 times
Screenshot from 2020-10-19 01-16-17.png
Screenshot from 2020-10-19 01-16-17.png (273.31 KiB) Viewed 3052 times
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature: offset tool in sketcher

Post by edi »

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 3002 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.
zardozer
Posts: 49
Joined: Sat Nov 07, 2020 2:35 am

Re: Feature: offset tool in sketcher

Post by zardozer »

Is this macro not in the addon manager? I feel like it should be, but I couldn't find it. It would be a lot more accessible to more people.
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Feature: offset tool in sketcher

Post by chrisb »

edi, care to add it?
edi wrote: Mon Oct 19, 2020 12:25 pm ping
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Feature: offset tool in sketcher

Post by edi »

@chrisb: What do I have to do?
Post Reply