Author Topic: Dynamic Offset  (Read 24169 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Dynamic Offset
« on: October 18, 2009, 07:58:14 AM »
Was experimenting with this idea..., perhaps it might be useful to some of you, (possibly those doing piping?) - let me know what you think  :wink:





Settings Dialog:



Code: [Select]
;;;`,,`,,`,,`,,`,,`,,;;;
;;;,,`,,`,,`,,`,,`,,`;;;
;;                                                                               ;;
;;                        --=={  Dynamic Offset  }==--                           ;;
;;                                                                               ;;
;;  Allows the user to dynamically offset multiple objects simultaneously, by    ;;
;;  either specifying the offset distance via mouse-click, or at the             ;;
;;  command-line. The command-line default will remember the last offset entered ;;
;;  by the user.                                                                 ;;
;;                                                                               ;;
;;  Object Snap functionality is retained, and the on-screen offset distance is  ;;
;;  determined by the nearest object in the offset selection set.                ;;
;;                                                                               ;;
;;  The user can use the +/- keys to change the number of offsets, or,           ;;
;;  alternatively, the user can press 'N' and specify the number of offsets      ;;
;;  directly.                                                                    ;;
;;                                                                               ;;
;;  The user can also press 'S' during object offset to change the layer,        ;;
;;  linetype, lineweight, and colour of the resultant offset objects.            ;;
;;                                                                               ;;
;;  By pressing TAB the user can switch modes between offsetting both sides or   ;;
;;  just one side of an object.                                                  ;;
;;                                                                               ;;
;;  The toggle for retaining or deleting the original Objects can be altered by  ;;
;;  pressing 'D'. The user can hold SHIFT to highlight the offset entities.      ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  FUNCTION SYNTAX:  DYNOFF                                                     ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  AUTHOR:                                                                      ;;
;;                                                                               ;;
;;  Copyright Lee McDonnell, October 2009. All Rights Reserved.                ;;
;;                                                                               ;;
;;      { Contact: Lee Mac @ TheSwamp.org, CADTutor.net }                        ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  WITH THANKS TO:                                                              ;;
;;                                                                               ;;
;;         Elpanov Evgeniy           ~~   Code for GrRead OSnap Symbols.     ;;
;;...............................................................................;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  VERSION:                                                                     ;;
;;                                                                               ;;
;;     1.0   ~~   17th October 2009   ~~   First Release                    ;;
;;...............................................................................;;
;;     1.1   ~~   19th October 2009   ~~   Added Object Snap functionality  ;;
;;...............................................................................;;
;;     1.2   ~~   20th October 2009   ~~   Added Multiple Offset Option     ;;
;;...............................................................................;;
;;     1.3   ~~   21st October 2009   ~~   Updated Object Snap Coding       ;;
;;...............................................................................;;
;;     1.4   ~~   23rd October 2009   ~~   Updated Offset Number Options    ;;
;;                                             Added option to specify Offset   ;;
;;                                              factor.                          ;;
;;...............................................................................;;
;;     1.5   ~~   29th October 2009   ~~   Added Settings Dialog.           ;;
;;...............................................................................;;
;;     1.6   ~~   8th December 2009   ~~   Added option to only offset      ;;
;;                                              object on one side.              ;;
;;...............................................................................;;
;;     1.7   ~~  10th December 2009   ~~   Added option to delete original  ;;
;;                                              objects.                         ;;
;;...............................................................................;;
;;     1.8   ~~  14th December 2009   ~~   Added ability to offset to the   ;;
;;                                              center of two objects.           ;;
;;...............................................................................;;
;;     1.9   ~~  16th December 2009   ~~   Modified method for spacing      ;;
;;                                              multiple offsets.                ;;
;;                                             Improved OSnap Coding.           ;;
;;...............................................................................;;
;;     2.0   ~~  18th December 2009   ~~   Added colour change for offset   ;;
;;                                              entities.                        ;;
;;                                             Fixed Bug when using Offset      ;;
;;                                              Factor.                          ;;
;;...............................................................................;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;;`,,`,,`,,`,,`,,`,,;;;
;;;,,`,,`,,`,,`,,`,,`;;;

[ Code updated to Version 2.0 ]

Code available here.
« Last Edit: November 14, 2010, 08:04:16 PM by Lee Mac »

Crank

  • Swamp Rat
  • Posts: 1441
Re: Dynamic Offset
« Reply #1 on: October 18, 2009, 12:19:41 PM »
Lee,

I like how it's working, but as it is this is almost useless to me. In the dynamic part only a through point is possible, but osnaps are not working.
I think it would also a good idea to have a list with fixed distances. Pressing the CTRL-key would use a picked distance (like relaxed constrains) and if not pressed it would use the fixed distances of the list.

 Vault Professional 2018     /      Building Design Suite Ultimate 2017     /     AEC Collection 2018 + 2019 +2020

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Dynamic Offset
« Reply #2 on: October 18, 2009, 12:49:07 PM »
I was thinking the same thing. Offsetting is such a specific task.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Dynamic Offset
« Reply #3 on: October 19, 2009, 01:00:47 AM »
:)

I will also wish Autodesk can directly support grread with osnap.

Here, Evgeniy also write the similar function :)

http://www.theswamp.org/index.php?topic=12692.0
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Dynamic Offset
« Reply #4 on: October 19, 2009, 01:13:24 AM »
:)

I will also wish Autodesk can directly support grread with osnap.

Wouldn't that be nice. :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Dynamic Offset
« Reply #5 on: October 19, 2009, 07:07:51 AM »
Thanks for the feedback guys, I realise that with most GrRead programs, OSnap is needed, and I will consider incorporating it into this example in the near future.

You can specify an offset at the command line, and it will also remember the last entry as default. I wanted to make it as generic as possible, but I shall consider your list idea.  :wink:

Thanks

Lee

Andrea

  • Water Moccasin
  • Posts: 2360
Re: Dynamic Offset
« Reply #6 on: October 19, 2009, 01:29:32 PM »
Hi Lee...

another nice one ! congrat !

Idea:
It will be nice to have the possibility to have choice between offset 1 or 2 sides of the object.

Also,..there's more from my head.. :roll:
(see pic)

Keep smile...

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Dynamic Offset
« Reply #7 on: October 20, 2009, 07:17:01 AM »
Thanks Andrea - some nice ideas there indeed... I shall see what I can add to it when time permits  :wink:

Thanks for the suggestions, I also have a few more ideas of my own for this one  :wink:

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Dynamic Offset
« Reply #8 on: October 20, 2009, 07:28:16 AM »
I have updated the code in the first post to include Version 1.1, hopefully incorporating the all-important Object Snap!  :angel:

VovKa

  • Swamp Rat
  • Posts: 1153
  • Ukraine
Re: Dynamic Offset
« Reply #9 on: October 20, 2009, 01:11:53 PM »

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Dynamic Offset
« Reply #10 on: October 20, 2009, 01:19:43 PM »
I have updated the code in the first post to include Version 1.1, hopefully incorporating the all-important Object Snap!  :angel:
The osnap marker is displaying a million miles (km, since your british  :wink:) away.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Dynamic Offset
« Reply #11 on: October 20, 2009, 01:25:01 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Dynamic Offset
« Reply #12 on: October 21, 2009, 05:16:35 AM »
I have updated the code in the first post to include Version 1.1, hopefully incorporating the all-important Object Snap!  :angel:
The osnap marker is displaying a million miles (km, since your british  :wink:) away.

miles... since I'm british...  :-P

It does work fine for me, but I shall look into it all the same  :-)

Lee Mac

  • Seagull
  • Posts: 12270
  • London, England
Re: Dynamic Offset
« Reply #13 on: October 21, 2009, 05:29:45 AM »
I have updated the code to Version 1.2, this will not yet correct the oSnap difficulties you are having, but there is a new option to offset multiple times (by pressing +/-).  ;-)

Just out of interest, are you all experiencing the problems that Alan reported?

Lee

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Dynamic Offset
« Reply #14 on: October 21, 2009, 10:27:07 AM »
Lee, was the method for entering/backspacing a number value one of your ideas? That is freaking brilliant. I'm totally stealing that.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox