Jump to content

Recommended Posts

Posted

Any thoughts on the best method to do an offset or stretch on a taper?

 

It would be nice to go both directions, since people change their minds.

 

The amount of offset varies and so does the tapers, etc.

 

The arcs and side tapered parts would be nice to do if possible, but just the tops need extended for now.

 

 

Tapered Offset.png

Offset at taper.dwg

Posted

If the sides are parallel, you could set the UCS to them and stretch with ortho on. Too simple?

  • Thanks 1
Posted
1 hour ago, SLW210 said:

Any thoughts on the best method to do an offset or stretch on a taper?

 

It would be nice to go both directions, since people change their minds.

 

The amount of offset varies and so does the tapers, etc.

 

The arcs and side tapered parts would be nice to do if possible, but just the tops need extended for now.

 

 

Tapered Offset.png

Offset at taper.dwg 114.32 kB · 1 download

 Why not the old OFFSET command ?

 

Command: _offset
Current settings: Erase source=No  Layer=Source  OFFSETGAPTYPE=0
Specify offset distance or [Through/Erase/Layer] <Through>:  Specify second point:
Select object to offset or [Exit/Undo] <Exit>:
Specify point on side to offset or [Exit/Multiple/Undo] <Exit>:
Select object to offset or [Exit/Undo] <Exit>: *Cancel*
Command:

 

 

Offset at taper by offset command-Model.pdf Offset at taper by offset command.dwg

  • Thanks 1
Posted

Hi

I have something that works fine with straight segments, but fails if the picked segment or the connected ones are bulged.

It uses grread with a rudimentary osnap implementation and it just allow picking points, you can't specify offset distance.

 

Resize.gif

  • Thanks 1
Posted

This link does this but it asks for an area instead of a length

 

  • Thanks 1
Posted
2 hours ago, CyberAngel said:

If the sides are parallel, you could set the UCS to them and stretch with ortho on. Too simple?

Hence the Taper part of my question, only need to adjust the top height, the sides are tapered

 

1 hour ago, devitg said:

 Why not the old OFFSET command ?

 

Command: _offset
Current settings: Erase source=No  Layer=Source  OFFSETGAPTYPE=0
Specify offset distance or [Through/Erase/Layer] <Through>:  Specify second point:
Select object to offset or [Exit/Undo] <Exit>:
Specify point on side to offset or [Exit/Multiple/Undo] <Exit>:
Select object to offset or [Exit/Undo] <Exit>: *Cancel*
Command:

 

 

Offset at taper by offset command-Model.pdf 9.38 kB · 1 download Offset at taper by offset command.dwg 97.16 kB · 0 downloads

 

That offset the entire shape, as in the image and .dwg, just the top line in this example.

 

 

28 minutes ago, Stefan BMR said:

Hi

I have something that works fine with straight segments, but fails if the picked segment or the connected ones are bulged.

It uses grread with a rudimentary osnap implementation and it just allow picking points, you can't specify offset distance.

 

Resize.gif

 

That looks workable.

 

 

22 minutes ago, troggarf said:

This link does this but it asks for an area instead of a length

 

 

I might could adapt something in that thread.

Posted

My idea is must be a pline else pick the 3 lines, when you select a pline segment can get angle of segment so the offset is a sin cos tan answer using polar with corrected distance, then just redo the vertice X&Y value.  I think its cos ang * offset. ang is 90 to offest line. maybe later today 

 

image.png.f1fac1d4a03aabdded48860743ce6b39.png

  • Thanks 1
Posted (edited)

I think the most important thing is to have something that returns a list of the three segments involved in the modification:
- the segment to the left of the selected one
- the selected segment
- the segment to the right of the selected one.

Once this is done, it's a matter of moving the selected segment and calculating the new vertices with the other two segments by calculating intersections.

I've attached some code for this.

 

Note that:
x = list of an lwpolyline returned by entget
pk = point returned by entsel when selecting the segment on the screen

(defun dameSgmtos (x pk / f d p i s a tam a1 a2 b1 b2 c1 c2 sa sp)
  (setq	tam (* (* (getvar "PICKBOX")
		  (/ (getvar "VIEWSIZE")
		     (cadr (getvar "SCREENSIZE"))
		  )
	       )
	       2
	    )
	b1 (cdr (assoc 10 x))
	b2 (cdr (assoc 10 (cdr (member (cons 10 b1) x))))
	c2 (cdr (assoc 10 (reverse x)))
	c1 (cdr (assoc 10 (cdr (member (cons 10 c2) (reverse x)))))
  )
  (while (and
           (setq a1 (cdr p) a2 f f (cdr (assoc (if pk 10 11) (setq x (cdr (member (setq p (assoc 10 x)) x))))))
	   (if pk (not (inters f (cdr p) (polar pk (+ (setq a (angle f (cdr p))) 1.5708) tam) (polar pk (- a 1.5708) tam))))
         )
  )
  (setq sc (list (cdr p) f)
	f (cdr (assoc (if pk 10 11) (cdr (member (setq p (assoc 10 x)) x))))
	sp (if f (list (cdr p) f) (list b1 b2))
	sa (if a1 (list a1 a2) (list c1 c2))
  )
  (list sa sc sp)
)

 

If you do not find a way to use it, I'll try to do it this afternoon or tomorrow.

But this is not certain because I have been quite busy for a few days.

Edited by GLAVCVS
  • Like 1
Posted

@GLAVCVS agree need the 3 sides, then can work out the internal angle which results in working out the new length of the side lines and a new point, then update the points.

 

This is get segment of pline.

 

(defun getplineseg ( / elst ename pt param preparam postparam)
(setq elst (entsel "\nSelect pline segment: "))
(setq ename (car elst))
(setq pt (cadr elst))
(setq pt (vlax-curve-getClosestPointTo ename pt))
(print (setq param (vlax-curve-getParamAtPoint ename pt)) )
(print (setq preparam (fix param)) )
(print (setq postparam (1+ preparam)) )
(setq pt1 (vlax-curve-getPointAtParam ename preparam)
pt2 (vlax-curve-getPointAtParam ename postparam))
)

 

I would have a go but very busy at moment. maybe later on have a couple of outstanding tasks. Some one welcome to use the code provided as a start point, get internal angle is out there also.

  • Like 1
Posted

I think it turned out nicely.
And I hope it's what you need, too

;*******************  p o r d e s í a r g o  ********************
;************************ G L A V C V S *************************
;************************** F E C I T ***************************
(defun c:mueveSegmto (/ lstSg dist i se lado op pr pr1 pa pb p1 p2 p3 p4 sgC r dameSgmtos)
  (defun dameSgmtos (x pk / f d p s a tam a1 a2 b1 b2 c1 c2 sa sp)
    (setq tam (* (* (getvar "PICKBOX")
		    (/ (getvar "VIEWSIZE")
		       (cadr (setq ss (getvar "SCREENSIZE")))
		    )
	         )
		 2
	      )
	  b2 (cdr (assoc 10 (cdr (member (cons 10 (setq b1 (cdr (assoc 10 x)))) x))))
	  c1 (cdr (assoc 10 (cdr (member (cons 10 (setq c2 (cdr (assoc 10 (reverse x))))) (reverse x)))))
    )
    (while (and
             (setq a1 (cdr p) a2 f f (cdr (assoc (if pk 10 11) (setq x (cdr (member (setq p (assoc 10 x)) x))))))
	     (not (setq i (inters f (cdr p) (polar pk (+ (setq a (angle f (cdr p))) 1.5708) tam) (polar pk (- a 1.5708) tam))))
           )
    )
    (setq sc (list (cdr p) f)
	  f (cdr (assoc (if pk 10 11) (cdr (member (setq p (assoc 10 x)) x))))
	  sp (if f (list (cdr p) f) (list b1 b2))
	  sa (if a1 (list a1 a2) (list c1 c2))
    )
    (list sa sc sp)
  )
  (setq dist (getreal "\nDistance of traslation (ENTER to get the distance on screen): "))
  (if (setq lstSg (dameSgmtos (entget (car (setq se (entsel "\nSelect any segment in LWPOLYLINE...")))) (setq pr (cadr se))))
    (if (setq pr1 (getpoint (setq pr i) "\nSide to act..."))
      (if (setq op (if (and
                         (> (setq aC (angle (setq p2 (car (setq sgC (cadr lstSg)))) (cadr sgC))) (setq aR (angle pr pr1)))
			 (< (abs (- aC aR)) PI)
		       )
		     -
		     +
		   )
	  )
	  (setq dist
		 (if dist
		   dist
		   (distance pr1 (inters p2 (setq p3 (cadr sgC)) (polar pr1 (- (setq ar (angle p2 p3)) (/ pi 2)) 9999) (polar pr1 (+ aR (/ pi 2)) 9999) nil))
		 )
	        pa (polar p2 (setq a (op (angle p2 (setq p3 (cadr sgC))) (/ pi 2.0))) dist)
		pb (polar p3 a dist)
		px1 (inters pa pb (car (car lstSg)) p2 nil)
		px2 (inters pa pb p3 (cadr (last lstSg)) nil)
		r (entmod (subst (cons 10 px1) (cons 10 p2) (entget (car se))))
		r (entmod (subst (cons 10 px2) (cons 10 p3) (entget (car se))))
	  )
      )
    )
  )
  (princ)
)

 

  • Thanks 1
Posted (edited)

PS: The option to measure the offset distance with the cursor will always be calculated orthogonally with respect to the vector defined by the selected segment

It is also possible that I have forgotten to include some of the variables in the list of local variables: this is a small job that I leave for whoever wants to use this code.

Edited by GLAVCVS
  • Like 1
Posted

Simply nice and useful as being able to enter distance and use entity snaps helps much!

-- Keep up the good work.

Posted

I've been out of town, I'll give everything a look tomorrow when I get back to work.

 

 

Posted

Better armored version, proof against extravagant users

 

;*******************  p o r d e s í a r g o  ********************
;************************ G L A V C V S *************************
;************************** F E C I T ***************************
(defun c:mueveSegmto (/ lstSg dist i se lado op pr pr1 pa pb p1 p2 p3 p4 sgC r aC aR asr dameSgmtos erroria errores error0)
  (defun erroria ()
    (defun errores (mens)
      (setq *error* error0)
      (prin1)
    )
    (setq error0  *error*
         *error* errores
    )
  )
  (defun asr (p1 p2 p3 / a b)
    (if (> (abs (- (setq a (angle p1 p2)) (setq b (angle p2 p3)))) PI)
      (if (< a b)
        (if (> (+ a PI PI) b) - +)
        (if (> (- a PI PI) b) - +)
      )
      (if (> a b) - +)
    )
  )
  (defun dameSgmtos (x pk / f d p s a tam a1 a2 b1 b2 c1 c2 sa sp)
    (if (= (cdr (assoc 0 x)) "LWPOLYLINE")
      (progn
	(setq tam (* (* (getvar "PICKBOX")
			(/ (getvar "VIEWSIZE")
			   (cadr (setq ss (getvar "SCREENSIZE")))
		        )
	             )
		    2
	          )
	      x (if (= (rem (cdr (assoc 70 x)) 2) 1) (cons (assoc 10 (reverse x)) x) x)
	      b2 (cdr (assoc 10 (cdr (member (cons 10 (setq b1 (cdr (assoc 10 x)))) x))))
	      c1 (cdr (assoc 10 (cdr (member (cons 10 (setq c2 (cdr (assoc 10 (reverse x))))) (reverse x)))))
	)
        (while (and
                 (setq a1 (cdr p) a2 f f (cdr (assoc (if pk 10 11) (setq x (cdr (member (setq p (assoc 10 x) ) x))))))
	         (not (setq i (inters f (cdr p) (polar pk (+ (setq a (angle f (cdr p))) 1.5708) tam) (polar pk (- a 1.5708) tam)) ))
               )
        )
        (setq sc (list (cdr p) f)
	      f (cdr (assoc (if pk 10 11) (cdr (member (setq p (assoc 10 x)) x))))
	      sp (if f (list (cdr p) f) (list b1 b2))
	      sa (if a1 (list a1 a2) (list c1 c2))
        )
        (list sa sc sp)
      )
    )
  )
  (erroria)
  (setq dist (getreal "\nDistance of traslation (ENTER to get the distance on screen): "))
  (if (setq lstSg (dameSgmtos (entget (car (setq se (entsel "\nSelect any segment in LWPOLYLINE...")))) (setq pr (cadr se))))
    (if (setq pr1 (getpoint (setq pr i) "\nSide to act..."))
      (if (setq op (asr (setq p2 (car (setq sgC (cadr lstSg)))) pr pr1))
	  (setq dist
		 (if dist
		   dist
		   (distance pr1 (inters p2 (setq p3 (cadr sgC)) (polar pr1 (- (setq aR (angle p2 p3)) (/ pi 2)) 9999) (polar pr1 (+ aR (/ pi 2)) 9999) nil))
		 )
	        pa (polar p2 (setq a (op (angle p2 (setq p3 (cadr sgC))) (/ pi 2.0))) dist)
		pb (polar p3 a dist)
		px1 (inters pa pb (car (car lstSg)) p2 nil)
		px2 (inters pa pb p3 (cadr (last lstSg)) nil)
		r (entmod (subst (cons 10 px1) (cons 10 p2) (entget (car se))))
		r (entmod (subst (cons 10 px2) (cons 10 p3) (entget (car se))))
	  )
      )
    )
    (princ "\nSelected object is not LWPOLYLINE....Exiting...")
  )
  (princ)
)

 

  • Like 1
  • Thanks 3
Posted

That looks good so far. 🍻

Posted
On 6/6/2025 at 8:03 AM, SLW210 said:

The arcs and side tapered parts would be nice to do if possible, but just the tops need extended for now.

@SLW210

FWIW, The arc sections could be much more complicated than they seem. I guess it depends on the relationships you're trying to maintain - such as tangency. A good way to see this is by adding some tangency parametric constraints, then offsetting an arc segment, then see what happens to the shape when you relocate the vertices. The examples below is not perfect, but you can see how the shape effects all the other arc features.

image.png.e9b2e702f91c4f327c8fe2470b14871a.png

 

image.png.d2ecb34f9e2b1bebdff27aacb5e03691.png

 

image.png.67c43ca696343384247ad70cbc2ae7a6.png

  • Like 1
Posted
54 minutes ago, pkenewell said:

@SLW210

FWIW, The arc sections could be much more complicated than they seem. I guess it depends on the relationships you're trying to maintain - such as tangency. A good way to see this is by adding some tangency parametric constraints, then offsetting an arc segment, then see what happens to the shape when you relocate the vertices. The examples below is not perfect, but you can see how the shape effects all the other arc features.

image.png.e9b2e702f91c4f327c8fe2470b14871a.png

 

image.png.d2ecb34f9e2b1bebdff27aacb5e03691.png

 

image.png.67c43ca696343384247ad70cbc2ae7a6.png

 

Arc segments aren't covered in the code.

We don't even know (at least I don't) how they should behave when offsetting.

 

  • Like 1
Posted

The small radii are irrelevant (sort of) it's the larger radii that would change, the smaller in between are just rounded off.

 

Examples:

Tapered Offset 3.png

Offset at taper 2.dwg

  • Like 1
Posted

I currently just explode them, PEdit them back to Plines, offset, then extend/trim as needed.

 

The smaller round offs I just use Circle, TTR and guess a good radius, usually between 1-1/2" - 3" or 4" and trim.

 

 

  • Like 1
Posted (edited)

This is something that could possibly be done geometrically, but a robust solution would be better done mathematically. I don't know exactly how I would handle it, but it would be a good challenge for some of the better mathematical programmers that are here.

 

EDIT: perhaps this would involve changing the bulge values to the selected segments and the adjacent segments by some inversely proportional amount?

Maybe using: https://www.lee-mac.com/bulgeconversion.html

Edited by pkenewell
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...