Author Topic: Offset 2 polyline both sides at different distances  (Read 1766 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Offset 2 polyline both sides at different distances
« on: August 27, 2015, 11:54:59 AM »
Is it possible to offset a line on both sides with two different distances? I was trying to make a macro do it. Apparently I can not offset (-) negatively. Just give you an idea, we are trying to offset curb and gutters and all of our stuff is from face of curb and not back when we draw.
Civil3D 2020

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Offset 2 polyline both sides at different distances
« Reply #1 on: August 30, 2015, 02:58:37 AM »
Very quickly modified from this: http://forums.augi.com/showthread.php?3986-Double-Line-Offset

Works...may have to reverse your lines... might be better to isolate your lines do offsets for all one side then the other...or if I have time will put routine up that will allow time to select side of lines for each offset


Code - Auto/Visual Lisp: [Select]
  1. (defun c:test (/ ent dist2 dist obj kwrd)
  2.   (vl-load-com) ;<-good!
  3.   (while (not ent) ;<- this sort of loop is hard to get out of, see my code
  4.     (if (eq (setq ent (car (entsel "\nSelect line to offset:  "))) ;<- (if (not (setq...)))
  5.             nil ;<- testing for nil is unneeded, use LISP's return values directly
  6.         )
  7.       (princ "\nThat was not a line.  Please select again:  ") ;<- what if I pick a circle?
  8.     )
  9.   )
  10.   (initget (+ 1 2 4 64)) ;<- use of the Z-blocker was nice
  11.   (setq dist (getdist "\nEnter offset distance:  "))
  12.   (setq dist2 (getdist "\nDistance 2"))
  13.   (initget (+ 2 4) "Yes No") ;<- bits 2 and 4 server no purpose in (getkword)
  14.   (setq kwrd (getkword "\nDelete original object [Yes/No] <Yes>:  ")) ;<- 2000-style options, good!
  15.   (if (/= kwrd "No") ;<- this statement is unneeded, see below
  16.     (setq kwrd "Yes")
  17.   )
  18.   (setq obj (vlax-ename->vla-object ent))
  19.   (vla-offset obj dist)
  20.   (vla-offset obj (* dist2 -1))
  21.   (if (eq kwrd "Yes") ;<- (/= kwrd "No")
  22.     (vla-erase obj)
  23.   )
  24.   (princ)
  25. )
  26.  

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Offset 2 polyline both sides at different distances
« Reply #2 on: September 01, 2015, 02:00:38 PM »
I don't know if the OP is still interested in this topic...
Should that be the case this list of links by CAB may be of interest:
http://www.theswamp.org/index.php?topic=41906.msg470757#msg470757
Specifically this link:
http://www.theswamp.org/index.php?topic=32743.0