Jump to content

Recommended Posts

Posted
LoL

I wish I had 1/10th the free time you have.

 

Nice work Lee.

 

Thanks Alan :)

 

I won't have this much free time for long ... I'm off to uni in a week or so :)

Posted
Thanks Alan :)

 

I won't have this much free time for long ... I'm off to uni in a week or so :)

Right on.

Man, Europe is way behind America. We've been back for 3 weeks.

Posted
Right on.

Man, Europe is way behind America. We've been back for 3 weeks.

 

Ahh, different uni's, different times.. some of the Uni's here have already started, but break up earlier too.

Posted
Ahh, different uni's, different times.. some of the Uni's here have already started, but break up ealier too.

True. My wife starts back teaching at the local community college a week before I go back to the university. Sucks for spring break.

Posted
True. My wife starts back teaching at the local community college a week before I go back to the university. Sucks for spring break.

 

You go to university? I didn't realise that - are you a lecturer or student?

Posted
You go to university? I didn't realise that - are you a lecturer or student?

 

Student, had to take a little break after the baby was born.

Posted
Student, had to take a little break after the baby was born.

 

Cool, what you studying mate? ('scuse the noseyness)

Posted
Cool, what you studying mate? ('scuse the noseyness)

 

Civil Engineering

Ask all you like. :)

Posted
Civil Engineering

Ask all you like. :)

 

Sounds good mate - good luck with it. :)

  • 9 months later...
Posted

Hi Lee!

 

Thanks for this lisp! I found it to work great on 2D polylines, but I am struggling on 3D polylines to get the new line in centre on plan view and to give it a z value. Can you please try it on my drawing and see if you get the same error as I did? What I thought it should be able to do is to draw a polyline in centre of two polylines in plan (xy) view and given the middle z value of the two 3D polylines?

 

Please also see the attached snapshot for an illustration of my problem. It shows the two 3D polylines in yellow and the one created by your lisp in green.

 

 

Regards,

Sam

test.dwg

problem.jpg

  • 10 months later...
Posted

Hi, thanks for this routine to draw the centreline between 2 polylines. It is perfect for what I want - fixing a whiteline between 2 vehicle swept paths.

I saw you also wrote a routine here http://www.cadtutor.net/forum/showthread.php?31521-Lisp-routine-for-the-widths-of-perpendicular-lines& to measure the distance between 2 polylines at intervals but only for polylines with two vertices. You are very industrious.

My request (if you had time) would be for the routine that generates the centre line to be adapted to place an aligned dimension at intervals between 2 polylines.

I might try myself but it will be like taking a chainsaw to a fine cabinet - stand back!!

thanks

roger

  • 4 years later...
Posted
lol

i wish i had 1/10th the free time you have.

 

^^^^^^^^^^^^ this ^^^^^^^^^^^^^^^^^

Posted
^^^^^^^^^^^^ this ^^^^^^^^^^^^^^^^^

 

lol

......................

  • 1 year later...
Posted
Try this dude:

 

(defun c:cPoly (/ ent1 ent2 i len pt p1 ptlst)
 (vl-load-com)

 (if (and (setq ent1 (car (entsel "\nSelect First Polyline: ")))
          (wcmatch (cdr (assoc 0 (entget ent1))) "*POLYLINE"))
   (if (and (setq ent2 (car (entsel "\nSelect Second Polyline: ")))
            (wcmatch (cdr (assoc 0 (entget ent2))) "*POLYLINE"))
     (progn
       (setq i -1 len (/ (vla-get-Length
                           (vlax-ename->vla-object ent1)) 100.))
       (while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
         (setq p1 (vlax-curve-getClosestPointto ent2 pt t)
               ptlst (cons (polar pt (angle pt p1) (/ (distance pt p1) 2.)) ptlst)))
       (setq ptlst (apply 'append
                     (mapcar
                       (function
                         (lambda (x)
                           (list (car x) (cadr x)))) ptlst)))
       (vla-AddLightWeightPolyline
         (vla-get-ModelSpace
           (vla-get-ActiveDocument
             (vlax-get-acad-object)))
         (vlax-make-variant
           (vlax-safearray-fill
             (vlax-make-safearray
               vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))

 (princ))

 

Dear Friend,

same way instead of Selecting Polyline, if we select Line Entity, It has to draw straight polyline, with the requiered width ( i.e Gap between these 2 lines), it will be helpful for me. please develop this Lisp for me.

  • 1 year later...
Posted

Wonderfully simple code. I am trying to do something similar but need a little help. I am looking at interpolating intermediate elevation profile lines. Specifically I have 5 ft elevation profile lines and I need to interpolate so that I can get 1 ft profiles. I was able to expand your code above as noted below, but this entails having to pick the outside polylines 4 times instead of one. I am not experienced enough at LISP code to figure out how to have all the intermediate lines generated by simply clicking the outside polylines once. Thought someone might be able to give me some suggestions.

 

Thanks

 

(defun c:cPoly (/ ent1 ent2 i len pt p1 ptlst)
(vl-load-com)

(if (and (setq ent1 (car (entsel "\nSelect First Polyline: ")))
(wcmatch (cdr (assoc 0 (entget ent1))) "*POLYLINE"))
(if (and (setq ent2 (car (entsel "\nSelect Second Polyline: ")))
(wcmatch (cdr (assoc 0 (entget ent2))) "*POLYLINE"))
(progn
(setq i -1 len (/ (vla-get-Length
(vlax-ename->vla-object ent1)) 100.))
(while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
(setq p1 (vlax-curve-getClosestPointto ent2 pt t)
ptlst (cons (polar pt (angle pt p1) (* (distance pt p1) 0.2.)) ptlst)))
(setq ptlst (apply 'append
(mapcar
(function
(lambda (x)
(list (car x) (cadr x)))) ptlst)))
(vla-AddLightWeightPolyline
(vla-get-ModelSpace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))

(progn
(setq i -1 len (/ (vla-get-Length
(vlax-ename->vla-object ent1)) 100.))
(while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
(setq p1 (vlax-curve-getClosestPointto ent2 pt t)
ptlst (cons (polar pt (angle pt p1) (* (distance pt p1) 0.4.)) ptlst)))
(setq ptlst (apply 'append
(mapcar
(function
(lambda (x)
(list (car x) (cadr x)))) ptlst)))
(vla-AddLightWeightPolyline
(vla-get-ModelSpace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))

(progn
(setq i -1 len (/ (vla-get-Length
(vlax-ename->vla-object ent1)) 100.))
(while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
(setq p1 (vlax-curve-getClosestPointto ent2 pt t)
ptlst (cons (polar pt (angle pt p1) (* (distance pt p1) 0.6.)) ptlst)))
(setq ptlst (apply 'append
(mapcar
(function
(lambda (x)
(list (car x) (cadr x)))) ptlst)))
(vla-AddLightWeightPolyline
(vla-get-ModelSpace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))

(progn
(setq i -1 len (/ (vla-get-Length
(vlax-ename->vla-object ent1)) 100.))
(while (setq pt (vlax-curve-getPointatDist ent1 (* (setq i (1+ i)) len)))
(setq p1 (vlax-curve-getClosestPointto ent2 pt t)
ptlst (cons (polar pt (angle pt p1) (* (distance pt p1) 0.8.)) ptlst)))
(setq ptlst (apply 'append
(mapcar
(function
(lambda (x)
(list (car x) (cadr x)))) ptlst)))
(vla-AddLightWeightPolyline
(vla-get-ModelSpace
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-VBDouble (cons 0 (1- (length ptlst)))) ptlst))))))

(princ))

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...